Closed nanthakumaran-s closed 1 year ago
@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.
brew tap homebrew/homebrew-core
brew update
brew search gcc@8
brew install gcc@8
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.
@bimalkjha Thanks for helping out. I have installed homebrew for arm64 architecture. Installing gcc@8 throws
gcc@8: The x86_64 architecture is required for this software.
Error: gcc@8: An unsatisfied requirement failed this build.
Will later versions of GCC solve the problem or need to use an x86_64 architecture of homebrew ??
@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.
@bimalkjha I have the x86 version of python which is actually 64bit. Kindly take a look at this
@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 If you found any solution for your system on how to use it, please help me with the same.
@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
Thanks.
Hi can anyone help I have mac mini , M1 and I have the same problem
Traceback (most recent call last):
File "app.py", line 3, in
Can any one provide steps one by one how to fix this, thanks I have this brew and gcc but I do not know what to change in order for it to work thanks
Aslo on mac book pro BIG SUR not working as well the same error which means
@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.
Thank you for your replay and time, perhaps you would't mind write down steps to do that in terminal so people could follow, because perhaps that is there solution but I have no idea how to fix that, despite you telling me . I will try. how to check gcc version ? how to pick it up ? thank you (base) przemyslawczekaj@Przemyslaws-Mac-mini ~ % gcc --version Apple clang version 14.0.0 (clang-1400.0.29.202) Target: arm64-apple-darwin22.1.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin what to do now ? Thank You
@nanthakumaran-s Uninstall and reinstall ibm_db after deleting site_packages\clidriver
directory. Let us know if issue get resolved. Thanks.
Hi thanks for all the anwsers this is how it looks: so Apple M1 Ventura , anaconda envi Jupiter Labs used to execute I have reinstall it ibm_db the same I have used this code !pip install --force-reinstall ibm_db ibm_db_sa - this is from coursera support output exactly the same. macbook pro (intel) BigS the same enviro output same windows 10 on macbook pro anaconda JLabs used and Jnotebooks ibm imports well, but I use %load_ext I het this is not ipthon module or something like this.( i Can get specific if you need )
So final point i must be doing something wrong or use the code wrong as nothing happens and I get the same result.
also I have brew o I can see it but this is where my knowledge ends whenit comes to it. Thank You
@a473000 Have fresh installation of ibm_db. Then type python
and enter to get python prompt. Then type import ibm_db
and 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.
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...
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.
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
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
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
gcc@8
using the command brew install gcc@8
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 copylibstdc++.6.0.9.dylib
from there to the location where it is requiring it.
After using python x86 on my m1 mac, ibm_db is not working and leaving this error when using it with flask.
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