-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Npm install fails in Alpine Docker.... #41
Comments
I'm getting the same thing when using npm to install odbc: ../src/odbc.cpp:491:71: error: 'timelocal' was not declared in this scope Possibly configure related? |
I eventually got it to work by making one change to the odbc.cpp file. I'll try to make a pull request for it soon. Moved the line "#define timelocal mktime" outside of the if block in line 489. I'm sure this has implications in other environments but works in alpine with no issues. Just make sure to clone this repo and install from local repo in Node. Raphael |
Had this error today and Upgrading to v2.0.0-beta.0 fixed it. Woohoo! Edit: Also using Alpine. |
@Fenderis as you use 2.0.0 beta, feel free to post any issues you run into. Very interested in making it the next-gen for ODBC on Node.js! |
Tried using it as it seemed to have compiled properly as mentionned earlier. Unfortunately, It couldn't seem to be able to make it work. By doing : When doing: I ended up changing docker base image to debian instead of alpine, returned to version 1.4.6 of odbc and seems to work now. |
So the API for odbc 2.0 is a little different, and can be found here (if you are interested in using the new API): https://www.npmjs.com/package/odbc/v/2.0.0-beta.1
or to create a Pool
Both the examples above use the |
Following this since we're having the same issue with alpine docker. We will try switching to ubuntu image first, and if that fails try patching the |
FYI switching to standard node docker slim worked well for us. |
I am having an issue when trying to install the module in an Alpine Docker container.
Here is the error:
make: Entering directory '/app/node_modules/odbc/build'
CXX(target) Release/obj.target/odbc_bindings/src/odbc.o
../src/odbc.cpp: In static member function 'static void ODBC::UV_AfterCreateConnection(uv_work_t*, int)':
../src/odbc.cpp:201:27: warning: 'v8::Localv8::Value Nan::Callback::Call(int, v8::Localv8::Value) const' is deprecated [-Wdeprecated-declarations]
data->cb->Call(1, info);
^
In file included from ../src/odbc.h:23:0,
from ../src/odbc.cpp:25:
../../nan/nan.h:1647:3: note: declared here
Call(int argc, v8::Localv8::Value argv[]) const {
^~~~
../src/odbc.cpp:213:48: warning: 'v8::Localv8::Value Nan::Callback::Call(v8::Localv8::Object, int, v8::Localv8::Value) const' is deprecated [-Wdeprecated-declarations]
data->cb->Call(data->dbo->handle(), 2, info);
^
In file included from ../src/odbc.h:23:0,
from ../src/odbc.cpp:25:
../../nan/nan.h:1625:3: note: declared here
Call(v8::Localv8::Object target
^~~~
../src/odbc.cpp: In static member function 'static v8::Handlev8::Value ODBC::GetColumnValue(SQLHSTMT, Column, uint16_t*, int)':
../src/odbc.cpp:491:71: error: 'timelocal' was not declared in this scope
return scope.Escape(Nan::New((double(timelocal(&timeInfo)) * 1000)
^
../src/odbc.cpp: In static member function 'static v8::Localv8::Value ODBC::CallbackSQLError(SQLSMALLINT, SQLHANDLE, char*, Nan::Callback*)':
../src/odbc.cpp:785:19: warning: 'v8::Localv8::Value Nan::Callback::Call(int, v8::Localv8::Value*) const' is deprecated [-Wdeprecated-declarations]
cb->Call(1, info);
^
In file included from ../src/odbc.h:23:0,
from ../src/odbc.cpp:25:
../../nan/nan.h:1647:3: note: declared here
Call(int argc, v8::Localv8::Value argv[]) const {
^~~~
make: *** [odbc_bindings.target.mk:109: Release/obj.target/odbc_bindings/src/odbc.o] Error 1
gyp ERR! build error
make: Leaving directory '/app/node_modules/odbc/build'
gyp ERR! stack Error:
make
failed with exit code: 2gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 3.10.0-514.6.1.el7.x86_64
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /app/node_modules/odbc
gyp ERR! node -v v8.11.4
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install:
node-gyp configure build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-09-27T20_03_08_832Z-debug.log
ERROR: Service 'odbc_client' failed to build: The command '/bin/sh -c mkdir /app/log && apk update && apk add freetds unixodbc-dev && apk add python && apk add make g++ && npm install' returned a non-zero code: 1
Dockerfile contents:
FROM node:8.11.4-alpine
WORKDIR /app
COPY ./package.json ./
RUN
mkdir /app/log &&
apk update &&
apk add freetds unixodbc-dev &&
apk add python &&
apk add make g++ &&
npm install
ENV PATH ./node_modules/.bin:$PATH
CMD ["top"]
package.json contents:
{
"name": "adapter",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"start": "node src/app.js",
"test": "node src/test.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"cron": "^1.4.1",
"moment-timezone": "^0.5.21",
"mqtt": "^2.18.3",
"odbc": "^1.4.5",
"winston": "^3.0.0"
}
}
The text was updated successfully, but these errors were encountered: