Termux-packages: npm install sqlite3 fails

Created on 24 Jan 2019  路  1Comment  路  Source: termux/termux-packages

uname -a
Linux localhost 4.4.153-perf+ #1 SMP PREEMPT Tue Nov 27 21:51:29 CST 2018 aarch64 Android

using [email protected]
using [email protected]

had installed python2
had termux-fix-shebang on $PREFIX/bin/node-pre-gyp and $PREFIX/bin/node-gyp
had removed -pie from /data/data/com.termux/files/home/.node-gyp/11.7.0/include/node/common.gypi as #307

error:

/data/data/com.termux/files/usr/bin/aarch64-linux-android-ld: Release/obj.target/deps/sqlite3.a(sqlite3.o): in function `jsonEachColumn':
sqlite3.c:(.text+0x177730): dangerous relocation: unsupported relocation
/data/data/com.termux/files/usr/bin/aarch64-linux-android-ld: Release/obj.target/deps/sqlite3.a(sqlite3.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `sqlite3_free' which may bind externally can not be used when making a shared object; recompile with -fPIC
/data/data/com.termux/files/usr/bin/aarch64-linux-android-ld: sqlite3.c:(.text+0x1777e4): dangerous relocation: unsupported relocation
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [node_sqlite3.target.mk:147: Release/obj.target/node_sqlite3.node] Error 1
make: Leaving directory '/data/data/com.termux/files/usr/lib/node_modules/sqlite3/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:188:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Linux 4.4.153-perf+
gyp ERR! command "/data/data/com.termux/files/usr/bin/node" "/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/data/data/com.termux/files/usr/lib/node_modules/sqlite3/lib/binding/node-v67-android-arm64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/data/data/com.termux/files/usr/lib/node_modules/sqlite3/lib/binding/node-v67-android-arm64" "--napi_version=3" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v67"
gyp ERR! cwd /data/data/com.termux/files/usr/lib/node_modules/sqlite3
gyp ERR! node -v v11.7.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/data/data/com.termux/files/usr/bin/node /data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/data/data/com.termux/files/usr/lib/node_modules/sqlite3/lib/binding/node-v67-android-arm64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/data/data/com.termux/files/usr/lib/node_modules/sqlite3/lib/binding/node-v67-android-arm64 --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v67' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/data/data/com.termux/files/usr/lib/node_modules/sqlite3/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:188:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:978:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
node-pre-gyp ERR! System Linux 4.4.153-perf+
node-pre-gyp ERR! command "/data/data/com.termux/files/usr/bin/node" "/data/data/com.termux/files/usr/lib/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /data/data/com.termux/files/usr/lib/node_modules/sqlite3
node-pre-gyp ERR! node -v v11.7.0
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
Failed to execute '/data/data/com.termux/files/usr/bin/node /data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/data/data/com.termux/files/usr/lib/node_modules/sqlite3/lib/binding/node-v67-android-arm64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/data/data/com.termux/files/usr/lib/node_modules/sqlite3/lib/binding/node-v67-android-arm64 --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v67' (1)
npm verb lifecycle [email protected]~install: unsafe-perm in lifecycle true
npm verb lifecycle [email protected]~install: PATH: /data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/data/data/com.termux/files/usr/lib/node_modules/sqlite3/node_modules/.bin:/data/data/com.termux/files/usr/lib/node_modules/.bin:/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets
npm verb lifecycle [email protected]~install: CWD: /data/data/com.termux/files/usr/lib/node_modules/sqlite3
npm info lifecycle [email protected]~install: Failed to exec install script
npm timing action:install Completed in 156338ms
npm verb unlock done using /data/data/com.termux/files/home/.npm/_locks/staging-a3e96e1db80e25cf.lock for /data/data/com.termux/files/usr/lib/node_modules/.staging
npm timing stage:rollbackFailedOptional Completed in 394ms
npm timing stage:runTopLevelLifecycles Completed in 171628ms
npm verb stack Error: [email protected] install: `node-pre-gyp install --fallback-to-build`
npm verb stack Exit status 1
npm verb stack     at EventEmitter.<anonymous> (/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
npm verb stack     at EventEmitter.emit (events.js:188:13)
npm verb stack     at ChildProcess.<anonymous> (/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
npm verb stack     at ChildProcess.emit (events.js:188:13)
npm verb stack     at maybeClose (internal/child_process.js:978:16)
npm verb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
npm verb pkgid [email protected]
npm verb cwd /storage/25BF-1012/Android/data/com.termux/files/workspace/simi-red/.node-red
npm verb Linux 4.4.153-perf+
npm verb argv "/data/data/com.termux/files/usr/bin/node" "/data/data/com.termux/files/usr/bin/npm" "i" "-g" "sqlite3" "--unsafe-perm" "--verbose"
npm verb node v11.7.0
npm verb npm  v6.6.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm verb exit [ 1, true ]
npm timing npm Completed in 172729ms

Most helpful comment

Your log says near the top:

[..] bind externally can not be used when making a shared object; recompile with -fPIC

So I tried installing with CPPFLAGS="$CPPFLAGS -fPIC" npm install --build-from-source sqlite3 and that seems to work.

>All comments

Your log says near the top:

[..] bind externally can not be used when making a shared object; recompile with -fPIC

So I tried installing with CPPFLAGS="$CPPFLAGS -fPIC" npm install --build-from-source sqlite3 and that seems to work.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

loveablefellow007 picture loveablefellow007  路  3Comments

tigran123 picture tigran123  路  3Comments

bbtdev picture bbtdev  路  3Comments

ILadis picture ILadis  路  3Comments

am11 picture am11  路  3Comments