Open vrnhgd opened 1 year ago
hello
these should be contained in ms dev include header file
make: Leaving directory '/home/me/dev/js/sql/v8/node_modules/msnodesqlv8/build'
gyp info ok
me@DESKTOP-LCTQPPK:~/dev/js/sql/v8/node_modules/msnodesqlv8$ grep SQLDATETIMEOFFSETN /opt/microsoft/msodbcsql18/include/*.h
#define SQLDATETIMEOFFSETN 0x2b
me@DESKTOP-LCTQPPK:~/dev/js/sql/v8/node_modules/msnodesqlv8$
me@DESKTOP-LCTQPPK:~/dev/js/sql/v8/node_modules/msnodesqlv8$ ls -alrt /opt/microsoft/msodbcsql18/include/*.h
-rw-r--r-- 1 root root 44040 Jan 3 2023 /opt/microsoft/msodbcsql18/include/msodbcsql.h
which on Ubuntu is alongside the library
me@DESKTOP-LCTQPPK:~/dev/js/sql/v8/node_modules/msnodesqlv8$ ls -l /opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.2.so.1.1
-rwxr-xr-x 1 root root 2084624 Jan 3 2023 /opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.2.so.1.1
you may get an idea by looking at one of supplied Docker image files - you likely will also need the odbc dev package
sudo apt-get install -y unixodbc-dev
the locations of where to look are in binding.gyp
it is likely you need to add the location of header files in this file as this is not a supported distribution
see Red Hat section here
have all equialent steps been taken as below on your install
sudo su
#Download appropriate package for the OS version
#Choose only ONE of the following, corresponding to your OS version
#RHEL 7 and Oracle Linux 7
curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/mssql-release.repo
#RHEL 8 and Oracle Linux 8
curl https://packages.microsoft.com/config/rhel/8/prod.repo > /etc/yum.repos.d/mssql-release.repo
#RHEL 9
curl https://packages.microsoft.com/config/rhel/9.0/prod.repo > /etc/yum.repos.d/mssql-release.repo
exit
sudo yum remove unixODBC-utf16 unixODBC-utf16-devel #to avoid conflicts
sudo ACCEPT_EULA=Y yum install -y msodbcsql18
# optional: for bcp and sqlcmd
sudo ACCEPT_EULA=Y yum install -y mssql-tools18
echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
source ~/.bashrc
# optional: for unixODBC development headers
sudo yum install -y unixODBC-devel
Previous versions
near top of build node-gyp should print the found header filed such as below
ACTION binding_gyp_sqlserverv8_target_print_variables src/BeginTranOperation.cpp
cflags_cpp -std=c++17 | arch: x86_64 | link_path: -L/usr/local/lib -L/usr/local/ssl/lib64/ -L/home/linuxbrew/.linuxbrew/lib/ -L/usr/lib -L. | msodbc_include_folders /opt/microsoft/msodbcsql18/include/ /home/linuxbrew/.linuxbrew/include/ /opt/microsoft/msodbcsql17/include/ /home/linuxbrew/.linuxbrew/include/
these are the found locations you will need the required path to include above to show up here for build to work
note I personally have not ever built the driver on this platform - you may be unlucky even after this and the code fails due to compiler compatibility.
ah. I'm using libmsodbcsql-17.5.so.2.1
and none of those are defined in the header msodbcsql
.
do you think it's in unixodbc-dev as well?
I did build a docker image for cento7 which may help as a reference - this does work with driver. I ran into problems with the cpp runtime and eventually pulled gcc 11.2 from src, built that and then built latest node 16 with that compiler before building openssl from src so everything was consistent (else we crash with classic double free SEGV)
this image would likely take hrs to build depending on machine CPU speed but it does produce as we see below a working environment.
apprunner@00ee9bd9dcb4 msnodesqlv8]$ cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)
[apprunner@00ee9bd9dcb4 msnodesqlv8]$ gcc --version
gcc (GCC) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[apprunner@00ee9bd9dcb4 msnodesqlv8]$ node --version
v16.20.1
[apprunner@00ee9bd9dcb4 msnodesqlv8]$ node samples/javascript/streaming.js
run with Driver={ODBC Driver 18 for SQL Server}; Server=DESKTOP-VIUCH90;UID=linux; PWD=linux; Database=node;Encrypt=no;
submitted select top 5 * from master..syscolumns elapsed 4 ms
meta = [
{
"size": 128,
"name": "name",
"nullable": true,
"type": "text",
"sqlType": "nvarchar"
},
{
"size": 10,
"name": "id",
"nullable": false,
"type": "number",
"sqlType": "int"
},
Thanks for putting this in the open source space!
I'm trying to use this package w/ Node 16 on CentOS7 but having issues building. It looks like node-gyp can't find types defined like
SQLDATEN
orSQLDATETIMEOFFSETN
.I think this is a simple linker or install issue but I can't find references to these types anywhere.
Can you please help me figure out what I'm missing with the build setup?
Building using GCC and G++ x86_64-conda-linux-gnu-cc (conda-forge gcc 11.2.0-16) 11.2.0
Relevant error snippets from the build: