developmentseed/node-sqlite3 — Issue #55: Please Help: Trying to Build RELEASE for Windows with VS Express C++ 2010
Author: cmundi
Created: 2012-01-07 03:19:25+00:00
State: open

I am very close to having a build, but I need a little help!

I hope this also helps someone else. I am using Windows XP Pro (yeah, yeah) with Visual Studio Express 2010 C++.

First, it would be good to tell three things:

1. You need python installed and on your %PATH%. I'm using Python 2.7.
2. You need to build node in a path with no spaces! Otherwsie, the vcbuild.bat will fail! I use C:\NODEV\
3. Visual Studio 2008 and later project property pages are accessed by right-clicking on a project entry in the Solution Explorer pane.

So now I follow all the instructions at https://github.com/developmentseed/node-sqlite3/wiki/Building-On-Windows ** up to **

"Go to the "Property Manager" ... "

at which point I realize that VS Express 2008/2010 (and VS also I think) have slightly different interfacess from what I am used to. But I am an experienced visual studio user, so I press on.

I am in VS. The solution opens up in Release mode for me. This will be significant below.

** I need to know exactly what I'm supposed to be adding to the compiler and linker paths, but the instructions "change all three paths in "Additional Include Directories" to match those on your system" are pretty vague. Ok, fine, I think, I will just try to build and let VS tell me what it cannot find. But when I do this, I get exactly one error which will be familiar to VS developers:

deps\sqlite3\sqlite3.c(131070): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?

Thinking the sln file was maybe not created by a WIndows developer, I tell the compiler not to use precompiled headers and I try to build again. Now I get the kind of error I was looking for:

src\database.cc(2): fatal error C1083: Cannot open include file: 'node.h': No such file or directory.

So I add (in my case) C:\NODEV\node-v0.6.6\src to the compiler include path. Try to build again. Get this:

fatal error C1083: Cannot open include file: 'uv.h': No such file or directory

So I add C:\NODEV\node-v0.6.6\deps\uv\include to the compiler include path. Try to build again. Get this:

fatal error C1083: Cannot open include file: 'v8.h': No such file or directory

So I add C:\NODEV\node-v0.6.6\deps\v8\include to the compiler include path. Try to build again. Get this:

fatal error C1083: Cannot open include file: 'sqlite3.h': No such file or directory

So I add C:\Documents and Settings\root\Desktop\developmentseed-node-sqlite3-v2.1.1-15-ge6b1f79\developmentseed-node-sqlite3-e6b1f79\deps\sqlite3

to the compiler path. (This is where I unpacked node-sqlite sources for windows.)

Try to build again. Finally no more compiler errors and now get link errors. Good!

Read through the link errors. Guess. Add C:\NODEV\node-v0.6.6\Debug\lib to the linker path and add the following libs to the linker dependencies:

v8_base.lib
v8_nosnapshot.lib
v8_snapshot.lib
uv.lib
openssl.lib
http_parser.lib
zlib.lib

Try to build again.

I get numerous errors like this:

v8_base.lib(api.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in database.obj

This suggests ( ** please tell me **) that this has something to do with the fact that the vcbuild.bat file (for node) build node in Debug but the node-sqlite project is built in Release.

SO I switch the VS build configuration mode to Debug and try to build again. Ah! Most of the errors are gone, and now I have to set all the optrions for Debug mode. (ya gotta love VS!)

The first thing I notice (in Debug settings now) is that someone upstream has tried to fix the deps already with this:

$(ProjectDir)deps\sqlite3 except that they misspelled "Project".

That line does not work in any version of VS I have ever used anyway, because VS is not smart enough to descend paths. So I just go ahead and add the same paths as above.

So here I go adding the include and lib paths to the Debug config pretty much the same way I did above...

I see that "kkaefer" appears in teh lib path for the Debug configuration, so I think I am on the right path (bad pun!) now and change that to match the lib path from my Node build instead, which is C:\NODEV\node-v0.6.6\Debug\lib

Try to build... SUCCESS!!! YEAH!!! But what does this mean...

I now have node_sqlite3.node and sqlite3.lib and I have no idea what to do with them. ** Please Help The Newbie! **

Also, it is now apparent that in order to get node-sqlite built in release, I will first need to build node in Release. I guess I will be looking at the vcbuild.bat file (for node) next.

I apologize for the long post. I see there is much interest in node-sqlite for Winnows. Hopefully it helps someone else.

I would appreciate some advice on how to install the module now that I have built it!

Thanks