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_ntoarmv7le"
    export CXX="q++ -V5.4.0,gcc_ntoarmv7le"
    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
    # 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

cross-compile node.js for QNX

I was able to cross-compile the node-0-10-ver from this link.

FYI. my build-script was abit differ from the original one as follow:


#!/bin/bash#!/bin/bash
if [ ! -d "${QNX_HOST}" ]; then  echo "QNX_HOST must be set to the path of the QNX host toolchain."  exit 1fi
if [ ! -d "${QNX_TARGET}" ]; then  echo "QNX_TARGET must be set to the path of the QNX target toolchain."  exit 1fi
if [ "${QCONF_OVERRIDE}" != "" ]; then  cp -p $QCONF_OVERRIDE /tmp/owbqsk$$.mk  echo "all:" >>/tmp/owbqsk$$.mk  echo ' echo $(INSTALL_ROOT_nto)' >>/tmp/owbqsk$$.mk  STAGE_DIR=`make -s -f /tmp/owbqsk$$.mk`  rm /tmp/owbqsk$$.mkfi
if [ "${STAGE_DIR}" == "" ]; then  echo Staging directory could not be determined. Using NDK.else  echo Using staging directory: ${STAGE_DIR}fi
if [ "${1}" == "clean" ]; then  make -f Makefile clean  exit 1fi

echo Building for aarch64 #CPU="aarch64"CPU="arm"CPUDIR="${CPU}le-v7"CPUTYPE="${CPU}v7le"BUSUFFIX="${CPU}v7"CPU_VER="cortex-a9"#CPU_CFLAGS="-mtune=${CPU_VER} -mfpu=vfpv3"CPU_CFLAGS="-mtune=${CPU_VER} -mfpu=vfpv3-d16"

QNX_TOOL_DIR="${QNX_HOST}/usr/bin"QNX_COMPILER="${QNX_TOOL_DIR}/ntoarmv7-gcc"QNX_COMPILER="${QNX_TOOL_DIR}/qcc"QNX_TOOL_PREFIX="${QNX_TOOL_DIR}/nto${BUSUFFIX}"
if [ "${STAGE_DIR}" == "" ]; then   QNX_LIB="${QNX_TARGET}/${CPUDIR}/lib"  QNX_USR_LIB="${QNX_TARGET}/${CPUDIR}/usr/lib"  QNX_INC="${QNX_TARGET}/usr/include"else  QNX_LIB="${STAGE_DIR}/${CPUDIR}/lib"  QNX_USR_LIB="${STAGE_DIR}/${CPUDIR}/usr/lib"  QNX_INC="${STAGE_DIR}/usr/include"fi
COMP_PATHS=" \  -Wl,-rpath-link,${QNX_LIB} \  -Wl,-rpath-link,${QNX_USR_LIB} \  -L${QNX_LIB} \  -L${QNX_USR_LIB} \  -I${QNX_INC}"
export CC="${QNX_COMPILER}"export CFLAGS="-V5.4.0,gcc_ntoarmv7le -g -Wformat -Wformat-security -Werror=format-security -Wl,-z,relro -fPIE -pie ${COMP_PATHS} ${CPU_CFLAGS}"#export CFLAGS="-V5.4.0,gcc_ntoarmv7le -g -Wformat -Wformat-security -Werror=format-security -Wl,-z,relro -fPIE -pie -D__QNXNTO__ ${COMP_PATHS} ${CPU_CFLAGS}"#export CFLAGS="-V5.4.0,gcc_ntoaarch64le -g -Wformat -Wformat-security -Werror=format-security -Wl,-z,relro -fPIE -pie ${COMP_PATHS} ${CPU_CFLAGS}"#export CFLAGS="-Vgcc_nto${CPUTYPE} -Wformat -Wformat-security -Werror=format-security -Wl,-z,relro -fPIE -pie ${COMP_PATHS} ${CPU_CFLAGS}"#export CFLAGS="-Vgcc_nto${CPUTYPE} -g -Wformat -Wformat-security -Werror=format-security -Wl,-z,relro -fPIE -pie ${COMP_PATHS} ${CPU_CFLAGS}"#export CFLAGS="-Vgcc_nto${CPUTYPE} -g -Wformat -Wformat-security -Werror=format-security -Wl,-z,relro -fPIE -D__QNXNTO65__ ${COMP_PATHS} ${CPU_CFLAGS}" for QNX650export CXX="${QNX_COMPILER}"#export CXXFLAGS="-Vgcc_nto${CPUTYPE}_cpp-ne -g -lang-c++ -Wformat -Wformat-security -Werror=format-security -Wl,-z,relro -fPIE -pie ${COMP_PATHS} ${CPU_CFLAGS}"#export CXXFLAGS="-Vgcc_nto${CPUTYPE}_cpp-ne -g -lang-c++ -Wformat -Wformat-security -Werror=format-security -Wl,-z,relro -fPIE -Wl,--export-dynamic ${COMP_PATHS} ${CPU_CFLAGS}"#export CXXFLAGS="-Vgcc_nto${CPUTYPE}_cpp-ne -lang-c++ -Wformat -Wformat-security -Werror=format-security -Wl,-z,relro -fPIE -Wl,--export-dynamic ${COMP_PATHS} ${CPU_CFLAGS}"#export CXXFLAGS="-V5.4.0,gcc_ntoaarch64le -g -lang-c++ -Wformat -Wformat-security -Werror=format-security -Wl,-z,relro -fPIE -Wl,--export-dynamic ${COMP_PATHS} ${CPU_CFLAGS}"export CXXFLAGS="-V5.4.0,gcc_ntoarmv7le -g -lang-c++ -Wformat -Wformat-security -Werror=format-security -Wl,-z,relro -fPIE -Wl,--export-dynamic ${COMP_PATHS} ${CPU_CFLAGS}"export AR="${QNX_TOOL_PREFIX}-ar"export LINK="${QNX_COMPILER}"export LDFLAGS="${CXXFLAGS} -lcrypto -lssl"export RANLIB="${QNX_TOOL_PREFIX}-ranlib"
export __QNXNTO=1
# The set of GYP_DEFINES to pass to gyp.export GYP_DEFINES="OS=qnx want_separate_host_toolset=0"#export GYP_GENERATORS="make-linux"
CONFIGURE_OPTIONS=""

CONFIGURE_OPTIONS="--dest-cpu=arm --dest-os=qnx --with-arm-float-abi=softfp --without-snapshot --without-dtrace"
./configure --shared-openssl --shared-zlib ${CONFIGURE_OPTIONS}
if [ "${1}" == "test" ]; then  make testelse  make -j4fi

 

Anyway I couldn’t to make it run on aarch64 since I’m running out of time.

 

 

 

Ref.:

http://blog.hemnik.com/2014/06/nodejs-for-qnx-source-code.html

http://fastr.github.io/articles/cross-compiling-node.js-for-arm.html

Streaming media on Web

Conventional video playback (also known as Progressive) involves a single video file at a single quality that is transferred as it is being played. If the user’s playback has caught up to how much of the video has been downloaded, the player pauses and buffers. YouTube subscribes to this method of playback but offers different quality levels that you manually select. You only watch a single quality unless you manually switch it.

With adaptive media streaming, a high quality base video source (often called a Mezzanine) is converted into a set of video files of varying qualities. This process is known as encoding. For example, you can take a mezzanine file and encode low, medium, high, and ultra quality versions of a video. These encoded files are then stored for distribution on a Server or Content Delivery Network (CDN).

When the user attempts to play a video adaptively, they are given a Manifest file that lists information for all these different video qualities. Adaptive streaming technologies then alternate between the different qualities (bitrates) depending on a user’s varying connection while playing the video in order to ensure that buffering is minimized. In order to start playback as soon as possible, adaptive streaming technologies usually begin playback at the lowest quality and then scale upwards after a few seconds. You may have noticed this happening when you start watching a movie or episode on NetFlix.

A video player (often referred to as a Client) that supports an adaptive media streaming technology will handle this process of switching between qualities automatically without a user’s involvement.

AMS&Progressive

What are some adaptive streaming technologies?

The two biggest smooth streaming technologies I’ve worked with in my time at Digiflare are Apple’s HTTP Live Streaming (HLS) and Microsoft’s Smooth Streaming (MSS) technologies. These technologies differ in terms of the video and audio formats they support as well as how they go about delivering the video content optimally.

Streaming – What does HLS, HDS and MPEG-DASH mean?

These are all ‘chunked HTTP’ streaming protocols. These work by breaking the content in small (a few seconds) chunks that can be delivered as separate files rather than a constant stream of content.  The advantage of this method is that it allows the client to make use of the ‘bursty’ nature of the internet and does not rely on a constant bandwidth being available.

Apple’s HTTP Live Streaming (HLS)

HLS stands for HTTP Live Streaming and was developed by Apple to serve its iOS and MAC OS devices.  It is also widely available for other devices notably Android.  Apple made the specification public by publishing it as a draft IEEE RFC. HLS usually makes use of MPEG -2 transport stream technology which carries a separate licensing cost which deters some manufacturers from implementing it in their devices.  It is a simple protocol that is quite easy to implement.

Summary:

  • Manifest: M3U8 playlist
  • Video: H.264
  • Audio: MP3 or HE-AAC
  • Container: MPEG-2
  • Server: No special server software

Microsoft’s Smooth Streaming (MSS)

Microsoft’s Smooth Streaming technology also involves encoding a mezzanine into various quality levels but MSS supports slightly different formats in the encoding process. Video can be encoded using H.264 or VC-1 and audio is encoded to AAC or WMA. The encoded quality level video is wrapped in an MP4 container with a *.ismv or *.isma file extension.

During the encoding process, XML manifest files are also generated. An *.ism file is generated for use by the server in describing the available bitrates while a *.ismc file is used by the client to inform it of available bit rates and other information required in presenting the content. One such piece of information is the chunk duration.

Unlike HLS, Microsoft’s Smooth Streaming doesn’t encode the individual qualities into a series of chunks. Instead, the server cuts the full content into chunks as it’s being delivered. This requires a specially set up server using Microsoft’s Internet Information Services (IIS).

For more information regarding the setup of IIS Servers and MSS manifest formatting see Microsoft’s guide on Getting Started with IIS Smooth Streaming and Smooth Streaming Deployment guides.

Summary:

  • Manifest: XML file with *.ism/ismc file extension
  • Video: VC-1 or H.264
  • Audio: AAC or WMA
  • Container: MP4 (with *.ismv/isma file extension)
  • Server: IIS (Internet Information Services) server
  • Additional: Only quality files are stored but server virtually splits them up into chunks at playback

HDS

HDS stands for HTTP Dynamic Streaming and was developed by Adobe to serve its Flash platform.  The BBC uses this protocol for its desktop browser presentations using the BBC Standard Media Player (SMP) which implements the Flash playback client.  Adobe has published the HDS protocol to register developers.  It is a more complex protocol and is harder than HLS to implement.

MPEG Dynamic Adaptive Streaming over HTTP (DASH)

MPEG-DASH stands for Motion Pictures Expert Group Dynamic Adaptive Streaming over HTTP.  This is a new completely open source protocol that is just starting to be adopted by content producers and client implementations.  It has the simplicity of HLS whilst being free of additional licencing other than that required by the codecs.

Unlike, HLS, HDS and Smooth Streaming, DASH is codec-agnostic.
DASH is audio/video codec agnostic. One or more representations (i.e., versions at different resolutions or bit rates) of multimedia files are typically available, and selection can be made based on network conditions, device capabilities and user preferences, enabling adaptive bitrate streaming[10] and QoE (Quality of Experience) fairness.

Summary:

  • Manifest: Media Presentation Description (MPD)
  • Video: Codec agnostic
  • Audio: Codec agnostic
  • Container MP4 or MPEG-2

MPEG DASH is the result of a collaborative effort from some of the biggest players (ie. Adobe, Apple, and Microsoft) of adaptive bitrate streaming. From a bird’s eye view it functions similarly to the technologies previously described, but differs in the details of its delivery to end users.

In DASH, the entirety of an available stream, made up of a media portion and a metadata manifest, is known as a Media Presentation. The manifest portion of this is called a Media Presentation Description (MPD). Much like an M3U8 or Smooth Streaming manifest, an MPD contains metadata for the media available.

The media portion of a presentation is made up of different quality levels of the same media. Each quality level is known as a Period. A period is a set of time-aligned contents (audio, video, captions, etc.) which form one entire viewing of the content at a single quality level. Each period consists of a collection of different media forms, each known as an Adaptation. So a period may consist of a separate video adaptation and audio adaptation. Each encoding of a particular adaptation is known as a Representation. Each representation is split into short chunks, dubbed segments. Using the terminology at hand, the entire stream consists of a set of periods where each period will typically contain a representation of each type of adaptation being delivered to a user in the presentation. Adaptive playback is facilitated appropriate quality as segments are downloaded as playback is taking place and connection speed is being monitored.

As confusing as that may have been to sort out, there is a significant theoretical advantage to this approach of different adaptations to build up a period versus the approaches previously described for MSS and HLS. This advantage is the codec agnostic nature of DASH. The media is served in either an MP4 or MPEG-2 container using whatever video and audio formats and the onus is put on players to be able to decode and render the video/audio/captions/etc. This eases up effort for content creators and distributors to prepare their content for adaptive streaming and also removes a lot of restrictions associated with proprietary solutions. That includes the IIS server set up for MSS and the proprietary encoding software for HLS.

However, this large scope of supported codecs does make for more complex player development. Communities have banded together to provide a plethora of player framework options for developing for DASH on a variety of platforms and for an assortment codecs. These frameworks vary in their supported platforms and features so a good amount investigation must be done in advance to find the right fit for the feature requirements of the player as well as the platform.

This is where subscribing to MPEG DASH as a solution may become problematic on more obscure platforms, and even on some of the more popular ones. This means MPEG DASH is not yet the answer to the segregation issue that exists with adaptive bitrate streaming.

hls_pro_con.png

DASH_pro_con.png

AdaptiveBitrateComparison

 

Sample data flow of MS video streaming service

streaming-diagram

Ref.:

http://iplayerhelp.external.bbc.co.uk/radio/other/streaming_hls_hds_mpeg

http://www.digiflare.com/adaptive-media-streaming-hls-vs-mss-vs-dash/

https://www.sitepoint.com/html5-video-understanding-compression-drm/

http://streaminglearningcenter.com/blogs/dash-or-hls-which-is-the-best-format-today.html

http://www.internetvideoarchive.com/documentation/video-api/progressive-download-vs-adaptive-bitrate/

https://bitmovin.com/mpeg-dash-vs-apple-hls-vs-microsoft-smooth-streaming-vs-adobe-hds/

https://en.wikipedia.org/wiki/Dynamic_Adaptive_Streaming_over_HTTP