Skip to content
This repository has been archived by the owner on Jun 18, 2020. It is now read-only.

node v0.10.0 - Module version mismatch #119

Closed
frankrowe opened this issue Mar 14, 2013 · 23 comments
Closed

node v0.10.0 - Module version mismatch #119

frankrowe opened this issue Mar 14, 2013 · 23 comments

Comments

@frankrowe
Copy link

Did node v0.10 break some C++ APIs? The driver worked perfectly for me on node v.0.8x

C:\node_modules\msnodesql\lib\sqlserver.native.js:29
throw e;
^
Error: Module version mismatch. Expected 11, got 1.
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (C:\node_modules\msnodesql\lib\sqlserver.native.js:21:22)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)

Relevant code from node is
https://github.com/joyent/node/blob/master/src/node.h#L204

/**
 * When this version number is changed, node.js will refuse
 * to load older modules.  This should be done whenever
 * an API is broken in the C++ side, including in v8 or
 * other dependencies.
 */
#define NODE_MODULE_VERSION 0x000B /* v0.11 */
@jkint
Copy link
Contributor

jkint commented Mar 14, 2013

I saw that node.js 0.10.0 was released but I have not yet had a chance to try it out. Apparently it doesn't work. I will try it out as soon as possible and make appropriate fixes.

@CnApTaK
Copy link

CnApTaK commented Mar 26, 2013

Now NodeJS current version is v0.10.1. when we might see the driver version that is compatible with it?

@KarlProkupek
Copy link

I am also using node.js 0.10.x and ran into the same issue (module version mismatch). After download of source code, installing python and node-gyp I had an error during compiling because signature of uv_queue_work() changed.
In node.js change documentation (https://github.com/joyent/node/wiki/Api-changes-between-v0.8-and-v0.10) I found the following solution which works for me:
Alter line 38 in src/Operation.h from:
int result = uv_queue_work(uv_default_loop(), &operation->work, OnBackground, OnForeground);
to:
int result = uv_queue_work(uv_default_loop(), &operation->work, OnBackground, (uv_after_work_cb)OnForeground);

@jkint
Copy link
Contributor

jkint commented Apr 16, 2013

@CnApTaK has already submitted a pull request. I am waiting for approval to pull the request and merge it in.

Thanks.

@pthire
Copy link

pthire commented Apr 21, 2013

Another change in 0.10.x :

In include file uv.h :
-typedef void (uv_after_work_cb)(uv_work_t req);
change to :
+typedef void (uv_after_work_cb)(uv_work_t req, int status);

This make incompatible C++ add-on module between 0.8.x and 0.10.x

@JoshuaRamirez
Copy link

Sounds like the issue is with node 0.10.*
I had the same issue and will be watching this issue. Thanks :)

@FrizzaUK
Copy link

Anyone actually got this working yet with 0.10.x?

@geoprobe
Copy link

For what it's worth we went with edge.js and have not looked back.

@FrizzaUK
Copy link

Interesting, briefly looked at it but would have to roll our own a pi. Will look more into it, if you have any advice or pointers that would be great.

@FrizzaUK
Copy link

Meant Api not pi!

@FrizzaUK
Copy link

Had a look this morning and it seems promising - when I originally saw Edge.js it didn't have a SQL module, but now it does :)

@BrandonCopley
Copy link

So, what needs to be done to get this working on 0.10.*

@jnicholls
Copy link

Is this still a problem? Can the PR simply be ignored and the project owner go ahead and commit it themselves? That would be the best solution :-P

@mlanser
Copy link

mlanser commented Jul 26, 2013

I have now tried to compile this module on a variety of platforms, but simply cannot get it to build. Granted I'm new to Node (running v0.10.15). However, other modules compile and install just fine. So I guess my question is, has anyone else succeeded compiling this module? If so, would you mind sharing info re: platform, Node version, etc.?

@jkint
Copy link
Contributor

jkint commented Jul 26, 2013

@mlanser What problems are you having compiling? Can you list the error messages?

@jkint
Copy link
Contributor

jkint commented Jul 29, 2013

I recently accepted a pull request that allows the extension to build on node 0.10.x. Can you supply the error messages so that I can better assist?

@mlanser
Copy link

mlanser commented Jul 30, 2013

@jkint Apologies for the delayed reply .. I'm currently traveling. Anyway, I tried to compile again and got the same errors again:

Connection.obj : error LNK2001: unresolved external symbol _SQLFreeHandle@8 [C:
\web\testproject\node_modules\node-sqlserver\build\sqlserver.vcxproj]
OdbcConnection.obj : error LNK2001: unresolved external symbol _SQLSetEnvAttr@1
6 [C:\web\testproject\node_modules\node-sqlserver\build\sqlserver.vcxproj]
OdbcConnection.obj : error LNK2001: unresolved external symbol _SQLMoreResults@
4 [C:\web\testproject\node_modules\node-sqlserver\build\sqlserver.vcxproj]
OdbcConnection.obj : error LNK2001: unresolved external symbol _SQLColAttribute
W@28 [C:\web\testproject\node_modules\node-sqlserver\build\sqlserver.vcxproj]
OdbcConnection.obj : error LNK2001: unresolved external symbol _SQLGetDiagRecW@
32 [C:\web\testproject\node_modules\node-sqlserver\build\sqlserver.vcxproj]
OdbcConnection.obj : error LNK2001: unresolved external symbol _SQLGetData@24 [
C:\web\testproject\node_modules\node-sqlserver\build\sqlserver.vcxproj]
OdbcConnection.obj : error LNK2001: unresolved external symbol _SQLAllocHandle@
12 [C:\web\testproject\node_modules\node-sqlserver\build\sqlserver.vcxproj]
OdbcConnection.obj : error LNK2001: unresolved external symbol _SQLExecDirectW@
12 [C:\web\testproject\node_modules\node-sqlserver\build\sqlserver.vcxproj]
OdbcConnection.obj : error LNK2001: unresolved external symbol _SQLBindParamete
r@40 [C:\web\testproject\node_modules\node-sqlserver\build\sqlserver.vcxproj]
OdbcConnection.obj : error LNK2001: unresolved external symbol _SQLSetConnectAt
trW@16 [C:\web\testproject\node_modules\node-sqlserver\build\sqlserver.vcxproj]
OdbcConnection.obj : error LNK2001: unresolved external symbol _SQLDescribeColW
@36 [C:\web\testproject\node_modules\node-sqlserver\build\sqlserver.vcxproj]
OdbcConnection.obj : error LNK2001: unresolved external symbol _SQLRowCount@8 [
C:\web\testproject\node_modules\node-sqlserver\build\sqlserver.vcxproj]
OdbcConnection.obj : error LNK2001: unresolved external symbol _SQLDriverConnec
tW@32 [C:\web\testproject\node_modules\node-sqlserver\build\sqlserver.vcxproj]
OdbcConnection.obj : error LNK2001: unresolved external symbol _SQLNumResultCol
s@8 [C:\web\testproject\node_modules\node-sqlserver\build\sqlserver.vcxproj]
OdbcConnection.obj : error LNK2001: unresolved external symbol _SQLFetch@4 [C:
web\testproject\node_modules\node-sqlserver\build\sqlserver.vcxproj]
OdbcConnection.obj : error LNK2001: unresolved external symbol _SQLDisconnect@4
[C:\web\testproject\node_modules\node-sqlserver\build\sqlserver.vcxproj]
OdbcConnection.obj : error LNK2001: unresolved external symbol _SQLEndTran@12 [
C:\web\testproject\node_modules\node-sqlserver\build\sqlserver.vcxproj]
C:\web\testproject\node_modules\node-sqlserver\build\Release\sqlserver.node : f
atal error LNK1120: 17 unresolved externals [C:\web\testproject\node_modules\no
de-sqlserver\build\sqlserver.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\Martin Lanser\AppData\Roamin
g\npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:
12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\Users\Martin Lanser\AppData\Roaming\npm\node_m
odules\node-gyp\bin\node-gyp.js" "build"
gyp ERR! cwd C:\web\testproject\node_modules\node-sqlserver
gyp ERR! node -v v0.10.15
gyp ERR! node-gyp -v v0.10.6
gyp ERR! not ok

Btw, I get this error on both WinXP Pro and Win7. I did some further experimenting and downgraded NodeJS to v0.8.25 and at that point I'm able to compile/build the node-sqlserver module just fine.

Tia,
-martin.

@jkint
Copy link
Contributor

jkint commented Jul 30, 2013

Interesting. There was another case similar to this reported here just a few days ago. I wonder if something changed in the node-gyp files for the 0.10.x releases.

The easiest fix is to add odbc32.lib to the binding.gyp:

{
  'targets': [
    {
      'target_name': 'sqlserver',

      'sources': [ 
        'src/Column.cpp',
        'src/Connection.cpp',
        'src/OdbcConnection.cpp',
        'src/OdbcError.cpp',
        'src/OdbcOperation.cpp',
        'src/ResultSet.cpp',
        'src/stdafx.cpp',
        'src/Utility.cpp',
      ],

      'include_dirs': [
        'src',
      ],

      'conditions': [
        [ 'OS=="win"', {
          'defines': [
            'UNICODE=1',
            '_UNICODE=1',
            '_SQLNCLI_ODBC_',
          ],
          'libraries': [
            'odbc32.lib'
          ],
          }
        ]
      ]
    }
  ]
}

@mlanser
Copy link

mlanser commented Jul 30, 2013

@jkint That did it! By adding the odbc32.lib to the binding.gyp I was able to compile/build this module on both WinXP and Win7 under NodeJS v0.10.15

Thanks for you help!

@jkint
Copy link
Contributor

jkint commented Jul 30, 2013

Great! I need to add it to the repository in the near future.

Closing this issue since we have merged in support for 0.10.x.

@jkint jkint closed this as completed Jul 30, 2013
@Arispe
Copy link

Arispe commented Mar 13, 2014

I get to tray build....

C:\Users\DESARROLLO\Documents\SET_UPs\msnodesql_tobuild\msnodesql>node-gyp build -debug
gyp info it worked if it ends with ok
gyp info using node-gyp@0.13.0
gyp info using node@0.10.26 | win32 | x64
gyp info spawn C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args '/clp:Verbosity=minimal',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Debug;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Connection.cpp
c:\users\desarrollo\documents\set_ups\msnodesql_tobuild\msnodesql\src\stdafx.h(42): warning C4005: 'interface' : macro redefinition [C:\Users\DESARROLLO\Documents\SET_UPs\msnodesq
l_tobuild\msnodesql\build\sqlserver.vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\objbase.h(199) : see previous definition of 'interface'
c:\users\desarrollo\documents\set_ups\msnodesql_tobuild\msnodesql\src\Operation.h(38): error C2019: expected preprocessor directive, found '#' [C:\Users\DESARROLLO\Documents\SET_U
Ps\msnodesql_tobuild\msnodesql\build\sqlserver.vcxproj]
c:\users\desarrollo\documents\set_ups\msnodesql_tobuild\msnodesql\src\Column.h(49): warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data [C:\Users
DESARROLLO\Documents\SET_UPs\msnodesql_tobuild\msnodesql\build\sqlserver.vcxproj]
c:\users\desarrollo\documents\set_ups\msnodesql_tobuild\msnodesql\src\Column.h(72): warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data [C:\Us
ers\DESARROLLO\Documents\SET_UPs\msnodesql_tobuild\msnodesql\build\sqlserver.vcxproj]
c:\users\desarrollo\documents\set_ups\msnodesql_tobuild\msnodesql\src\ResultSet.h(57): warning C4267: 'return' : conversion from 'size_t' to 'int', possible loss of data [C:\Users
\DESARROLLO\Documents\SET_UPs\msnodesql_tobuild\msnodesql\build\sqlserver.vcxproj]
c:\users\desarrollo\documents\set_ups\msnodesql_tobuild\msnodesql\src\OdbcConnectionBridge.h(119): warning C4244: 'argument' : conversion from 'SQLLEN' to 'int32_t', possible loss
of data [C:\Users\DESARROLLO\Documents\SET_UPs\msnodesql_tobuild\msnodesql\build\sqlserver.vcxproj]
OdbcConnection.cpp
c:\users\desarrollo\documents\set_ups\msnodesql_tobuild\msnodesql\src\stdafx.h(42): warning C4005: 'interface' : macro redefinition [C:\Users\DESARROLLO\Documents\SET_UPs\msnodesq
l_tobuild\msnodesql\build\sqlserver.vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\objbase.h(199) : see previous definition of 'interface'
c:\users\desarrollo\documents\set_ups\msnodesql_tobuild\msnodesql\src\Column.h(49): warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data [C:\Users
DESARROLLO\Documents\SET_UPs\msnodesql_tobuild\msnodesql\build\sqlserver.vcxproj]
c:\users\desarrollo\documents\set_ups\msnodesql_tobuild\msnodesql\src\Column.h(72): warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data [C:\Us
ers\DESARROLLO\Documents\SET_UPs\msnodesql_tobuild\msnodesql\build\sqlserver.vcxproj]
c:\users\desarrollo\documents\set_ups\msnodesql_tobuild\msnodesql\src\ResultSet.h(57): warning C4267: 'return' : conversion from 'size_t' to 'int', possible loss of data [C:\Users
\DESARROLLO\Documents\SET_UPs\msnodesql_tobuild\msnodesql\build\sqlserver.vcxproj]
c:\users\desarrollo\documents\set_ups\msnodesql_tobuild\msnodesql\src\Operation.h(38): error C2019: expected preprocessor directive, found '#' [C:\Users\DESARROLLO\Documents\SET_U
Ps\msnodesql_tobuild\msnodesql\build\sqlserver.vcxproj]
..\src\OdbcConnection.cpp(155): warning C4267: 'argument' : conversion from 'size_t' to 'SQLSMALLINT', possible loss of data [C:\Users\DESARROLLO\Documents\SET_UPs\msnodesql_tobui
ld\msnodesql\build\sqlserver.vcxproj]
..\src\OdbcConnection.cpp(183): warning C4267: 'argument' : conversion from 'size_t' to 'SQLINTEGER', possible loss of data [C:\Users\DESARROLLO\Documents\SET_UPs\msnodesql_tobuil
d\msnodesql\build\sqlserver.vcxproj]
..\src\OdbcConnection.cpp(314): warning C4244: 'initializing' : conversion from 'SQLLEN' to 'int', possible loss of data [C:\Users\DESARROLLO\Documents\SET_UPs\msnodesql_tobuild\m
snodesql\build\sqlserver.vcxproj]
..\src\OdbcConnection.cpp(316): warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data [C:\Users\DESARROLLO\Documents\SET_UPs\msnodesql_tobuild\msnodesql\bu
ild\sqlserver.vcxproj]
OdbcOperation.cpp
c:\users\desarrollo\documents\set_ups\msnodesql_tobuild\msnodesql\src\stdafx.h(42): warning C4005: 'interface' : macro redefinition [C:\Users\DESARROLLO\Documents\SET_UPs\msnodesq
l_tobuild\msnodesql\build\sqlserver.vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\objbase.h(199) : see previous definition of 'interface'
c:\users\desarrollo\documents\set_ups\msnodesql_tobuild\msnodesql\src\Operation.h(38): error C2019: expected preprocessor directive, found '#' [C:\Users\DESARROLLO\Documents\SET_U
Ps\msnodesql_tobuild\msnodesql\build\sqlserver.vcxproj]
c:\users\desarrollo\documents\set_ups\msnodesql_tobuild\msnodesql\src\Column.h(49): warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data [C:\Users
DESARROLLO\Documents\SET_UPs\msnodesql_tobuild\msnodesql\build\sqlserver.vcxproj]
c:\users\desarrollo\documents\set_ups\msnodesql_tobuild\msnodesql\src\Column.h(72): warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data [C:\Us
ers\DESARROLLO\Documents\SET_UPs\msnodesql_tobuild\msnodesql\build\sqlserver.vcxproj]
c:\users\desarrollo\documents\set_ups\msnodesql_tobuild\msnodesql\src\ResultSet.h(57): warning C4267: 'return' : conversion from 'size_t' to 'int', possible loss of data [C:\Users
\DESARROLLO\Documents\SET_UPs\msnodesql_tobuild\msnodesql\build\sqlserver.vcxproj]
Generating Code...
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\DESARROLLO\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\Users\DESARROLLO\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js" "build" "-debug"
gyp ERR! cwd C:\Users\DESARROLLO\Documents\SET_UPs\msnodesql_tobuild\msnodesql
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.13.0
gyp ERR! not ok

@Arispe
Copy link

Arispe commented Mar 13, 2014

And tried this solution...

http://blog.gluwer.com/2013/07/windows-azure-websites-and-nodejs-the-setup/

not get results

@DmitriyBerezin
Copy link

Good article - it is very helpfull. What is the reason that odbc32.lib hasn't declared in binding.gyp yet? It is a barrier to use normal installation via npm.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests