Cross-compile node.js module better-sqlite3 for qnx

clone the resource:

# git clone https://github.com/JoshuaWise/better-sqlite3.git

# cd better-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, you need to copy the pre-built sqlite3 node_module to the same directory,

then

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

 

you will have following error:

npm ERR! git /home/jiafei427/workspace/jlr_pivi/cloudCar/needed_modules/node_modules/better-sqlite3: Appears to be a git repo or submodule.

 

 

you need to remove the .git folder for each module.

 

Then 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'

 

Let’s build again,

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

 

wallah, that’s it, and now you can remove the sqlite3 node_module folder.

Advertisements

Mount QNX file system


# df -h
/dev/emmc/uda0.ms.2 95M 15M 80M 16% /efs/
/dev/emmc/uda0.97d7 2.9G 955M 2.0G 32% /base/
/dev/emmc/rpmb0 4.0M 4.0M 0 100%
/dev/emmc/boot1 2.0K 2.0K 0 100% /dev/emmc/boot1.
/dev/emmc/boot1 4.0M 4.0M 0 100%
/dev/emmc/boot0 4.0M 4.0M 0 100%
/dev/emmc/uda0 43G 43G 0 100% /dev/emmc/uda0.a
/dev/emmc/uda0 12G 12G 0 100% /dev/emmc/uda0.1
/dev/emmc/uda0 512K 512K 0 100% /dev/emmc/uda0.9
/dev/emmc/uda0 128K 128K 0 100% /dev/emmc/uda0.f
/dev/emmc/uda0 512K 512K 0 100% /dev/emmc/uda0.d
/dev/emmc/uda0 1.0M 1.0M 0 100% /dev/emmc/uda0.8
/dev/emmc/uda0 32M 32M 0 100% /dev/emmc/uda0.6
/dev/emmc/uda0 256M 256M 0 100% /dev/emmc/uda0.5
/dev/emmc/uda0 2.0M 2.0M 0 100% /dev/emmc/uda0.0
/dev/emmc/uda0 2.0M 2.0M 0 100% /dev/emmc/uda0.e
/dev/emmc/uda0 8.0K 8.0K 0 100% /dev/emmc/uda0.2
/dev/emmc/uda0 1.0K 1.0K 0 100% /dev/emmc/uda0.5
/dev/emmc/uda0 1.0M 1.0M 0 100% /dev/emmc/uda0.6
/dev/emmc/uda0 128K 128K 0 100% /dev/emmc/uda0.3
/dev/emmc/uda0 1.0M 1.0M 0 100% /dev/emmc/uda0.2
/dev/emmc/uda0 33M 33M 0 100% /dev/emmc/uda0.a
/dev/emmc/uda0 1.0K 1.0K 0 100% /dev/emmc/uda0.1
/dev/emmc/uda0 256K 256K 0 100% /dev/emmc/uda0.e
/dev/emmc/uda0 256K 256K 0 100% /dev/emmc/uda0.e
/dev/emmc/uda0 1.0K 1.0K 0 100% /dev/emmc/uda0.6
/dev/emmc/uda0 32M 32M 0 100% /dev/emmc/uda0.3
/dev/emmc/uda0 1.0M 1.0M 0 100% /dev/emmc/uda0.4
/dev/emmc/uda0 16M 16M 0 100% /dev/emmc/uda0.7
/dev/emmc/uda0 256K 256K 0 100% /dev/emmc/uda0.8
/dev/emmc/uda0 256K 256K 0 100% /dev/emmc/uda0.8
/dev/emmc/uda0 256K 256K 0 100% /dev/emmc/uda0.7
/dev/emmc/uda0 256K 256K 0 100% /dev/emmc/uda0.7
/dev/emmc/uda0 256K 256K 0 100% /dev/emmc/uda0.4
/dev/emmc/uda0 256K 256K 0 100% /dev/emmc/uda0.4
/dev/emmc/uda0 64M 64M 0 100% /dev/emmc/uda0.9
/dev/emmc/uda0 64M 64M 0 100% /dev/emmc/uda0.2
/dev/emmc/uda0 1.0M 1.0M 0 100% /dev/emmc/uda0.4
/dev/emmc/uda0 1.0M 1.0M 0 100% /dev/emmc/uda0.4
/dev/emmc/uda0 128K 128K 0 100% /dev/emmc/uda0.a
/dev/emmc/uda0 128K 128K 0 100% /dev/emmc/uda0.a
/dev/emmc/uda0 2.0M 2.0M 0 100% /dev/emmc/uda0.6
/dev/emmc/uda0 512K 512K 0 100% /dev/emmc/uda0.c
/dev/emmc/uda0 512K 512K 0 100% /dev/emmc/uda0.c
/dev/emmc/uda0 512K 512K 0 100% /dev/emmc/uda0.e
/dev/emmc/uda0 512K 512K 0 100% /dev/emmc/uda0.e
/dev/emmc/uda0 500K 500K 0 100% /dev/emmc/uda0.0
/dev/emmc/uda0 500K 500K 0 100% /dev/emmc/uda0.0
/dev/emmc/uda0 2.0M 2.0M 0 100% /dev/emmc/uda0.a
/dev/emmc/uda0 2.0M 2.0M 0 100% /dev/emmc/uda0.a
/dev/emmc/uda0 2.0M 2.0M 0 100% /dev/emmc/uda0.d
/dev/emmc/uda0 2.0M 2.0M 0 100% /dev/emmc/uda0.d
/dev/emmc/uda0 58G 58G 0 100%

 

PS. can't use this 43G of free spaces, so I needed to create a qnx6 filesystem on it and mount it

 

# df -n /dev/emmc/uda0.97d7b011-54da-4835-b3c4-917ad6e73d74.17
Filesystem Mounted on Type
/dev/emmc/uda0.97d7 /base/ qnx6

# df -n /dev/emmc/uda0.aa9a5c4c-4f1f-7d3a-014a-22bd33bf7191.47
Filesystem Mounted on Type
/dev/emmc/uda0 /dev/emmc/uda0.a blk-partition

# mkqnx6fs /dev/emmc/uda0.aa9a5c4c-4f1f-7d3a-014a-22bd33bf7191.47

# mount -t qnx6 /dev/emmc/uda0.aa9a5c4c-4f1f-7d3a-014a-22bd33bf7191.47 /shit/

# df -nh /shit
Filesystem Mounted on Type
/dev/emmc/uda0.aa9a /shit/ qnx6

# df -Ph /shit
Filesystem Size Used Available Capacity Mounted on
/dev/emmc/uda0.aa9a 43G 1.3G 41G 4% /shit/

 

Ref.

http://dooeui.blogspot.kr/2014/11/qnx-neutrino-v6.html

 

cross-compile zeromq/zeromq.js

since zero.node is not updating periodically, I decided to cross-compile zeromq.js from zeromq community.

 

  1. Download source from github.
    # git clone <a href="https://github.com/zeromq/zeromq.js.git" data-mce-href="https://github.com/zeromq/zeromq.js.git">https://github.com/zeromq/zeromq.js.git</a> zeromq
    
  2. run command
    # npm install --arch=arm64 --verbose
    
  3. modify the node-gyp’s make.py for QNX
    # vi ./node_modules/node-gyp/gyp/pylib/gyp/generator/make.py
    change following line
    DEPFLAGS = -MMD -MF $(depfile).raw
    to
    DEPFLAGS = -Wp,-MMD,$(depfile) -Wp,-MF,$(depfile).raw
    
  4. set the QNX dev environment
    # source ~/qnx70/qnxsdp-env.sh
    
  5. modify the ./script/build_libzmq.sh as follow, added CC and CXX, also changed dirname to realpath to the command
    
    #!/bin/sh
    
    export CC="qcc -V5.4.0,gcc_ntoaarch64le"
    export CXX="q++ -V5.4.0,gcc_ntoaarch64le"
    export ZMQ_BUILD_OPTIONS="--host=aarch64-qnx"
    
    set -e
    
    if [ "$1" != "" ]; then
     ZMQ=$1
    else
     echo "No ZMQ version given"
     exit 1
    fi
    
    export MACOSX_DEPLOYMENT_TARGET=10.9
    export BASE=$(dirname "$0")
    export ZMQ_PREFIX=$(realpath "${BASE}/../zmq")
    export ZMQ_SRC_DIR=zeromq-$ZMQ
    cd "${ZMQ_PREFIX}"
    
    export CFLAGS=-fPIC
    export CXXFLAGS=-fPIC
    export PKG_CONFIG_PATH="${ZMQ_PREFIX}/lib/pkgconfig"
    
    echo "zeromq-$ZMQ.tar.gz"
    
    test -d "${ZMQ_SRC_DIR}" || tar xzf zeromq-$ZMQ.tar.gz
    cd "${ZMQ_SRC_DIR}"
    
    test -f configure || ./autogen.sh
    if [ "$ZMQ" = "4.1.6" ]; then
     ./configure "--prefix=${ZMQ_PREFIX}" --with-relaxed --enable-static --disable-shared --without-documentation ${ZMQ_BUILD_OPTIONS}
    else
     ./configure "--prefix=${ZMQ_PREFIX}" --disable-pedantic --enable-static --disable-shared --without-docs ${ZMQ_BUILD_OPTIONS}
    fi
    make -j 2
    make install
    
    cd "${ZMQ_PREFIX}"
    rm -rf "${ZMQ_SRC_DIR}"
    rm -f zeromq-$ZMQ.tar.gz
    
  6. run the script
    #./scripts/build_libzmq.sh 4.2.2
    

    the you will have built output from zmq,
    jiafei427@CKUBU:~/tmp/test/node_test/zeromq/zmq$ ls
    bin include lib

  7. build again
    # export CC="qcc -V5.4.0,gcc_ntoaarch64le"
    # export CXX="q++ -V5.4.0,gcc_ntoaarch64le"
    # npm install --arch=arm64 --verbose
    
  8. That’s it. :p

[node.js] Error: setuid user id does not exist

 


# npm config ls -g
Error: setuid user id does not exist
at /base/usr/npm/node_modules/uid-number/uid-number.js:49:16
at ChildProcess.exithandler (child_process.js:197:7)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

Error: ENOENT: no such file or directory, open 'npm-debug.log.3559331957'
at Error (native)

modify the file /base/usr/npm/node_modules/uid-number/uid-number.js

Goto line 11 and replace uidSupport = process.getuid && process.setuid with uidSupport = false

 

problem solved.

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. 😛

 

node.js dev. tips for myself

=======================================
default location for node_modules:


/usr/local/lib/node_modules$

<code>usr/lib/node_modules</code>

 

with following command you can check the node-modules location which npm will install to:


$ npm prefix -g
/usr/local

 

when you want to develop node.js code in Sublime, install Docblock(comment_generator) and Nodejs(autocomplete) for sublime!
https://github.com/spadgos/sublime-jsdocs
https://packagecontrol.io/packages/Nodejs

 

 

CRTL+B to run the program and observe result inside sublime

 

 

Ref.:

http://scottksmith.com/blog/2014/09/29/3-essential-sublime-text-plugins-for-node-and-javascript-developers/

Posting Source Code in WordPress

Posting Source Code

While WordPress.com doesn’t allow you to use potentially dangerous code on your blog, there is a way to post source code for viewing. We have created a shortcode you can wrap around source code that preserves its formatting and even provides syntax highlighting for certain languages, like so:

1
2
3
4
#button {
    font-weight: bold;
    border: 2pxsolid#fff;
}

To accomplish the above, just wrap your code in these tags:

your code here

The language (or lang) parameter controls how the code is syntax highlighted. The following languages are supported:

  • actionscript3
  • bash
  • clojure
  • coldfusion
  • cpp
  • csharp
  • css
  • delphi
  • diff
  • erlang
  • fsharp
  • go
  • groovy
  • html
  • java
  • javafx
  • javascript
  • latex (you can also render LaTeX)
  • matlab (keywords only)
  • objc
  • perl
  • php
  • powershell
  • python
  • r
  • ruby
  • scala
  • sql
  • text
  • vb
  • xml

If the language parameter is not set, it will default to “text” (no syntax highlighting).

Code in between the source code tags will automatically be encoded for display, you don’t need to worry about HTML entities or anything.

Configuration Parameters

The shortcodes also accept a variety of configuration parameters that you may use to customize the output. All are completely optional.

  • autolinks (true/false) — Makes all URLs in your posted code clickable. Defaults to true.
  • collapse (true/false) — If true, the code box will be collapsed when the page loads, requiring the visitor to click to expand it. Good for large code posts. Defaults to false.
  • firstline (number) — Use this to change what number the line numbering starts at. It defaults to 1.
  • gutter (true/false) — If false, the line numbering on the left side will be hidden. Defaults to true.
  • highlight (comma-seperated list of numbers) — You can list the line numbers you want to be highlighted. For example “4,7,19”.
  • htmlscript (true/false) — If true, any HTML/XML in your code will be highlighted. This is useful when you are mixing code into HTML, such as PHP inside of HTML. Defaults to false and will only work with certain code languages.
  • light (true/false) — If true, the gutter (line numbering) and margin (see below) will be hidden. This is helpful when posting only one or two lines of code. Defaults to false.
  • padlinenumbers (true/false/integer) — Allows you to control the line number padding. true will result in automatic padding, false will result in no padding, and entering a number will force a specific amount of padding.
  • title (string) — Set a label for your code block. Can be useful when combined with the collapseparameter.

 

Ref.:

https://en.support.wordpress.com/code/posting-source-code/#toc