Open marsbible opened 6 years ago
Hi, @marsbible ,
Did you use the nodejs-mobile released headers, too?
Regarding dlopen
, there are some differences between Android and Linux, described in this issue: https://github.com/android-ndk/ndk/issues/201#issuecomment-248060092
Basically, the android shared library has to be linked to libnode for the symbols to be found at runtime. In the experimental native module support feature for the plugins we add this to the nodejs-mobile headers' common.gypi
so gyp does the linking: https://github.com/janeasystems/nodejs-mobile-react-native/blob/05e1748831bca8b8f053dcf80a348f3dc782596c/android/libnode/include/node/common.gypi#L412-L433
In the plugins, we use environment variables while running the build to make sure the nodejs-mobile headers from the plugin are used: https://github.com/janeasystems/nodejs-mobile-react-native/blob/05e1748831bca8b8f053dcf80a348f3dc782596c/android/build.gradle#L294
I hope this is helpful in helping you solve your problem.
@jaimecbernardo Thank you very much, your info is very helpful, i'll have a try.
Hi all, I just built a native C++ addon by NDK r16b, target arch is arm64,it seems that nodejs-mobile doesn't exports symbols to the C++ module, dlopen() failed due to the symbol miss. Any solution or workaround ? Thanks.
buffertools.tar.gz
05-16 11:27:02.812 28954-28984/com.yourorg.sample E/NODEJS-MOBILE: /data/data/com.yourorg.sample/files/nodejs-project/node_modules/buffertools/buffertools.js:26 if (e.code !== 'MODULE_NOT_FOUND') throw e; ^