python-ibmdb: Python3.7 DB2 - Symbol not found

After updating to Mac Catalina (version 10.15.6), I had to re-install Python and all dependent modules. My problem now is that when adding the module ibm_db, I get the following error message when trying to run my program:

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ibm_db.cpython-37m-darwin.so, 2): Symbol not found: ___cxa_throw_bad_array_new_length Referenced from: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/clidriver/lib/libdb2.dylib Expected in: /usr/lib/libstdc++.6.dylib in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/clidriver/lib/libdb2.dylib

I am using PyCharm 2018.3.7 (CE).

Anyone that has seen this, and have a fix for this?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 29 (17 by maintainers)

Commits related to this issue

Most upvoted comments

I was having this problem too and was able to fix it. I got a new Mac running Monterey and when I got the error I could see that I didn’t have a libstdc++.6dylib alias in /usr/lib, but there was no file behind it like on my old Mac. Actually my old Mac had a lot more files and aliases than the new one. Using the advice in the posts above I perfomed the following to get ibm_db working:

  1. Installed gcc
    • this added the libstdc++ files/aliases, but did put them in the /usr/lib where my Mac was looking
  2. export DYLD_LIBRARY_PATH=/usr/local/Cellar/gcc/11.2.0_1/lib/gcc/11:${DYLD_LIBRARY_PATH}
    • This finally fixed my issue.

Hello, The problem is happening because of the v11.5 clidriver image that is uploaded here-> https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/

I have informed the site owner of the problem and they are working on solution.

Thansk @bimalkjha. Work and save my day!

1. Installed gcc
   
   * this added the libstdc++ files/aliases, but did put them in the /usr/lib where my Mac was looking

2. export DYLD_LIBRARY_PATH=/usr/local/Cellar/gcc/11.2.0_1/lib/gcc/11:${DYLD_LIBRARY_PATH}
   
   * This finally fixed my issue.

I’m having the same problem with catalina python3.9 and installing ibm_db 3.0.3 fresh. nothing has help.

export DYLD_LIBRARY_PATH=/Users/C943186/.pyenv/versions/3.9.1/lib/python3.9/site-packages/clidriver/lib Did not help.

@bimalkjha I can verify a fresh install of ibm-db pip package on macOs is working now! Thanks for pulling together the fix.

@killuazhu @klaugsand the clidriver is now updated with needed dependency and importing ibm_db should work without any problems. Kindly verify and provide your feedback!

@bimalkjha @SabaKauser I added PR https://github.com/ibmdb/python-ibmdb/pull/543 to implement the suggestion above.

@bimalkjha @SabaKauser do we have an ETA when a better fix would come? We use ibm-db as a dependency in our detect-secrets tool, and it’s affecting many of our macOs users now.

I tried the alternative IBM ODBC package trick from your suggestion above. It does work. While you guys are working on a better fix, as a tactical fix, can you please update setup.py for ibmdb to download db2 odbc driver package from that alternative location for macOs?

alternative location: https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/linuxx64/macos64_odbc_cli.tar.gz