nodejs-mobile / nodejs-mobile-react-native

Node.js for Mobile Apps React Native plugin
https://nodejs-mobile.github.io
MIT License
174 stars 42 forks source link

sqlite3 fails to compile for Android arm64 #59

Closed lmarcelocc closed 11 months ago

lmarcelocc commented 11 months ago

Environment

MacOS Ventura 13.6.1 with a chip Apple M1. Node v18.18.2

Steps to reproduce

One of two: 1)

2)

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior? App should compile.

What do you see instead?

Log:

Click to expand > Configure project :nodejs-mobile-react-native /Users/marcelo/.nvm/versions/node/v18.18.2/bin/npm /Users/marcelo/.nvm/versions/node/v18.18.2/bin/node (omitted) > Task :nodejs-mobile-react-native:CopyNodeProjectAssetsarm64-v8a UP-TO-DATE > Task :nodejs-mobile-react-native:DeleteIncorrectPrebuildsarm64-v8a UP-TO-DATE > Task :nodejs-mobile-react-native:DetectCorrectPrebuildsarm64-v8a UP-TO-DATE > Task :nodejs-mobile-react-native:BuildNpmModulesarm64-v8a npm verb cli /Users/marcelo/.nvm/versions/node/v18.18.2/bin/node /Users/marcelo/.nvm/versions/node/v18.18.2/bin/npm npm info using npm@9.8.1 npm info using node@v18.18.2 npm verb title npm rebuild npm verb argv "--loglevel" "verbose" "--foreground-scripts" "rebuild" "--build-from-source" npm verb logfile logs-max:10 dir:/Users/marcelo/.npm/_logs/2023-11-14T13_55_56_125Z- npm verb logfile /Users/marcelo/.npm/_logs/2023-11-14T13_55_56_125Z-debug-0.log npm verb shrinkwrap failed to load node_modules/.package-lock.json out of date, updated: node_modules npm info run sqlite3@5.1.6 install node_modules/sqlite3 node-pre-gyp install --fallback-to-build > sqlite3@5.1.6 install > node-pre-gyp install --fallback-to-build node-pre-gyp info it worked if it ends with ok node-pre-gyp verb cli [ node-pre-gyp verb cli '/Users/marcelo/.nvm/versions/node/v18.18.2/bin/node', node-pre-gyp verb cli '/Users/marcelo/Desktop/AwesomeProject/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/.bin/node-pre-gyp', node-pre-gyp verb cli 'install', node-pre-gyp verb cli '--fallback-to-build' node-pre-gyp verb cli ] node-pre-gyp info using node-pre-gyp@1.0.11 node-pre-gyp info using node@18.18.2 | darwin | arm64 node-pre-gyp verb command install [ 'napi_build_version=6' ] node-pre-gyp info build requesting source compile node-pre-gyp verb command build [ 'rebuild', 'napi_build_version=6' ] gyp info it worked if it ends with ok gyp verb cli [ gyp verb cli '/Users/marcelo/.nvm/versions/node/v18.18.2/bin/node', gyp verb cli '/Users/marcelo/.nvm/versions/node/v18.18.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js', gyp verb cli 'clean' gyp verb cli ] gyp info using node-gyp@9.4.0 gyp info using node@18.18.2 | darwin | arm64 gyp verb command clean [] gyp verb clean removing "build" directory gyp info ok gyp info it worked if it ends with ok gyp verb cli [ gyp verb cli '/Users/marcelo/.nvm/versions/node/v18.18.2/bin/node', gyp verb cli '/Users/marcelo/.nvm/versions/node/v18.18.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js', gyp verb cli 'configure', gyp verb cli '--fallback-to-build', gyp verb cli '--module=/Users/marcelo/Desktop/AwesomeProject/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/sqlite3/lib/binding/napi-v6-platform-libc-arch/node_sqlite3.node', gyp verb cli '--module_name=node_sqlite3', gyp verb cli '--module_path=/Users/marcelo/Desktop/AwesomeProject/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/sqlite3/lib/binding/napi-v6-platform-libc-arch', gyp verb cli '--napi_version=9', gyp verb cli '--node_abi_napi=napi', gyp verb cli '--napi_build_version=6', gyp verb cli '--node_napi_label=napi-v6', gyp verb cli '--nodedir=/Users/marcelo/Desktop/AwesomeProject/node_modules/nodejs-mobile-react-native/android/libnode/' gyp verb cli ] gyp info using node-gyp@9.4.0 gyp info using node@18.18.2 | darwin | arm64 gyp verb command configure [] gyp verb find Python Python is not set from command line or npm configuration gyp verb find Python Python is not set from environment variable PYTHON gyp verb find Python checking if "python3" can be used gyp verb find Python - executing "python3" to get executable path gyp verb find Python - executable path is "/usr/local/opt/python@3.11/bin/python3.11" gyp verb find Python - executing "/usr/local/opt/python@3.11/bin/python3.11" to get version gyp verb find Python - version is "3.11.6" gyp info find Python using Python version 3.11.6 found at "/usr/local/opt/python@3.11/bin/python3.11" gyp verb get node dir compiling against specified --nodedir dev files: /Users/marcelo/Desktop/AwesomeProject/node_modules/nodejs-mobile-react-native/android/libnode/ gyp verb build dir attempting to create "build" dir: /Users/marcelo/Desktop/AwesomeProject/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/sqlite3/build gyp verb build dir "build" dir needed to be created? Yes gyp verb python symlink creating symlink to "/usr/local/opt/python@3.11/bin/python3.11" at "/Users/marcelo/Desktop/AwesomeProject/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/sqlite3/build/node_gyp_bins/python3" gyp verb build/config.gypi creating config file gyp verb build/config.gypi writing out config file: /Users/marcelo/Desktop/AwesomeProject/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/sqlite3/build/config.gypi gyp verb config.gypi checking for gypi file: /Users/marcelo/Desktop/AwesomeProject/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/sqlite3/config.gypi gyp verb common.gypi checking for gypi file: /Users/marcelo/Desktop/AwesomeProject/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/sqlite3/common.gypi gyp verb gyp gyp format was not specified; forcing "make" gyp info spawn /usr/local/opt/python@3.11/bin/python3.11 gyp info spawn args [ gyp info spawn args '/Users/marcelo/.nvm/versions/node/v18.18.2/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py', gyp info spawn args 'binding.gyp', gyp info spawn args '-f', gyp info spawn args 'make', gyp info spawn args '-I', gyp info spawn args '/Users/marcelo/Desktop/AwesomeProject/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/sqlite3/build/config.gypi', gyp info spawn args '-I', gyp info spawn args '/Users/marcelo/.nvm/versions/node/v18.18.2/lib/node_modules/npm/node_modules/node-gyp/addon.gypi', gyp info spawn args '-I', gyp info spawn args '/Users/marcelo/Desktop/AwesomeProject/node_modules/nodejs-mobile-react-native/android/libnode/include/node/common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args '-Dvisibility=default', gyp info spawn args '-Dnode_root_dir=/Users/marcelo/Desktop/AwesomeProject/node_modules/nodejs-mobile-react-native/android/libnode/', gyp info spawn args '-Dnode_gyp_dir=/Users/marcelo/.nvm/versions/node/v18.18.2/lib/node_modules/npm/node_modules/node-gyp', gyp info spawn args '-Dnode_lib_file=/Users/marcelo/Desktop/AwesomeProject/node_modules/nodejs-mobile-react-native/android/libnode/$(Configuration)/node.lib', gyp info spawn args '-Dmodule_root_dir=/Users/marcelo/Desktop/AwesomeProject/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/sqlite3', gyp info spawn args '-Dnode_engine=v8', gyp info spawn args '--depth=.', gyp info spawn args '--no-parallel', gyp info spawn args '--generator-output', gyp info spawn args 'build', gyp info spawn args '-Goutput_dir=.' gyp info spawn args ] gyp info ok gyp info it worked if it ends with ok gyp verb cli [ gyp verb cli '/Users/marcelo/.nvm/versions/node/v18.18.2/bin/node', gyp verb cli '/Users/marcelo/.nvm/versions/node/v18.18.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js', gyp verb cli 'build', gyp verb cli '--fallback-to-build', gyp verb cli '--module=/Users/marcelo/Desktop/AwesomeProject/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/sqlite3/lib/binding/napi-v6-platform-libc-arch/node_sqlite3.node', gyp verb cli '--module_name=node_sqlite3', gyp verb cli '--module_path=/Users/marcelo/Desktop/AwesomeProject/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/sqlite3/lib/binding/napi-v6-platform-libc-arch', gyp verb cli '--napi_version=9', gyp verb cli '--node_abi_napi=napi', gyp verb cli '--napi_build_version=6', gyp verb cli '--node_napi_label=napi-v6' gyp verb cli ] gyp info using node-gyp@9.4.0 gyp info using node@18.18.2 | darwin | arm64 gyp verb command build [] gyp verb build type Release gyp verb architecture arm64 gyp verb node dev dir /Users/marcelo/Desktop/AwesomeProject/node_modules/nodejs-mobile-react-native/android/libnode/ gyp verb `which` succeeded for `make` /usr/bin/make gyp verb bin symlinks adding symlinks (such as Python), at "/Users/marcelo/Desktop/AwesomeProject/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/sqlite3/build/node_gyp_bins", to PATH gyp info spawn make gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ] /Users/marcelo/Library/Android/sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android24-clang -o Release/obj.target/nothing/../node-addon-api/nothing.o ../../node-addon-api/nothing.c '-DNODE_GYP_MODULE_NAME=nothing' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_THREADS' '-DOPENSSL_NO_ASM' '-D_GLIBCXX_USE_C99_MATH' -I/Users/marcelo/Desktop/AwesomeProject/node_modules/nodejs-mobile-react-native/android/libnode/include/node -I/Users/marcelo/Desktop/AwesomeProject/node_modules/nodejs-mobile-react-native/android/libnode/src -I/Users/marcelo/Desktop/AwesomeProject/node_modules/nodejs-mobile-react-native/android/libnode/deps/openssl/config -I/Users/marcelo/Desktop/AwesomeProject/node_modules/nodejs-mobile-react-native/android/libnode/deps/openssl/openssl/include -I/Users/marcelo/Desktop/AwesomeProject/node_modules/nodejs-mobile-react-native/android/libnode/deps/uv/include -I/Users/marcelo/Desktop/AwesomeProject/node_modules/nodejs-mobile-react-native/android/libnode/deps/zlib -I/Users/marcelo/Desktop/AwesomeProject/node_modules/nodejs-mobile-react-native/android/libnode/deps/v8/include -fasm-blocks -mpascal-strings -O3 -gdwarf-2 -arch arm64 -MMD -MF ./Release/.deps/Release/obj.target/nothing/../node-addon-api/nothing.o.d.raw -c rm -f Release/nothing.a && ./gyp-mac-tool filter-libtool libtool -static -o Release/nothing.a Release/obj.target/nothing/../node-addon-api/nothing.o error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: Release/obj.target/nothing/../node-addon-api/nothing.o is not an object file (not allowed in a library) make: *** [Release/nothing.a] Error 1 gyp ERR! build error gyp ERR! stack Error: `make` failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/Users/marcelo/.nvm/versions/node/v18.18.2/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:203:23) gyp ERR! stack at ChildProcess.emit (node:events:517:28) gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:292:12) gyp ERR! System Darwin 22.6.0 gyp ERR! command "/Users/marcelo/.nvm/versions/node/v18.18.2/bin/node" "/Users/marcelo/.nvm/versions/node/v18.18.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/marcelo/Desktop/AwesomeProject/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/sqlite3/lib/binding/napi-v6-platform-libc-arch/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/Users/marcelo/Desktop/AwesomeProject/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/sqlite3/lib/binding/napi-v6-platform-libc-arch" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=6" "--node_napi_label=napi-v6" gyp ERR! cwd /Users/marcelo/Desktop/AwesomeProject/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/sqlite3 gyp ERR! node -v v18.18.2 gyp ERR! node-gyp -v v9.4.0 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute '/Users/marcelo/.nvm/versions/node/v18.18.2/bin/node /Users/marcelo/.nvm/versions/node/v18.18.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/marcelo/Desktop/AwesomeProject/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/sqlite3/lib/binding/napi-v6-platform-libc-arch/node_sqlite3.node --module_name=node_sqlite3 --module_path=/Users/marcelo/Desktop/AwesomeProject/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/sqlite3/lib/binding/napi-v6-platform-libc-arch --napi_version=9 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1) node-pre-gyp ERR! stack at ChildProcess. (/Users/marcelo/Desktop/AwesomeProject/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23) node-pre-gyp ERR! stack at ChildProcess.emit (node:events:517:28) node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1098:16) node-pre-gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:303:5) node-pre-gyp ERR! System Darwin 22.6.0 node-pre-gyp ERR! command "/Users/marcelo/.nvm/versions/node/v18.18.2/bin/node" "/Users/marcelo/Desktop/AwesomeProject/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" node-pre-gyp ERR! cwd /Users/marcelo/Desktop/AwesomeProject/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/sqlite3 node-pre-gyp ERR! node -v v18.18.2 node-pre-gyp ERR! node-pre-gyp -v v1.0.11 node-pre-gyp ERR! not ok Failed to execute '/Users/marcelo/.nvm/versions/node/v18.18.2/bin/node /Users/marcelo/.nvm/versions/node/v18.18.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/marcelo/Desktop/AwesomeProject/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/sqlite3/lib/binding/napi-v6-platform-libc-arch/node_sqlite3.node --module_name=node_sqlite3 --module_path=/Users/marcelo/Desktop/AwesomeProject/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/sqlite3/lib/binding/napi-v6-platform-libc-arch --napi_version=9 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1) npm info run sqlite3@5.1.6 install { code: 1, signal: null } npm verb stack Error: command failed npm verb stack at ChildProcess. (/Users/marcelo/.nvm/versions/node/v18.18.2/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:53:27) npm verb stack at ChildProcess.emit (node:events:517:28) npm verb stack at maybeClose (node:internal/child_process:1098:16) npm verb stack at ChildProcess._handle.onexit (node:internal/child_process:303:5) npm verb pkgid sqlite3@5.1.6 npm verb cwd /Users/marcelo/Desktop/AwesomeProject/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project npm verb Darwin 22.6.0 npm verb node v18.18.2 npm verb npm v9.8.1 npm ERR! code 1 npm ERR! path /Users/marcelo/Desktop/AwesomeProject/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-arm64-v8a/nodejs-project/node_modules/sqlite3 npm ERR! command failed npm ERR! command sh -c node-pre-gyp install --fallback-to-build npm verb exit 1 npm verb unfinished npm timer build 1699970156781 npm verb unfinished npm timer build:deps 1699970156781 npm verb unfinished npm timer build:run:install 1699970156788 npm verb unfinished npm timer build:run:install:node_modules/sqlite3 1699970156788 npm verb code 1 npm ERR! A complete log of this run can be found in: /Users/marcelo/.npm/_logs/2023-11-14T13_55_56_125Z-debug-0.log (omitted) BUILD FAILED in 3m 201 actionable tasks: 187 executed, 14 up-to-date

Thanks in advance for your time!

staltz commented 11 months ago

As we can see from these logs, the actual error is about sqlite3 (an native addon on npm) not correctly compiling for Android arm64.

Read these about native addons and sqlite3 support specificatlly:

lmarcelocc commented 11 months ago

Thanks!