You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
IBM DB not working on M1 Macs even after with x86 version of python #797
@nanthakumaran-s From error it looks, ibm_db fails while loading /usr/lib/libstdc++.6.dylib which is pointing to an unavailable file. gcc is not coming with latest MacOS by default now from v12.1 onwards. So, you need to install gcc using below commands for ibm_db to work. ibm_db has dependency on gcc libs.
After installation of gcc it should work. If not, then share the output of ls /usr/local/lib/gcc command and add /usr/local/lib/gcc/8 into PATH and DYLD_LIBRARY_PATH system environment variables.
If still it throws error, then copy /usr/local/lib/gcc/8/libstdc++.6.dylib as /usr/lib/libstdc++.6.0.9.dylib and try. Thanks.
@nanthakumaran-s The 64bit python should be x86_64 version not x86 version. In your first post, you mentioned x86 and not x86_64. If gcc8 installation is throwing error, try to install gcc@10. I have installed gcc@10 on my M1 Chip mac system without any issue. You can also google to find more info about how to install gcc on macos M1 Chip system. Thanks.
@bimalkjha facing the same issue(using M1 mac) and tried installing gcc. Only able to install gcc@12, but not able to install other versions. It will be helpful if you can give some information on how to install other versions.
Tried with rosetta2 to install x86_64 version gcc, but not able to install it as it's throwing error-
"Your Command Line Tools (CLT) does not support macOS 13."
Is any other option on how can I use ibm_db on M1 mac?
@nanthakumaran-s, @rajpatel794 x86_64 version of homebrew was the best solution for me. It sucks because this creates a lot of other problems but at least this works. I recommend also uninstalling arm64 version of homebrew before you install the x86_64 one, this makes the solution very reliable.
@rajpatel794 I think gcc@12 should also work. If you have tried using ibm_db with gcc@12 and getting same error, then need to add /usr/local/lib/gcc/12 in DYLD_LIBRARY_PATH environment variable and try.
The root cause of this issue on M1 Chip system is a the file pointed out by /usr/lib/libstdc++.6.dylib is deleted. So, if you copy /usr/local/lib/gcc/12/libstdc++.6.0.9.dylib as /usr/lib/libstdc++.6.0.9.dylib, the issue should get resolved.
If it still fails, then please uninstall and reinstall ibm_db and share complete output of below commands:
cd ...../site-packages/
rm -rf clidriver ibm_db*
pip install ibm_db
otool -L ibm_db.cpython-39-darwin.so
otool -L clidriver/lib/libdb2.dylib
echo $DYLD_LIBRARY_PATH
echo $PATH
ls -l /usr/lib/libstdc++.6.dylib
ls /usr/local/lib/gcc
db2level
@a473000 The root cause of this issue on M1 Chip system is a the file pointed out by /usr/lib/libstdc++.6.dylib is deleted. So, if you have installed gcc and you copy /usr/local/lib/gcc/8/libstdc++.6.0.9.dylib as /usr/lib/libstdc++.6.0.9.dylib, the issue should get resolved. Pick up the libstdc++.6.0.9.dylib from your installed version of gcc. If gcc is not installed, install it first. Thanks.
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 possibilities
3. 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 run
Atlast 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 with gcc@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 compilation
STEPS:
Install the x86 version of homebrew instead of the arm version
Install the x86 version of python
Install gcc@8 using the command brew install gcc@8
Run your python scripts
NOTE: If it throws an error this file /usr/lib/libstdc++.6.dylib is missing. Go to the GCC folder in the x86 homebrew and copy libstdc++.6.0.9.dylib from there to the location where it is requiring it.
M1 MAC Steps to Install IBM DB and Support Docker RUN
Installation Steps:
Install Podman / Docker:
Podman: Follow the instructions provided on the official Podman website to install Podman on your M1 Mac.
Docker: Alternatively, you can install Docker using the native Apple Silicon version or the Rosetta-translated Intel version. Choose the method that best fits your requirements.
After installation, ensure that you set the interpreter to Python 3.8 in your development environment.
Configuration Steps:
Configure Docker for M1:
For M1 Macs, ensure compatibility by specifying the platform architecture during Docker build commands:
docker build -t <image_name> . --platform=linux/amd64
Alternatively, if you're using Podman:
podman build -t <image_name> . --platform=linux/amd64
Build Docker Image (Intel):
If you're using an Intel Mac or running Docker with Rosetta translation, use the following command to build your Docker image:
docker build -t <image_name> .
Additional Notes:
These steps are tailored for M1 Macs to ensure seamless installation and configuration of IBM DB and Docker support.
Verify that your Dockerfile and any dependencies are compatible with the specified platform architecture.
Follow these steps carefully to set up IBM DB and Docker support on your M1 Mac environment. If you encounter any issues or have further questions, feel free to seek assistance from the community or relevant support channels.
Happy coding!
@LogicLuminaryy@rajpatel794@nanthakumaran-s @a473000 We have released ibm_db v3.2.5 with native installation support for MacOS Silicon Chip system and no need to use the emulated environment with x86_64 python on M1 chip system. Please install latest version of ibm_db and verify. Thanks.
Activity
bimalkjha commentedon Oct 18, 2022
@nanthakumaran-s From error it looks, ibm_db fails while loading
/usr/lib/libstdc++.6.dylibwhich is pointing to an unavailable file. gcc is not coming with latest MacOS by default now from v12.1 onwards. So, you need to install gcc using below commands for ibm_db to work. ibm_db has dependency on gcc libs.After installation of gcc it should work. If not, then share the output of
ls /usr/local/lib/gcccommand and add/usr/local/lib/gcc/8into PATH and DYLD_LIBRARY_PATH system environment variables.If still it throws error, then copy
/usr/local/lib/gcc/8/libstdc++.6.dylibas/usr/lib/libstdc++.6.0.9.dyliband try. Thanks.nanthakumaran-s commentedon Oct 18, 2022
@bimalkjha Thanks for helping out. I have installed homebrew for arm64 architecture. Installing gcc@8 throws
Will later versions of GCC solve the problem or need to use an x86_64 architecture of homebrew ??
bimalkjha commentedon Oct 18, 2022
@nanthakumaran-s It seems you have installed x86 version of python which is 32bit. I think your system is 64bit, so you should install x86_64 version of python and gcc both. For python 3.9.10, download and install this python: https://www.python.org/ftp/python/3.9.10/python-3.9.10-macosx10.9.pkg i.e. intel-only installer. Thanks.
nanthakumaran-s commentedon Oct 23, 2022
@bimalkjha I have the x86 version of python which is actually 64bit. Kindly take a look at this
bimalkjha commentedon Oct 24, 2022
@nanthakumaran-s The 64bit python should be x86_64 version not x86 version. In your first post, you mentioned x86 and not x86_64. If gcc8 installation is throwing error, try to install gcc@10. I have installed gcc@10 on my M1 Chip mac system without any issue. You can also google to find more info about how to install gcc on macos M1 Chip system. Thanks.
rajpatel794 commentedon Nov 1, 2022
@bimalkjha facing the same issue(using M1 mac) and tried installing gcc. Only able to install gcc@12, but not able to install other versions. It will be helpful if you can give some information on how to install other versions.
Tried with rosetta2 to install x86_64 version gcc, but not able to install it as it's throwing error-
"Your Command Line Tools (CLT) does not support macOS 13."
Is any other option on how can I use ibm_db on M1 mac?
rajpatel794 commentedon Nov 1, 2022
@nanthakumaran-s If you found any solution for your system on how to use it, please help me with the same.
jonathanloske commentedon Nov 1, 2022
@nanthakumaran-s, @rajpatel794 x86_64 version of homebrew was the best solution for me. It sucks because this creates a lot of other problems but at least this works. I recommend also uninstalling arm64 version of homebrew before you install the x86_64 one, this makes the solution very reliable.
bimalkjha commentedon Nov 1, 2022
@rajpatel794 I think gcc@12 should also work. If you have tried using ibm_db with gcc@12 and getting same error, then need to add
/usr/local/lib/gcc/12in DYLD_LIBRARY_PATH environment variable and try.The root cause of this issue on M1 Chip system is a the file pointed out by
/usr/lib/libstdc++.6.dylibis deleted. So, if you copy/usr/local/lib/gcc/12/libstdc++.6.0.9.dylibas/usr/lib/libstdc++.6.0.9.dylib, the issue should get resolved.If it still fails, then please uninstall and reinstall ibm_db and share complete output of below commands:
Thanks.
bimalkjha commentedon Nov 5, 2022
@a473000 The root cause of this issue on M1 Chip system is a the file pointed out by
/usr/lib/libstdc++.6.dylibis deleted. So, if you have installed gcc and you copy/usr/local/lib/gcc/8/libstdc++.6.0.9.dylibas/usr/lib/libstdc++.6.0.9.dylib, the issue should get resolved. Pick up the libstdc++.6.0.9.dylib from your installed version of gcc. If gcc is not installed, install it first. Thanks.bimalkjha commentedon Nov 9, 2022
@nanthakumaran-s Uninstall and reinstall ibm_db after deleting
site_packages\clidriverdirectory. Let us know if issue get resolved. Thanks.bimalkjha commentedon Nov 19, 2022
@a473000 Have fresh installation of ibm_db. Then type
pythonand enter to get python prompt. Then typeimport ibm_dband enter. If it works without any error, then you can run any python test program that imports ibm_db, it should work.For ibm_db_sa related issue, you need to open issue here: https://github.com/ibmdb/python-ibmdbsa/issues Thanks.
nanthakumaran-s commentedon Nov 24, 2022
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.dylibwhich 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@11but 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@8using the commandbrew install gcc@8LogicLuminaryy commentedon Mar 5, 2024
M1 MAC Steps to Install IBM DB and Support Docker RUN
Installation Steps:
Install Podman / Docker:
Install Intel Version of Python:
Configuration Steps:
Configure Docker for M1:
docker build -t <image_name> . --platform=linux/amd64
Alternatively, if you're using Podman:
podman build -t <image_name> . --platform=linux/amd64
Build Docker Image (Intel):
docker build -t <image_name> .
Additional Notes:
Follow these steps carefully to set up IBM DB and Docker support on your M1 Mac environment. If you encounter any issues or have further questions, feel free to seek assistance from the community or relevant support channels.
Happy coding!
bimalkjha commentedon Dec 30, 2024
@LogicLuminaryy @rajpatel794 @nanthakumaran-s @a473000 We have released
ibm_db v3.2.5with native installation support for MacOS Silicon Chip system and no need to use the emulated environment with x86_64 python on M1 chip system. Please install latest version of ibm_db and verify. Thanks.