-
Notifications
You must be signed in to change notification settings - Fork 181
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
Error: dlopen failed: cannot locate symbol "_ZN2v814ObjectTemplate21SetInternalFieldCountEi" referenced by leveldown.node #159
Comments
It appears, based on https://code.janeasystems.com/nodejs-mobile/faq#are-nodejs-native-modules-supported and #121 native modules are only supported using nodejs-mobile-cordova and nodejs-mobile-native-react projects. I will try using cordova. |
Install cordova 7 using This following steps fail:
Later versions of gradle do not try to build mips version based on google/filament#15 (comment) To fix I updated the build tools gradle version to New error is that there is an old version of gradle, but the gradle distribution urls were edited. What can overwrite these and how do I update them? Updating the wrapper.properties again seems to work.
|
Task :BuildNpmModulesarmeabi-v7a fails with npm command. ~/git/janeasystems/nodejs-mobile-samples-one/cordova/UseNativeModules/platforms/android$ ./gradlew assembleDebug --stacktrace
|
Here's the debug of same. It's too many characters for a comment, so I've added a gist. ./gradlew assembleDebug --debug https://gist.github.com/algorist-mechanism/3e2195ad810f6efb5dfa1f7a03b8da6f#file-gistfile1-txt |
Here's build environment for same
|
So perhaps it's node and npm are not available to gradle. So it tried the following from
But I get the same error. |
Hi @algorist-mechanism , I have the same opinion: that gradle is unable to call npm on your machine. Perhaps it's because of the Building the native libraries for use in native applications is not currently supported. They currently have to be cross-compiled for Android. The gradle file in the plugins can be looked at to understand how this is achieved: https://github.com/janeasystems/nodejs-mobile-cordova/blob/be459ac4702a825a9254be03fc9448a5487436db/src/android/build.gradle#L206-L242 |
Hi @algorist-mechanism , @jaimecbernardo , I try pouchdb version 7.0.0 and I have the same issue: UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: dlopen failed: cannot locate symbol "napi_create_external" referenced by "/data/data/com.yourorg.sample/files/nodejs-project/node_modules/pouchdb/node_modules/leveldown/prebuilds/android-arm/node-napi.node"... Have you solved this problem? |
Hi @bavuvanet , For native modules, you'd need to rebuild them linking against the nodejs-mobile shared libraries, otherwise they won't be correctly link at runtime on Android. (more information in JaneaSystems/nodejs-mobile-gyp#4 ) A possible method of achieving this is implemented in the cordova and react-native plugins. |
i fix similar issue by copy older ndk files to current ndk folder older ndk from https://developer.android.com/ndk/downloads/older_releases This time i tried ndk 21, 20, 19, 18, 17, and 16. And only error message
steps to fix it:
|
v8.6.0
Linux ubuntu-pumpkin 4.4.0-141-generic forms ls #167-Ubuntu SMP Wed Dec 5 10:40:15 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Tried to use leveldown as a native module in android native-gradle-node-folder sample project.
Steps:
nvm use 8.6.0
git clone https://github.com/janeasystems/nodejs-mobile.git
cd nodejs-mobile
./android-configure <.../ndk-bundle/> arm64
NDK toolchain already exists. Replace it? [y/N]y
HOST_OS=linux
HOST_EXE=
HOST_ARCH=x86_64
HOST_TAG=linux-x86_64
HOST_NUM_CPUS=4
BUILD_NUM_CPUS=8
Toolchain installed to /home/user/git/janeasystems/nodejs-mobile/android-toolchain.
creating ./icu_config.gypi
{ 'target_defaults': { 'cflags': [],
'default_configuration': 'Release',
'defines': [],
'include_dirs': [],
'libraries': []},
'variables': { 'OS': 'android',
'asan': 0,
'coverage': 'false',
'debug_devtools': 'node',
'debug_http2': 'false',
'debug_nghttp2': 'false',
'force_dynamic_crt': 1,
'host_arch': 'arm64',
'icu_small': 'false',
'llvm_version': '7.0',
'node_byteorder': 'little',
'node_enable_d8': 'false',
'node_enable_v8_vtunejit': 'false',
'node_engine': 'v8',
'node_install_npm': 'true',
'node_module_version': 57,
'node_no_browser_globals': 'false',
'node_prefix': '/usr/local',
'node_release_urlbase': '',
'node_shared': 'true',
'node_shared_cares': 'false',
'node_shared_http_parser': 'false',
'node_shared_libuv': 'false',
'node_shared_openssl': 'false',
'node_shared_zlib': 'false',
'node_tag': '',
'node_use_bundled_v8': 'true',
'node_use_dtrace': 'false',
'node_use_etw': 'false',
'node_use_lttng': 'false',
'node_use_openssl': 'true',
'node_use_perfctr': 'false',
'node_use_v8_platform': 'true',
'node_without_node_options': 'false',
'openssl_fips': '',
'openssl_no_asm': 1,
'shlib_suffix': 'so',
'target_arch': 'arm64',
'v8_enable_gdbjit': 0,
'v8_enable_i18n_support': 0,
'v8_enable_inspector': 0,
'v8_no_strict_aliasing': 1,
'v8_optimized_debug': 0,
'v8_promise_internal_field_count': 1,
'v8_random_seed': 0,
'v8_trace_maps': 0,
'v8_use_snapshot': 'false',
'want_separate_host_toolset': 0}}
creating ./config.gypi
creating ./config.mk
npm config set arch=arm64
git clone https://github.com/janeasystems/nodejs-mobile-samples.git
download https://github.com/janeasystems/nodejs-mobile/releases/download/nodejs-mobile-v0.1.8/nodejs-mobile-v0.1.8-android.zip
extract and copy bin & include directories to ..git/janeasystems/nodejs-mobile-samples/android/native-gradle-node-folder/app/libnode
cd nodejs-mobile-samples/android/native-gradle-node-folder/app/src/main/assets/nodejs-project
create main.js with following:
var PouchDB = require('pouchdb');
var express = require('express');
var app = express();
app.use('/db', require('express-pouchdb')(PouchDB));
app.listen(3000);
create package.json with following:
{
"name": "test-app",
"version": "1",
"description": "node pouchdb",
"main": "main.js",
"dependencies": {
"express": "^4.16.3",
"express-pouchdb": "^4.1.0",
"nan": "^2.11.0",
"node-gyp": "^3.8.0",
"pouchdb": ">=7.0.0"
}
}
npm install --arch=arm64
pouchdb uses incorrect level and leveldown versions (corrected in 7.0.0-prerelease which isn't published to npm yet.)
cd node_modules/pouchdb
change in package.json
"dependencies": {
"level": "3.0.2", to "level": "4.0.0",
"leveldown": "3.0.0", to "leveldown": "4.0.1"
}
cd ../..
npm rebuild --arch=arm64
import janeasystems/nodejs-mobile-samples/android/native-gradle-node-folder as gradle project
build and debug on android 64 bit device
Note: app/build.gradle has following:
externalNativeBuild {
cmake {
cppFlags ""
arguments "-DANDROID_STL=c++_shared"
}
}
get the following error which looks like a missing c++_shared .so
2019-01-09 11:57:36.993 8137-8255/com.yourorg.sample E/NODEJS-MOBILE: /data/data/com.yourorg.sample/files/nodejs-project/node_modules/pouchdb/node_modules/bindings/bindings.js:91
throw e
^
The text was updated successfully, but these errors were encountered: