node-sqlite icon indicating copy to clipboard operation
node-sqlite copied to clipboard

Does Not Build on OS X

Open bigeasy opened this issue 15 years ago • 7 comments

It does not build on OS X. I installed the latest Node.js using Homebrew. Checked node-sqlite out of GitHub and ran the following.

[alan@postojna node-sqlite]$ node-waf configure build
Checking for program g++ or c++          : /usr/bin/g++
Checking for program cpp                 : /usr/bin/cpp
Checking for program ar                  : /usr/bin/ar
Checking for program ranlib              : /usr/bin/ranlib
Checking for g++                         : ok
Checking for node path                   : not found
Checking for node prefix                 : ok /opt/Cellar/node/0.1.103
Checking for sqlite3                     : not found
Checking for library sqlite3             : yes
'configure' finished successfully (0.419s)
Waf: Entering directory `/Users/alan/git/synapse/node-sqlite/build'
[1/4] cxx: src/sqlite3_bindings.cc -> build/default/src/sqlite3_bindings_1.o
[2/4] cxx: src/database.cc -> build/default/src/database_1.o
../src/database.h:95: error: ‘sqlite3_int64’ does not name a type
../src/database.h:95: error: ‘sqlite3_int64’ does not name a type
../src/database.cc: In static member function ‘static int Database::EIO_Open(eio_req*)’:
../src/database.cc:99: error: ‘SQLITE_OPEN_READWRITE’ was not declared in this scope
../src/database.cc:100: error: ‘SQLITE_OPEN_CREATE’ was not declared in this scope
../src/database.cc:101: error: ‘SQLITE_OPEN_FULLMUTEX’ was not declared in this scope
../src/database.cc:102: error: ‘sqlite3_open_v2’ was not declared in this scope
../src/database.cc: In static member function ‘static int Database::EIO_AfterPrepareAndStep(eio_req*)’:
../src/database.cc:274: error: ‘struct prepare_request’ has no member named ‘lastInsertId’
../src/database.cc: In static member function ‘static int Database::EIO_PrepareAndStep(eio_req*)’:
../src/database.cc:348: error: ‘struct prepare_request’ has no member named ‘lastInsertId’
../src/database.cc:353: error: ‘struct prepare_request’ has no member named ‘lastInsertId’
../src/database.cc: In static member function ‘static int Database::EIO_Prepare(eio_req*)’:
../src/database.cc:447: error: ‘struct prepare_request’ has no member named ‘lastInsertId’
../src/database.cc:452: error: ‘struct prepare_request’ has no member named ‘lastInsertId’
Waf: Leaving directory `/Users/alan/git/synapse/node-sqlite/build'
Build failed:
 -> task failed (err #1):
    {task: cxx sqlite3_bindings.cc -> sqlite3_bindings_1.o}
 -> task failed (err #1):
    {task: cxx database.cc -> database_1.o}

bigeasy avatar Aug 12 '10 22:08 bigeasy

I'm seeing the same issue on OS X version 10.5.8

lexander avatar Aug 19 '10 21:08 lexander

Found a fix, in database.h change the line that reads #include <sqlite3.h> to #include "sqlite3.h"

This will change the include from using the standard include path to using the file "sqlite3.h" in the current working directory.

Then download the sqlite3 source files from http://www.sqlite.org/download.html and copy the sqlite3.h file into your /node-sqlite/src/ directory and re-run the configure/build command.

lexander avatar Aug 19 '10 21:08 lexander

There should be a 'pound' symbol at the start of those include lines - GitHub Markdown turned my pounds into hr's

lexander avatar Aug 19 '10 21:08 lexander

Even better, download the source files for sqlite, build and install from source. This will place sqlite in your /bin directory and make the headers available for the node-sqlite build.

lexander avatar Aug 19 '10 21:08 lexander

Can't install this extension on Ubuntu Hardy, with same errors.

arikon avatar Oct 11 '10 12:10 arikon

Yeah, trying to figure out where SQLite lives on different platforms is an annoying pain in the ass. Soon I will just ship the amalgamated SQLite source with node-sqlite and build it as a dependency.

orlandov avatar Oct 28 '10 18:10 orlandov

On ubuntu, may be you can try to install the package libsqlite3-dev to ensure you have sqlite3.h available.

duarnad avatar Nov 28 '10 11:11 duarnad