I'm working on macOS 11.3.1 ARM64 and I'm trying to install with npm the msnodesqlv8
in my node.js project. I've my homebrew installed in /opt/homebrew/bin/brew
, and I've installed with brew the ODBC driver for SQLServer with these commands:
brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
brew update
HOMEBREW_NO_ENV_FILTERING=1 ACCEPT_EULA=Y brew install msodbcsql17 mssql-tools
I've also unixodbc
installed.
It seems it's not pointing to the lib in my /opt/homebrew/lib
(Library not loaded: /usr/local/opt/msodbcsql17/lib/libmsodbcsql.17.dylib
)
There's also a problem related with the sqltypes.h
file. I did many researches but none solved my problem.
This is the output:
prebuild-install WARN install dlopen(/Users/fdg/project/node_modules/msnodesqlv8/build/Release/sqlserverv8.node, 1): Library not loaded: /usr/local/opt/msodbcsql17/lib/libmsodbcsql.17.dylib
prebuild-install WARN install Referenced from: /Users/fdg/project/node_modules/msnodesqlv8/build/Release/sqlserverv8.node
prebuild-install WARN install Reason: image not found
CXX(target) Release/obj.target/sqlserverv8/src/ConnectionHandles.o
In file included from ../src/ConnectionHandles.cpp:1:
In file included from ../src/ConnectionHandles.h:22:
../src/stdafx.h:37:14: fatal error: 'sqltypes.h' file not found
#include <sqltypes.h>
^~~~~~~~~~~~
1 error generated.
make: *** [Release/obj.target/sqlserverv8/src/ConnectionHandles.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Darwin 20.4.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/fdg/project/node_modules/msnodesqlv8
gyp ERR! node -v v14.16.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! msnodesqlv8@2.1.0 install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the msnodesqlv8@2.1.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
These lines are in my .bash_profile
:
export PATH=/opt/homebrew/bin:$PATH
export DYLD_LIBRARY_PATH=/opt/homebrew/lib:$DYLD_LIBRARY_PATH
EDIT: In addition I tried to create symlinks to the homebrew lib. When running the sqlcmd command it says:
dyld: Library not loaded: /usr/local/lib/libodbc.2.dylib
Referenced from: /opt/homebrew/bin/sqlcmd
Reason: no suitable image found. Did find:
/opt/homebrew/lib/libodbc.2.dylib: mach-o, **but wrong architecture**
/opt/homebrew/Cellar/unixodbc/2.3.9_1/lib/libodbc.2.dylib: mach-o, but wrong architecture
It seems it's not supported for M1 architecture yet (?). Is there any workaround?
If any extra informations needed to help me figuring out how to solve the problem, please tell me.
Thanks in advance