-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
potential node-gyp options parsing issue when building native modules #2
Comments
From @gmaclennan :
|
Looks like that bug was introduced in npm 7: npm/run-script#23 guess the short-term solution is to use npm 6 for now... |
using npm 6 seems to move past the original issue. now running into this one: The following command is run: c++ '-DNODE_GYP_MODULE_NAME=better_sqlite3' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DBUILDING_NODE_EXTENSION' '-D_GLIBCXX_USE_C99_MATH' '-DNDEBUG' -I/Users/andrewchou/GitHub/digidem/mapeo-mobile-next/node_modules/nodejs-mobile-react-native/android/libnode/include/node -I/Users/andrewchou/GitHub/digidem/mapeo-mobile-next/node_modules/nodejs-mobile-react-native/android/libnode/src -I/Users/andrewchou/GitHub/digidem/mapeo-mobile-next/node_modules/nodejs-mobile-react-native/android/libnode/deps/openssl/config -I/Users/andrewchou/GitHub/digidem/mapeo-mobile-next/node_modules/nodejs-mobile-react-native/android/libnode/deps/openssl/openssl/include -I/Users/andrewchou/GitHub/digidem/mapeo-mobile-next/node_modules/nodejs-mobile-react-native/android/libnode/deps/uv/include -I/Users/andrewchou/GitHub/digidem/mapeo-mobile-next/node_modules/nodejs-mobile-react-native/android/libnode/deps/zlib -I/Users/andrewchou/GitHub/digidem/mapeo-mobile-next/node_modules/nodejs-mobile-react-native/android/libnode/deps/v8/include -I./Release/obj/gen/sqlite3 -fPIC -Wall -Wextra -Wno-unused-parameter -std=c++14 -O3 -O3 -fno-omit-frame-pointer -fPIC -fno-rtti -fno-exceptions -std=gnu++1y -MMD -MF ./Release/.deps/Release/obj.target/better_sqlite3/src/better_sqlite3.o.d.raw -c -o Release/obj.target/better_sqlite3/src/better_sqlite3.o ../src/better_sqlite3.cpp Notice the UPDATE: This was due to an error in the script. It should be |
future note to self: nodejs-mobile-react-native v16.17.x attempts to handle the npm 7+ issue in a very fragile way by patching the |
Closing since no longer relevant |
Description:
For
better-sqlite3
, receive the following error when running../../scripts/rebuild-android.sh better-sqlite3 arm
:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: Release/obj.target/sqlite3/gen/sqlite3/sqlite3.o is not an object file (not allowed in a library)
In general, this process shouldn’t be using XCode’s libtool but instead should be using the libtool provided by the Android NDK.
Debugging
The outcomes of running
node-gyp rebuild --release
(armeabi-v7a
) are slightly different:Mobile via nodejs-mobile-react-native gradle config (Node 12, npm 6), which succeeds:
rm -f Release/obj.target/deps/sqlite3.a && /Users/andrewchou/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar crs Release/obj.target/deps/sqlite3.a Release/obj.target/sqlite3/gen/sqlite3/sqlite3.o
Mobile Next via
rebuild-android.sh
(Node 16, npm 8), which fails:rm -f Release/sqlite3.a && ./gyp-mac-tool filter-libtool libtool -static -o Release/sqlite3.a Release/obj.target/sqlite3/gen/sqlite3/sqlite3.o
There seems to be difference between how node-gyp flags and options are parsed between the projects. Whether it’s because of the difference in node+npm version or due to configuration errors in
rebuild-android.sh
is not yet clear.There's a chance that the
export npm_config_format="make-android"
is not being used by node-gyp for the mobile-next case, causing it to resort to usemac
as the buildflavor
and thus trying to use XCode's libtool. I tried settingGYP_GENERATORS=make-android
but that didn't seem to change anything. Wondering if maybe because--ignore-environment
needs to be passed to thenode-gyp
command somewhere in order to use it.Another thing to consider is maybe differences in the node-gyp implementation? Didn't dig deep into this but doesn't seem likely.
Useful links for
node-gyp
:--formats
flag (orGYP_GENERATORS
env variable): https://github.com/nodejs/node-gyp/blob/main/gyp/pylib/gyp/__init__.py#L75flavor
(e.g.mac
,linux
,android
, etc) is determined forGenerateOutput
function: https://github.com/nodejs/node-gyp/blob/main/gyp/pylib/gyp/generator/make.py#L2399GetFlavor
implmentation: https://github.com/nodejs/node-gyp/blob/main/gyp/pylib/gyp/common.py#L433GenerateOutput
function: https://github.com/nodejs/node-gyp/blob/main/gyp/pylib/gyp/generator/make.py#L2472-L2483The text was updated successfully, but these errors were encountered: