Closed louisgrg closed 1 year ago
@louisgrg Please share output of below commands from your terminal:
uname -m
gcc -v
which gcc
file `which node`
which brew
ls /usr/local/lib/gcc
ls /Users/lois/Documents/GitHub/db2-api/node_modules/ibm_db/installer/clidriver/lib
echo $PATH
I think you need to add the location of lib/gcc of brew in DYLD_LIBRARY_PATH that has libstdc++.6.0.dylib library like /opt/homebrew/lib/gcc
in my system instead of /usr/local/lib/gcc. i.e. find the location of x86_64 version of gcc lib installed in the system and add that to DYLD_LIBRARY_PATH env var.
Thanks.
$ uname -m
x86_64
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc@8/8.5.0/libexec/gcc/x86_64-apple-darwin21/8.5.0/lto-wrapper
Target: x86_64-apple-darwin21
Configured with: ../configure --prefix=/usr/local/Cellar/gcc@8/8.5.0 --libdir=/usr/local/Cellar/gcc@8/8.5.0/lib/gcc/8 --disable-nls --enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-8 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-pkgversion='Homebrew GCC 8.5.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --build=x86_64-apple-darwin21 --with-system-zlib --disable-multilib --with-native-system-header-dir=/usr/include --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk --without-build-config
Thread model: posix
gcc version 8.5.0 (Homebrew GCC 8.5.0)
$ which gcc
/usr/local/bin/gcc
$ which g++
/usr/local/bin/g++
$ file `which node`
/Users/lois/.nvm/versions/node/v18.16.0/bin/node: Mach-O 64-bit executable x86_64
$ which brew
/usr/local/bin/brew
$ ls -la /usr/local/lib/gcc
lrwxr-xr-x 1 lois admin 29 May 22 11:47 /usr/local/lib/gcc -> ../Cellar/gcc@8/8.5.0/lib/gcc
$ ls -la /Users/lois/Documents/GitHub/db2-api/node_modules/ibm_db/installer/clidriver/lib
total 69352
drwxr-xr-x 8 lois staff 256 Feb 22 11:46 .
drwxr-xr-x 13 lois staff 416 May 29 12:29 ..
drwxr-xr-x 17 lois staff 544 May 29 12:29 icc
-r-xr-xr-x 1 lois staff 3372520 Feb 22 11:46 libDB2xml4c.58.0.dylib
lrwxr-xr-x 1 lois staff 22 May 29 12:29 libDB2xml4c.58.dylib -> libDB2xml4c.58.0.dylib
lrwxr-xr-x 1 lois staff 22 May 29 12:29 libDB2xml4c.dylib -> libDB2xml4c.58.0.dylib
-r-xr-xr-x 1 lois staff 32063640 Feb 22 11:46 libdb2.dylib
-r-xr-xr-x 1 lois staff 63536 Feb 22 11:46 libdb2clixml4c.dylib
$ echo $PATH
/usr/local/Cellar/gcc@8/8.5.0/lib/gcc/8:/Users/lois/.pyenv/shims:/Users/lois/.nvm/versions/node/v18.16.0/bin:/usr/local/bin:/usr/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/mqm/bin:/opt/mqm/samp/bin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/homebrew/opt/openjdk/bin:/usr/local/bin:/usr/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/mqm/bin:/opt/mqm/samp/bin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/apache-maven/bin:/opt/SAClientUtil/bin:/opt/rclone
$ echo $INCLUDE
/usr/local/Cellar/gcc@8/8.5.0/lib/gcc/8:/Users/lois/Documents/GitHub/db2-api/node_modules/ibm_db/installer/clidriver/lib:
$ echo $DYLD_LIBRARY_PATH
/usr/local/Cellar/gcc@8/8.5.0/lib/gcc/8:/Users/lois/Documents/GitHub/db2-api/node_modules/ibm_db/installer/clidriver/lib:/opt/mqm/lib64
$ otool -L libdb2.dylib
libdb2.dylib:
libdb2.dylib (compatibility version 0.0.0, current version 0.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1677.104.0)
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
/usr/lib/libresolv.9.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/local/lib/gcc/8/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.25.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1)
/usr/local/lib/gcc/8/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
@louisgrg Please share output of below commands from your terminal:
uname -m gcc -v which gcc file `which node` which brew ls /usr/local/lib/gcc ls /Users/lois/Documents/GitHub/db2-api/node_modules/ibm_db/installer/clidriver/lib echo $PATH
I think you need to add the location of lib/gcc of brew in DYLD_LIBRARY_PATH that has libstdc++.6.0.dylib library like
/opt/homebrew/lib/gcc
in my system instead of /usr/local/lib/gcc. i.e. find the location of x86_64 version of gcc lib installed in the system and add that to DYLD_LIBRARY_PATH env var. Thanks.
Hi @bimalkjha , good day! Thank you for your prompt help!
I have added the commands results here. I have also paid attention to your suggestion regarding the PATH (I think you need to add the location of lib/gcc of brew in DYLD_LIBRARY_PATH that has libstdc++.6.0.dylib library like /opt/homebrew/lib/gcc in my system instead of /usr/local/lib/gcc)
I am testing the npm run dev again
I have tested it again but unfortunately I got the same results.
> nodemon index.js
[nodemon] 2.0.22
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node index.js`
node(45215,0x20a5a1280) malloc: *** error for object 0x7ff9456e62c0: pointer being freed was not allocated
node(45215,0x20a5a1280) malloc: *** set a breakpoint in malloc_error_break to debug
[nodemon] app crashed - waiting for file changes before starting...
Here is the point in the code where the issue happens:
const ret = pool.init(poolSize.initial, connectionString);
@louisgrg You shared ls -la /usr/local/lib/gcc
but we need ls /usr/local/lib/gcc
. Anyway, please share output of ls -l /usr/local/Cellar/gcc@8/8.5.0/lib/gcc/8
command.
Run export DYLD_LIBRARY_PATH=/usr/local/Cellar/gcc@8/8.5.0/lib/gcc/8:/Users/lois/Documents/GitHub/db2-api/node_modules/ibm_db/installer/clidriver/lib
and then verify.
If still you see issue, then uninstall gcc@8 and install gcc@12, update env vars accordingly and then try. Thanks.
Hi @bimalkjha. here is the first command:
$ ls /usr/local/lib/gcc
/usr/local/lib/gcc
Here is the second command:
$ ls -l /usr/local/Cellar/gcc@8/8.5.0/lib/gcc/8
total 110208
drwxr-xr-x 3 lois admin 96 May 14 2021 gcc
-r--r--r-- 1 lois admin 74920 May 22 11:47 libatomic.1.dylib
-r--r--r-- 1 lois admin 230888 May 14 2021 libatomic.a
lrwxr-xr-x 1 lois admin 17 May 14 2021 libatomic.dylib -> libatomic.1.dylib
-rw-r--r-- 1 lois admin 1998944 May 14 2021 libcc1.0.so
lrwxr-xr-x 1 lois admin 11 May 14 2021 libcc1.so -> libcc1.0.so
-r--r--r-- 1 lois admin 21176 May 14 2021 libgcc_ext.10.4.dylib
-r--r--r-- 1 lois admin 21048 May 14 2021 libgcc_ext.10.5.dylib
-r--r--r-- 1 lois admin 168240 May 22 11:47 libgcc_s.1.dylib
lrwxr-xr-x 1 lois admin 16 May 14 2021 libgcc_s_ppc64.1.dylib -> libgcc_s.1.dylib
lrwxr-xr-x 1 lois admin 16 May 14 2021 libgcc_s_x86_64.1.dylib -> libgcc_s.1.dylib
-r--r--r-- 1 lois admin 3038128 May 22 11:47 libgfortran.5.dylib
-r--r--r-- 1 lois admin 13534424 May 14 2021 libgfortran.a
lrwxr-xr-x 1 lois admin 19 May 14 2021 libgfortran.dylib -> libgfortran.5.dylib
-r--r--r-- 1 lois admin 198 May 14 2021 libgfortran.spec
-r--r--r-- 1 lois admin 282528 May 22 11:47 libgomp.1.dylib
-r--r--r-- 1 lois admin 1524936 May 14 2021 libgomp.a
lrwxr-xr-x 1 lois admin 15 May 14 2021 libgomp.dylib -> libgomp.1.dylib
-r--r--r-- 1 lois admin 169 May 14 2021 libgomp.spec
-r--r--r-- 1 lois admin 286256 May 22 11:47 libitm.1.dylib
-r--r--r-- 1 lois admin 1831864 May 14 2021 libitm.a
lrwxr-xr-x 1 lois admin 14 May 14 2021 libitm.dylib -> libitm.1.dylib
-r--r--r-- 1 lois admin 162 May 14 2021 libitm.spec
-r--r--r-- 1 lois admin 199720 May 22 11:47 libobjc-gnu.4.dylib
-r--r--r-- 1 lois admin 689984 May 14 2021 libobjc-gnu.a
lrwxr-xr-x 1 lois admin 19 May 14 2021 libobjc-gnu.dylib -> libobjc-gnu.4.dylib
-rw-r--r-- 1 lois admin 307400 May 22 11:47 libquadmath.0.dylib
-r--r--r-- 1 lois admin 1083776 May 14 2021 libquadmath.a
lrwxr-xr-x 1 lois admin 19 May 14 2021 libquadmath.dylib -> libquadmath.0.dylib
-rw-r--r-- 1 lois admin 55296 May 22 11:47 libssp.0.dylib
-r--r--r-- 1 lois admin 64152 May 14 2021 libssp.a
lrwxr-xr-x 1 lois admin 14 May 14 2021 libssp.dylib -> libssp.0.dylib
-r--r--r-- 1 lois admin 2104 May 14 2021 libssp_nonshared.a
-rw-r--r-- 1 lois admin 2785544 May 22 11:47 libstdc++.6.dylib
-r--r--r-- 1 lois admin 15134848 May 14 2021 libstdc++.a
-r--r--r-- 1 lois admin 2432 May 22 11:47 libstdc++.a-gdb.py
lrwxr-xr-x 1 lois admin 17 May 14 2021 libstdc++.dylib -> libstdc++.6.dylib
-r--r--r-- 1 lois admin 12028448 May 14 2021 libstdc++fs.a
-r--r--r-- 1 lois admin 990048 May 14 2021 libsupc++.a
I have also set the environment variable as requested
$ echo $DYLD_LIBRARY_PATH
/usr/local/Cellar/gcc@8/8.5.0/lib/gcc/8:/Users/lois/Documents/GitHub/sdu-org/sdu-db2-api-connect/node_modules/ibm_db/installer/clidriver/lib
Unfortunately I got the same error using gcc8, even changing the gcc8 path to the one you asked me (/usr/local/lib/gcc/8) or using the previous one (/usr/local/Cellar/gcc@8/8.5.0/lib/gcc/8)
$ npm run dev
> nodemon index.js
[nodemon] 2.0.22
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node index.js`
node(89066,0x208612280) malloc: *** error for object 0x7ff9456e62c0: pointer being freed was not allocated
node(89066,0x208612280) malloc: *** set a breakpoint in malloc_error_break to debug
[nodemon] app crashed - waiting for file changes before starting...
I am going to update to gcc12 and update the status here
Thank you @bimalkjha , I could solve my issue installing gcc@12 through brew x86_64 and then set it as the default one for zsh by creating links to gcc
ln -s gcc-12 gcc
ln -s g++-12 g++
I have set the environment variables like this:
export DYLD_LIBRARY_PATH=/usr/local/Cellar/gcc@12/12.3.0/lib/gcc/12:/Users/lois/Documents/GitHub/db2-api/node_modules/ibm_db/installer/clidriver/lib:$DYLD_LIBRARY_PATH
export PATH=/usr/local/Cellar/gcc@12/12.3.0/lib/gcc/12:$PATH
export INCLUDE=/usr/local/Cellar/gcc@12/12.3.0/lib/gcc/12:/Users/lois/Documents/GitHub/db2-api/node_modules/ibm_db/installer/clidriver/include:$INCLUDE
I have installed node 18.
Finally, I have run npm i and then npm run dev at the project directory.
The Project has started without issues.
I am closing this issue.
Hi, I have followed all the steps to configura ibm_db in order to install it (I could install it without issues by following the instructions provided here in this project) . But, once I try to start my project with npm run dev / npm start I get the following error (tested with node 16.18.0 and node 18.16.0 x86_64 versions)
I am using gcc8 x86_64 installed through a Rosetta terminal (x86_64), also node.js x86_64 (16 or 18 both got this error) and python x86_64 (3.11.3). I have also set DYLD_LIBRARY_PATH env var as
/usr/local/lib/gcc/8:/Users/lois/Documents/GitHub/db2-api/node_modules/ibm_db/installer/clidriver/lib
And tried the following options described here on a closed issue regarding malloc too https://github.com/ibmdb/node-ibm_db/issues/911#issuecomment-1503548009My macOS version is Ventura 13.4 (latest version). IBM DB version is ibm_db@3.2.1
I have tested the code and the malloc issue starts with any of the following methods:
I do appreciate any help! Thanks!