Issue
This question is mostly related to node-gyp, GCC and the NDK toolchain, but I will add the full context because it may be necessary.
Context
I am building an App using React Native. Since I need to use node native libraries in this App, I am using this node module nodejs-mobile for running a Node.js process on Android and iOS.
When adding the composer-admin module, I am having compilation issues for Android.
Error
The compiler is failing when linking the grpc_node
module which is required by a composer-admin
dependency. The error is:
[LIB 1 PATH OMITTED] requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
...
[LIB N PATH OMITTED] requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
clang70++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [grpc_node.target.mk:189: Release/obj.target/grpc_node.node] Error 1
make: Leaving directory '/home/vanclief/Cacao_repos/react-app/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-armeabi-v7a/nodejs-project/node_modules/fabric-client/node_modules/grpc/build'
The weird thing is the -fPIC
flag is being used as specified in the common.gypi:
/home/vanclief/Cacao_repos/react-app/android/build/standalone-toolchains/arm-linux-androideabi/bin/arm-linux-androideabi-clang++ -shared -g -rdynamic -fPIC -Wl,-soname=grpc_node.node -o
This is the full compilation log
Solution
common.gypi is wrong. It has -fPIC
in ldflags. It needs to be in cflags.
Answered By - Dan Albert
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.