cross-compile node-sqlite3 for qnx

clone the resource:

# git clone https://github.com/mapbox/node-sqlite3.git sqlite3

# cd sqlite3

set the qnx cross-compile environment:

# source ~/qnx70/qnxsdp-env.sh

export CC and CXX:


#export CC="qcc -V5.4.0,gcc_ntoaarch64le"

#export CXX="q++ -V5.4.0,gcc_ntoaarch64le"

then if you just use the command to build


#npm install --build-from-source

you will have following erros:


make: Entering directory '/home/jiafei427/tmp/shit_test/build'
 ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c
 TOUCH Release/obj.target/deps/action_before_build.stamp
 CC(target) Release/obj.target/sqlite3/gen/sqlite-autoconf-3150000/sqlite3.o
cc: Can't specify -P, -C, -E, -c or -S with -o and have multiple files

gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.4.0-72-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/jiafei427/tmp/shit_test/lib/binding/node-v48-linux-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/home/jiafei427/tmp/shit_test/lib/binding/node-v48-linux-x64"
gyp ERR! cwd /home/jiafei427/tmp/shit_test
gyp ERR! node -v v6.10.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/jiafei427/tmp/shit_test/lib/binding/node-v48-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/jiafei427/tmp/shit_test/lib/binding/node-v48-linux-x64' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/jiafei427/tmp/shit_test/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:191:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:877:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node-pre-gyp ERR! System Linux 4.4.0-72-generic
node-pre-gyp ERR! command "/usr/local/bin/node" "/home/jiafei427/tmp/shit_test/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/jiafei427/tmp/shit_test
node-pre-gyp ERR! node -v v6.10.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.36
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/jiafei427/tmp/shit_test/lib/binding/node-v48-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/jiafei427/tmp/shit_test/lib/binding/node-v48-linux-x64' (1)

npm ERR! Linux 4.4.0-72-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--build-from-source"
npm ERR! node v6.10.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! sqlite3@3.1.8 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sqlite3@3.1.8 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the sqlite3 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs sqlite3
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls sqlite3
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/jiafei427/tmp/shit_test/npm-debug.log

 

change the DEPFLAGS from make.py (for your case it might be different)

# vi /usr/local/lib/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py

OR

vi /usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py

change following:

DEPFLAGS = -MMD -MF $(depfile).raw

to

DEPFLAGS = -Wp,-MMD,$(depfile) -Wp,-MF,$(depfile).raw

 

 

Let’s start to build  with npm


# npm install --build-from-source

 

error comes out with:

make: Entering directory '/home/jiafei427/tmp/shit_test/build'
 ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c
 TOUCH Release/obj.target/deps/action_before_build.stamp
 CC(target) Release/obj.target/sqlite3/gen/sqlite-autoconf-3150000/sqlite3.o
cc1: error: unrecognized <strong>command line option '-m64'</strong>
cc: /home/jiafei427/qnx70/host/linux/x86_64/usr/lib/gcc/aarch64-unknown-nto-qnx7.0.0/5.4.0/cc1 error 1
deps/sqlite3.target.mk:124: recipe for target 'Release/obj.target/sqlite3/gen/sqlite-autoconf-3150000/sqlite3.o' failed
make: *** [Release/obj.target/sqlite3/gen/sqlite-autoconf-3150000/sqlite3.o] Error 1
make: Leaving directory '/home/jiafei427/tmp/shit_test/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.4.0-72-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/jiafei427/tmp/shit_test/lib/binding/node-v48-linux-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/home/jiafei427/tmp/shit_test/lib/binding/node-v48-linux-x64"
gyp ERR! cwd /home/jiafei427/tmp/shit_test
gyp ERR! node -v v6.10.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/jiafei427/tmp/shit_test/lib/binding/node-v48-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/jiafei427/tmp/shit_test/lib/binding/node-v48-linux-x64' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/jiafei427/tmp/shit_test/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:191:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:877:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node-pre-gyp ERR! System Linux 4.4.0-72-generic
node-pre-gyp ERR! command "/usr/local/bin/node" "/home/jiafei427/tmp/shit_test/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/jiafei427/tmp/shit_test
node-pre-gyp ERR! node -v v6.10.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.36
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/jiafei427/tmp/shit_test/lib/binding/node-v48-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/jiafei427/tmp/shit_test/lib/binding/node-v48-linux-x64' (1)

npm ERR! Linux 4.4.0-72-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--build-from-source"
npm ERR! node v6.10.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! sqlite3@3.1.8 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sqlite3@3.1.8 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the sqlite3 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs sqlite3
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls sqlite3
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/jiafei427/tmp/shit_test/npm-debug.log

 

which you should focus on ‘-m64’ error, you can refer the link.

and you will find out the ‘-m64’ gcc flag is for Intel 386 and AMD x86-64 Options, which is not for arm-64. So I changed command and ran with following:

# npm install --arch=arm64 --build-from-source

 

you will have following error:


> sqlite3@3.1.8 install /home/jiafei427/tmp/shit_test
> node-pre-gyp install --fallback-to-build

make: Entering directory '/home/jiafei427/tmp/shit_test/build'
 ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c
 TOUCH Release/obj.target/deps/action_before_build.stamp
 CC(target) Release/obj.target/sqlite3/gen/sqlite-autoconf-3150000/sqlite3.o
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c: In function 'pthreadMutexAlloc':
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:22971:9: warning: implicit declaration of function 'pthread_mutexattr_settype' [-Wimplicit-function-declaration]
 pthread_mutexattr_settype(&amp;recursiveAttr, <strong>PTHREAD_MUTEX_RECURSIVE</strong>);
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:22971:51: error: 'PTHREAD_MUTEX_RECURSIVE' undeclared (first use in this function)
 pthread_mutexattr_settype(&amp;recursiveAttr, PTHREAD_MUTEX_RECURSIVE);
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:22971:51: note: each undeclared identifier is reported only once for each function it appears in
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c: In function 'posixOpen':
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:29714:10: warning: implicit declaration of function 'open' [-Wimplicit-function-declaration]
 return open(zFile, flags, mode);
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c: At top level:
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:29735:42: error: 'close' undeclared here (not in a function)
 { "close", (sqlite3_syscall_ptr)close, 0 },
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:29738:42: error: 'access' undeclared here (not in a function)
 { "access", (sqlite3_syscall_ptr)access, 0 },
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:29741:42: error: 'getcwd' undeclared here (not in a function)
 { "getcwd", (sqlite3_syscall_ptr)getcwd, 0 },
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:29744:42: error: 'stat' undeclared here (not in a function)
 { "stat", (sqlite3_syscall_ptr)stat, 0 },
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:29757:42: error: 'fstat' undeclared here (not in a function)
 { "fstat", (sqlite3_syscall_ptr)fstat, 0 },
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:29761:42: error: 'ftruncate' undeclared here (not in a function)
 { "ftruncate", (sqlite3_syscall_ptr)ftruncate, 0 },
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:29764:42: error: 'fcntl' undeclared here (not in a function)
 { "fcntl", (sqlite3_syscall_ptr)fcntl, 0 },
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:29767:42: error: 'read' undeclared here (not in a function)
 { "read", (sqlite3_syscall_ptr)read, 0 },
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:29784:42: error: 'write' undeclared here (not in a function)
 { "write", (sqlite3_syscall_ptr)write, 0 },
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:29813:42: error: 'unlink' undeclared here (not in a function)
 { "unlink", (sqlite3_syscall_ptr)unlink, 0 },
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:29822:42: error: 'rmdir' undeclared here (not in a function)
 { "rmdir", (sqlite3_syscall_ptr)rmdir, 0 },
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:29826:42: error: 'fchown' undeclared here (not in a function)
 { "fchown", (sqlite3_syscall_ptr)fchown, 0 },
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:29832:42: error: 'geteuid' undeclared here (not in a function)
 { "geteuid", (sqlite3_syscall_ptr)geteuid, 0 },
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:29864:42: error: 'readlink' undeclared here (not in a function)
 { "readlink", (sqlite3_syscall_ptr)readlink, 0 },
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:29871:43: error: 'lstat' undeclared here (not in a function)
 { "lstat", (sqlite3_syscall_ptr)lstat, 0 },
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c: In function 'seekAndRead':
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:32506:17: warning: implicit declaration of function 'lseek' [-Wimplicit-function-declaration]
 newOffset = lseek(id-&gt;h, offset, SEEK_SET);
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c: In function 'full_fsync':
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:32748:20: warning: implicit declaration of function 'fsync' [-Wimplicit-function-declaration]
 # define fdatasync fsync
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:32846:8: note: in expansion of macro 'fdatasync'
 rc = fdatasync(fd);
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c: In function 'unixSectorSize':
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:33259:9: warning: implicit declaration of function 'fstatvfs' [-Wimplicit-function-declaration]
 if( fstatvfs(pFile-&gt;h, &amp;fsInfo) == -1 ) {
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:33295:67: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses]
 ((pFile-&gt;sectorSize / 512 * SQLITE_IOCAP_ATOMIC512) &lt;&lt; 1) - 2 |
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:33303:67: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses]
 ((pFile-&gt;sectorSize / 512 * SQLITE_IOCAP_ATOMIC512) &lt;&lt; 1) - 2 |
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c: In function 'unixGetpagesize':
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:33365:15: warning: implicit declaration of function 'sysconf' [-Wimplicit-function-declaration]
 return (int)sysconf(_SC_PAGESIZE);
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:33365:23: error: '_SC_PAGESIZE' undeclared (first use in this function)
 return (int)sysconf(_SC_PAGESIZE);
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c: In function 'unixOpen':
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:29348:28: warning: implicit declaration of function 'getpid' [-Wimplicit-function-declaration]
 #define osGetpid(X) (pid_t)getpid()
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:35104:22: note: in expansion of macro 'osGetpid'
 if( randomnessPid!=osGetpid(0) ){
 ^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c: In function 'unixSleep':
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:35604:3: warning: implicit declaration of function 'sleep' [-Wimplicit-function-declaration]
 sleep(seconds);
 ^
cc: /home/jiafei427/qnx70/host/linux/x86_64/usr/lib/gcc/aarch64-unknown-nto-qnx7.0.0/5.4.0/cc1 error 1
deps/sqlite3.target.mk:122: recipe for target 'Release/obj.target/sqlite3/gen/sqlite-autoconf-3150000/sqlite3.o' failed
make: *** [Release/obj.target/sqlite3/gen/sqlite-autoconf-3150000/sqlite3.o] Error 1
make: Leaving directory '/home/jiafei427/tmp/shit_test/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.4.0-72-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/jiafei427/tmp/shit_test/lib/binding/node-v48-linux-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/home/jiafei427/tmp/shit_test/lib/binding/node-v48-linux-x64"
gyp ERR! cwd /home/jiafei427/tmp/shit_test
gyp ERR! node -v v6.10.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/jiafei427/tmp/shit_test/lib/binding/node-v48-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/jiafei427/tmp/shit_test/lib/binding/node-v48-linux-x64' (1)
node-pre-gyp ERR! stack at ChildProcess.&lt;anonymous&gt; (/home/jiafei427/tmp/shit_test/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:191:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:877:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node-pre-gyp ERR! System Linux 4.4.0-72-generic
node-pre-gyp ERR! command "/usr/local/bin/node" "/home/jiafei427/tmp/shit_test/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/jiafei427/tmp/shit_test
node-pre-gyp ERR! node -v v6.10.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.36
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/jiafei427/tmp/shit_test/lib/binding/node-v48-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/jiafei427/tmp/shit_test/lib/binding/node-v48-linux-x64' (1)

npm ERR! Linux 4.4.0-72-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--arch=arm64" "--build-from-source"
npm ERR! node v6.10.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! sqlite3@3.1.8 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sqlite3@3.1.8 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the sqlite3 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs sqlite3
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls sqlite3
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/jiafei427/tmp/shit_test/npm-debug.log

I googled it, and it may not the perfect answer for it.

but it seems solved my problem, link.

 

I change the sqlite3.gyp file in folder deps, added ‘_XOPEN_SOURCE=500’ to file.


93 'defines': [
 94 '_REENTRANT=1',
 95 'SQLITE_THREADSAFE=1',
 96 'SQLITE_ENABLE_FTS3',
 97 'SQLITE_ENABLE_FTS4',
 98 'SQLITE_ENABLE_FTS5',
 99 'SQLITE_ENABLE_JSON1',
100 'SQLITE_ENABLE_RTREE',
101 '_XOPEN_SOURCE=500'

 

Even though, you get several warnings for that, anyway you will get an build.


jiafei427@CKUBU:~/tmp/shit_test$ npm install --arch=arm64 --build-from-source

> sqlite3@3.1.8 install /home/jiafei427/tmp/shit_test
> node-pre-gyp install --fallback-to-build

make: Entering directory '/home/jiafei427/tmp/shit_test/build'
ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c
TOUCH Release/obj.target/deps/action_before_build.stamp
CC(target) Release/obj.target/sqlite3/gen/sqlite-autoconf-3150000/sqlite3.o
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c: In function 'unixSectorSize':
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:33295:67: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses]
((pFile->sectorSize / 512 * SQLITE_IOCAP_ATOMIC512) << 1) - 2 |
^
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:33303:67: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses]
((pFile->sectorSize / 512 * SQLITE_IOCAP_ATOMIC512) << 1) - 2 |
^
AR(target) Release/obj.target/deps/sqlite3.a
COPY Release/sqlite3.a
CXX(target) Release/obj.target/node_sqlite3/src/database.o
../src/database.cc: In static member function 'static Nan::NAN_METHOD_RETURN_TYPE node_sqlite3::Database::New(Nan::NAN_METHOD_ARGS_TYPE)':
../src/database.cc:133:96: warning: 'bool v8::Object::ForceSet(v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)' is deprecated: Use CreateDataProperty / DefineOwnProperty [-Wdeprecated-declarations]
info.This()->ForceSet(Nan::New("filename").ToLocalChecked(), info[0].As<String>(), ReadOnly);
^
In file included from /home/jiafei427/.node-gyp/6.10.0/include/node/v8.h:25:0,
from /home/jiafei427/.node-gyp/6.10.0/include/node/node.h:42,
from ../node_modules/nan/nan.h:47,
from ../src/database.h:10,
from ../src/database.cc:4:
/home/jiafei427/.node-gyp/6.10.0/include/node/v8.h:2695:22: note: declared here
bool ForceSet(Local<Value> key, Local<Value> value,
^
/home/jiafei427/.node-gyp/6.10.0/include/node/v8config.h:333:3: note: in definition of macro 'V8_DEPRECATED'
declarator __attribute__((deprecated(message)))
^
../src/database.cc:134:86: warning: 'bool v8::Object::ForceSet(v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)' is deprecated: Use CreateDataProperty / DefineOwnProperty [-Wdeprecated-declarations]
info.This()->ForceSet(Nan::New("mode").ToLocalChecked(), Nan::New(mode), ReadOnly);
^
In file included from /home/jiafei427/.node-gyp/6.10.0/include/node/v8.h:25:0,
from /home/jiafei427/.node-gyp/6.10.0/include/node/node.h:42,
from ../node_modules/nan/nan.h:47,
from ../src/database.h:10,
from ../src/database.cc:4:
/home/jiafei427/.node-gyp/6.10.0/include/node/v8.h:2695:22: note: declared here
bool ForceSet(Local<Value> key, Local<Value> value,
^
/home/jiafei427/.node-gyp/6.10.0/include/node/v8config.h:333:3: note: in definition of macro 'V8_DEPRECATED'
declarator __attribute__((deprecated(message)))
^
../src/database.cc: In static member function 'static void node_sqlite3::Database::Work_BeginOpen(node_sqlite3::Database::Baton*)':
../src/database.cc:144:9: warning: unused variable 'status' [-Wunused-variable]
int status = uv_queue_work(uv_default_loop(),
^
../src/database.cc: In static member function 'static void node_sqlite3::Database::Work_BeginClose(node_sqlite3::Database::Baton*)':
../src/database.cc:230:9: warning: unused variable 'status' [-Wunused-variable]
int status = uv_queue_work(uv_default_loop(),
^
../src/database.cc: In static member function 'static void node_sqlite3::Database::Work_BeginExec(node_sqlite3::Database::Baton*)':
../src/database.cc:525:9: warning: unused variable 'status' [-Wunused-variable]
int status = uv_queue_work(uv_default_loop(),
^
../src/database.cc: In static member function 'static void node_sqlite3::Database::Work_BeginLoadExtension(node_sqlite3::Database::Baton*)':
../src/database.cc:625:9: warning: unused variable 'status' [-Wunused-variable]
int status = uv_queue_work(uv_default_loop(),
^
CXX(target) Release/obj.target/node_sqlite3/src/node_sqlite3.o
CXX(target) Release/obj.target/node_sqlite3/src/statement.o
../src/statement.cc: In static member function 'static Nan::NAN_METHOD_RETURN_TYPE node_sqlite3::Statement::New(Nan::NAN_METHOD_ARGS_TYPE)':
../src/statement.cc:103:74: warning: 'bool v8::Object::ForceSet(v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)' is deprecated: Use CreateDataProperty / DefineOwnProperty [-Wdeprecated-declarations]
info.This()->ForceSet(Nan::New("sql").ToLocalChecked(), sql, ReadOnly);
^
In file included from /home/jiafei427/.node-gyp/6.10.0/include/node/v8.h:25:0,
from /home/jiafei427/.node-gyp/6.10.0/include/node/node.h:42,
from ../src/statement.cc:2:
/home/jiafei427/.node-gyp/6.10.0/include/node/v8.h:2695:22: note: declared here
bool ForceSet(Local<Value> key, Local<Value> value,
^
/home/jiafei427/.node-gyp/6.10.0/include/node/v8config.h:333:3: note: in definition of macro 'V8_DEPRECATED'
declarator __attribute__((deprecated(message)))
^
../src/statement.cc: In static member function 'static void node_sqlite3::Statement::Work_BeginPrepare(node_sqlite3::Database::Baton*)':
../src/statement.cc:118:9: warning: unused variable 'status' [-Wunused-variable]
int status = uv_queue_work(uv_default_loop(),
^
In file included from ../src/statement.cc:6:0:
../src/statement.cc: In static member function 'static void node_sqlite3::Statement::Work_BeginBind(node_sqlite3::Statement::Baton*)':
../src/macros.h:125:9: warning: unused variable 'status' [-Wunused-variable]
int status = uv_queue_work(uv_default_loop(), \
^
../src/statement.cc:322:5: note: in expansion of macro 'STATEMENT_BEGIN'
STATEMENT_BEGIN(Bind);
^
../src/statement.cc: In static member function 'static void node_sqlite3::Statement::Work_BeginGet(node_sqlite3::Statement::Baton*)':
../src/macros.h:125:9: warning: unused variable 'status' [-Wunused-variable]
int status = uv_queue_work(uv_default_loop(), \
^
../src/statement.cc:370:5: note: in expansion of macro 'STATEMENT_BEGIN'
STATEMENT_BEGIN(Get);
^
../src/statement.cc: In static member function 'static void node_sqlite3::Statement::Work_BeginRun(node_sqlite3::Statement::Baton*)':
../src/macros.h:125:9: warning: unused variable 'status' [-Wunused-variable]
int status = uv_queue_work(uv_default_loop(), \
^
../src/statement.cc:438:5: note: in expansion of macro 'STATEMENT_BEGIN'
STATEMENT_BEGIN(Run);
^
../src/statement.cc: In static member function 'static void node_sqlite3::Statement::Work_BeginAll(node_sqlite3::Statement::Baton*)':
../src/macros.h:125:9: warning: unused variable 'status' [-Wunused-variable]
int status = uv_queue_work(uv_default_loop(), \
^
../src/statement.cc:504:5: note: in expansion of macro 'STATEMENT_BEGIN'
STATEMENT_BEGIN(All);
^
../src/statement.cc: In static member function 'static void node_sqlite3::Statement::Work_BeginEach(node_sqlite3::Statement::Baton*)':
../src/macros.h:125:9: warning: unused variable 'status' [-Wunused-variable]
int status = uv_queue_work(uv_default_loop(), \
^
../src/statement.cc:601:5: note: in expansion of macro 'STATEMENT_BEGIN'
STATEMENT_BEGIN(Each);
^
../src/statement.cc: In static member function 'static void node_sqlite3::Statement::Work_BeginReset(node_sqlite3::Statement::Baton*)':
../src/macros.h:125:9: warning: unused variable 'status' [-Wunused-variable]
int status = uv_queue_work(uv_default_loop(), \
^
../src/statement.cc:724:5: note: in expansion of macro 'STATEMENT_BEGIN'
STATEMENT_BEGIN(Reset);
^
SOLINK_MODULE(target) Release/obj.target/node_sqlite3.node
COPY Release/node_sqlite3.node
COPY /home/jiafei427/tmp/shit_test/lib/binding/node-v48-linux-x64/node_sqlite3.node
TOUCH Release/obj.target/action_after_build.stamp
make: Leaving directory '/home/jiafei427/tmp/shit_test/build'

> sqlite3@3.1.8 prepublish /home/jiafei427/tmp/shit_test
> npm ls

sqlite3@3.1.8 /home/jiafei427/tmp/shit_test
├─┬ aws-sdk@2.85.0
│ ├─┬ buffer@4.9.1
│ │ ├── base64-js@1.2.1
│ │ ├── ieee754@1.1.8
│ │ └── isarray@1.0.0
│ ├── crypto-browserify@1.0.9
│ ├── events@1.1.1
│ ├── jmespath@0.15.0
│ ├── querystring@0.2.0
│ ├── sax@1.2.1
│ ├─┬ url@0.10.3
│ │ └── punycode@1.3.2
│ ├── uuid@3.0.1
│ ├── xml2js@0.4.17
│ └── xmlbuilder@4.2.1
├─┬ eslint@3.5.0
│ ├─┬ chalk@1.1.3
│ │ ├── ansi-styles@2.2.1
│ │ ├── has-ansi@2.0.0
│ │ ├── strip-ansi@3.0.1
│ │ └── supports-color@2.0.0
│ ├─┬ concat-stream@1.6.0
│ │ ├── inherits@2.0.3
│ │ ├─┬ readable-stream@2.3.3
│ │ │ ├── core-util-is@1.0.2
│ │ │ ├── process-nextick-args@1.0.7
│ │ │ ├── string_decoder@1.0.3
│ │ │ └── util-deprecate@1.0.2
│ │ └── typedarray@0.0.6
│ ├─┬ debug@2.6.8
│ │ └── ms@2.0.0
│ ├── doctrine@1.5.0
│ ├─┬ escope@3.6.0
│ │ ├─┬ es6-map@0.1.5
│ │ │ ├── d@1.0.0
│ │ │ ├── es5-ext@0.10.24
│ │ │ ├── es6-iterator@2.0.1
│ │ │ ├── es6-set@0.1.5
│ │ │ ├── es6-symbol@3.1.1
│ │ │ └── event-emitter@0.3.5
│ │ ├── es6-weak-map@2.0.2
│ │ └── esrecurse@4.2.0
│ ├─┬ espree@3.4.3
│ │ ├── acorn@5.1.1
│ │ └─┬ acorn-jsx@3.0.1
│ │ └── acorn@3.3.0
│ ├── estraverse@4.2.0
│ ├── esutils@2.0.2
│ ├─┬ file-entry-cache@2.0.0
│ │ ├─┬ flat-cache@1.2.2
│ │ │ ├── circular-json@0.3.1
│ │ │ ├─┬ del@2.2.2
│ │ │ │ ├─┬ globby@5.0.0
│ │ │ │ │ ├─┬ array-union@1.0.2
│ │ │ │ │ │ └── array-uniq@1.0.3
│ │ │ │ │ └── arrify@1.0.1
│ │ │ │ ├── is-path-cwd@1.0.0
│ │ │ │ ├─┬ is-path-in-cwd@1.0.0
│ │ │ │ │ └── is-path-inside@1.0.0
│ │ │ │ ├── pify@2.3.0
│ │ │ │ └─┬ pinkie-promise@2.0.1
│ │ │ │ └── pinkie@2.0.4
│ │ │ ├── graceful-fs@4.1.11
│ │ │ └── write@0.2.1
│ │ └── object-assign@4.1.1
│ ├─┬ glob@7.1.2
│ │ ├── fs.realpath@1.0.0
│ │ ├─┬ inflight@1.0.6
│ │ │ └── wrappy@1.0.2
│ │ ├─┬ minimatch@3.0.4
│ │ │ └─┬ brace-expansion@1.1.8
│ │ │ ├── balanced-match@1.0.0
│ │ │ └── concat-map@0.0.1
│ │ ├── once@1.4.0
│ │ └── path-is-absolute@1.0.1
│ ├── globals@9.18.0
│ ├── ignore@3.3.3
│ ├── imurmurhash@0.1.4
│ ├─┬ inquirer@0.12.0
│ │ ├── ansi-escapes@1.4.0
│ │ ├── ansi-regex@2.1.1
│ │ ├─┬ cli-cursor@1.0.2
│ │ │ └─┬ restore-cursor@1.0.1
│ │ │ ├── exit-hook@1.1.1
│ │ │ └── onetime@1.1.0
│ │ ├── cli-width@2.1.0
│ │ ├── figures@1.7.0
│ │ ├─┬ readline2@1.0.1
│ │ │ ├── code-point-at@1.1.0
│ │ │ ├─┬ is-fullwidth-code-point@1.0.0
│ │ │ │ └── number-is-nan@1.0.1
│ │ │ └── mute-stream@0.0.5
│ │ ├── run-async@0.1.0
│ │ ├── rx-lite@3.1.2
│ │ ├── string-width@1.0.2
│ │ └── through@2.3.8
│ ├─┬ is-my-json-valid@2.16.0
│ │ ├── generate-function@2.0.0
│ │ ├─┬ generate-object-property@1.2.0
│ │ │ └── is-property@1.0.2
│ │ ├── jsonpointer@4.0.1
│ │ └── xtend@4.0.1
│ ├─┬ is-resolvable@1.0.0
│ │ └── tryit@1.0.3
│ ├─┬ js-yaml@3.9.0
│ │ ├─┬ argparse@1.0.9
│ │ │ └── sprintf-js@1.0.3
│ │ └── esprima@4.0.0
│ ├─┬ json-stable-stringify@1.0.1
│ │ └── jsonify@0.0.0
│ ├─┬ levn@0.3.0
│ │ ├── prelude-ls@1.1.2
│ │ └── type-check@0.3.2
│ ├── lodash@4.17.4
│ ├─┬ mkdirp@0.5.1
│ │ └── minimist@0.0.8
│ ├── natural-compare@1.4.0
│ ├─┬ optionator@0.8.2
│ │ ├── deep-is@0.1.3
│ │ ├── fast-levenshtein@2.0.6
│ │ └── wordwrap@1.0.0
│ ├── path-is-inside@1.0.2
│ ├── pluralize@1.2.1
│ ├── progress@1.1.8
│ ├─┬ require-uncached@1.0.3
│ │ ├─┬ caller-path@0.1.0
│ │ │ └── callsites@0.2.0
│ │ └── resolve-from@1.0.1
│ ├── shelljs@0.6.1
│ ├── strip-bom@3.0.0
│ ├── strip-json-comments@1.0.4
│ ├─┬ table@3.8.3
│ │ ├─┬ ajv@4.11.8
│ │ │ └── co@4.6.0
│ │ ├── ajv-keywords@1.5.1
│ │ ├── slice-ansi@0.0.4
│ │ └─┬ string-width@2.1.0
│ │ ├── is-fullwidth-code-point@2.0.0
│ │ └─┬ strip-ansi@4.0.0
│ │ └── ansi-regex@3.0.0
│ ├── text-table@0.2.0
│ └─┬ user-home@2.0.0
│ └── os-homedir@1.0.2
├─┬ mocha@3.4.2
│ ├── browser-stdout@1.3.0
│ ├─┬ commander@2.9.0
│ │ └── graceful-readlink@1.0.1
│ ├─┬ debug@2.6.0
│ │ └── ms@0.7.2
│ ├── diff@3.2.0
│ ├── escape-string-regexp@1.0.5
│ ├── glob@7.1.1
│ ├── growl@1.9.2
│ ├── json3@3.3.2
│ ├─┬ lodash.create@3.1.1
│ │ ├─┬ lodash._baseassign@3.2.0
│ │ │ ├── lodash._basecopy@3.0.1
│ │ │ └─┬ lodash.keys@3.1.2
│ │ │ ├── lodash._getnative@3.9.1
│ │ │ ├── lodash.isarguments@3.1.0
│ │ │ └── lodash.isarray@3.0.4
│ │ ├── lodash._basecreate@3.0.3
│ │ └── lodash._isiterateecall@3.0.9
│ └─┬ supports-color@3.1.2
│ └── has-flag@1.0.0
├── nan@2.4.0
└─┬ node-pre-gyp@0.6.36
├─┬ nopt@4.0.1
│ ├── abbrev@1.1.0
│ └─┬ osenv@0.1.4
│ └── os-tmpdir@1.0.2
├─┬ npmlog@4.1.2
│ ├─┬ are-we-there-yet@1.1.4
│ │ └── delegates@1.0.0
│ ├── console-control-strings@1.1.0
│ ├─┬ gauge@2.7.4
│ │ ├── aproba@1.1.2
│ │ ├── has-unicode@2.0.1
│ │ ├── signal-exit@3.0.2
│ │ └── wide-align@1.1.2
│ └── set-blocking@2.0.0
├─┬ rc@1.2.1
│ ├── deep-extend@0.4.2
│ ├── ini@1.3.4
│ ├── minimist@1.2.0
│ └── strip-json-comments@2.0.1
├─┬ request@2.81.0
│ ├── aws-sign2@0.6.0
│ ├── aws4@1.6.0
│ ├── caseless@0.12.0
│ ├─┬ combined-stream@1.0.5
│ │ └── delayed-stream@1.0.0
│ ├── extend@3.0.1
│ ├── forever-agent@0.6.1
│ ├─┬ form-data@2.1.4
│ │ └── asynckit@0.4.0
│ ├─┬ har-validator@4.2.1
│ │ └── har-schema@1.0.5
│ ├─┬ hawk@3.1.3
│ │ ├── boom@2.10.1
│ │ ├── cryptiles@2.0.5
│ │ ├── hoek@2.16.3
│ │ └── sntp@1.0.9
│ ├─┬ http-signature@1.1.1
│ │ ├── assert-plus@0.2.0
│ │ ├─┬ jsprim@1.4.0
│ │ │ ├── assert-plus@1.0.0
│ │ │ ├── extsprintf@1.0.2
│ │ │ ├── json-schema@0.2.3
│ │ │ └── verror@1.3.6
│ │ └─┬ sshpk@1.13.1
│ │ ├── asn1@0.2.3
│ │ ├── assert-plus@1.0.0
│ │ ├── bcrypt-pbkdf@1.0.1
│ │ ├─┬ dashdash@1.14.1
│ │ │ └── assert-plus@1.0.0
│ │ ├── ecc-jsbn@0.1.1
│ │ ├─┬ getpass@0.1.7
│ │ │ └── assert-plus@1.0.0
│ │ ├── jsbn@0.1.1
│ │ └── tweetnacl@0.14.5
│ ├── is-typedarray@1.0.0
│ ├── isstream@0.1.2
│ ├── json-stringify-safe@5.0.1
│ ├─┬ mime-types@2.1.15
│ │ └── mime-db@1.27.0
│ ├── oauth-sign@0.8.2
│ ├── performance-now@0.2.0
│ ├── qs@6.4.0
│ ├── safe-buffer@5.1.1
│ ├── stringstream@0.0.5
│ ├─┬ tough-cookie@2.3.2
│ │ └── punycode@1.4.1
│ ├── tunnel-agent@0.6.0
│ └── uuid@3.1.0
├── rimraf@2.6.1
├── semver@5.3.0
├─┬ tar@2.2.1
│ ├── block-stream@0.0.9
│ └── fstream@1.0.11
└─┬ tar-pack@3.4.0
├── fstream-ignore@1.0.5
└── uid-number@0.0.6

 

LAST THING,

if you try to run the test on the board, say QNX arm-64,

if you just tar(otherwise, the symlinks will be broken!) the sqlite3 and untar to the target and run npm test,

you will have errors following, and you need to change the folder name.


# npm test

> sqlite3@3.1.8 pretest /base/usr/ck/ck_test/cloudCar/node_modules/sqlite3
> node test/support/createdb.js

module.js:471
throw err;
^

Error: Cannot find module '/base/usr/ck/ck_test/cloudCar/node_modules/sqlite3/lib/binding/node-v48-qnx-arm64/node_sqlite3.node'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/base/usr/ck/ck_test/cloudCar/node_modules/sqlite3/lib/sqlite3.js:4:15)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
npm ERR! Test failed. See above for more details.
#
# mv ./lib/binding/node-v48-linux-x64/ ./lib/binding/node-v48-qnx-arm64

 

 

that’s it.

Thanks to THE GREAT GOOGLE. 😛

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s