python-ibmdb: IBM DB not working on M1 Macs even after with x86 version of python
After using python x86 on my m1 mac, ibm_db is not working and leaving this error when using it with flask.
Traceback (most recent call last):
File "app.py", line 3, in <module>
import ibm_db
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ibm_db.cpython-39-darwin.so, 0x0002):
Symbol not found: (___cxa_throw_bad_array_new_length)
Referenced from: '/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/clidriver/lib/libdb2.dylib'
Expected in: '/usr/lib/libstdc++.6.dylib'
Python: 3.9.10 Architecture: x86 IBM Cloud CLI: 2.10.0+e37e09e-2022-08-24T17:38:21+00:00 ibm_db: 3.1.3
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (9 by maintainers)
UPDATE ABOUT THIS ISSUE
Thanks for the support. I have experimented with many ways to overcome this issue and let me explain the possible ways for working this package in M1 and M2 macs and if they worked or not…
1. Docker container ❌
Created a docker container with a flavour of ubuntu that can install ibmdb and expose API to the host that can run the commands passed to the container. As you have guessed, docker uses the underlying arm architecture and this will not work if you have installed docker for arm processors.
2. Fresh Install of Python for intel macs ❌
I have separated the python installation by having a fresh install of python for the x86 architecture. The problem here is not with python itself. It is because of the missing
/usr/lib/libstdc++.6.dylib
which is actually a file from GCC (Not sure why it is from GCC) as this package is using GCC to build the binaries. The possible action from here is to install GCC using homebrew right? Let me explain the other 2 possibilities3. GCC installation in arm-specific homebrew ❌
As this version of homebrew only supports
gcc@11
(Don’t know why this happens and the previous versions are not supported) this still raises issues because the homebrew was installed within the arm architecture as this package requires x86-based architecture to runAtlast x86 version of homebrew with x86 version of python ✅
As you have come to a point, you have to install the x86 version of homebrew and install
gcc@8
(I have tried withgcc@11
but for some reason, it is too not working as expected) then use the x86 version of python and its corresponding pip package to have a successful compilationSTEPS:
gcc@8
using the commandbrew install gcc@8