leveldown: dlopen failed: cannot locate symbol "_Unwind_Resume"

Hi! I’m trying to use leveldown on my Android device via Termux, but I’m bumping into this error. Any chance someone knows what this problem might be? I’m using leveldown 5.4.1 on a Google Pixel XL.

internal/modules/cjs/loader.js:1024
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: dlopen failed: cannot locate symbol "_Unwind_Resume" referenced by "/data/data/com.termux/files/home/.npm-global/lib/node_modules/@fraction/oasis/node_modules/leveldown/prebuilds/android-arm64/node.napi.armv8.node"...
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1024:18)
    at Module.load (internal/modules/cjs/loader.js:813:32)
    at Function.Module._load (internal/modules/cjs/loader.js:725:14)
    at Module.require (internal/modules/cjs/loader.js:850:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at load (/data/data/com.termux/files/home/.npm-global/lib/node_modules/@fraction/oasis/node_modules/leveldown/node_modules/node-gyp-build/index.js:20:10)
    at Object.<anonymous> (/data/data/com.termux/files/home/.npm-global/lib/node_modules/@fraction/oasis/node_modules/leveldown/binding.js:1:43)
    at Module._compile (internal/modules/cjs/loader.js:958:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:994:10)
    at Module.load (internal/modules/cjs/loader.js:813:32)
$ npm version
{
  npm: '6.12.0',
  ares: '1.14.0',
  brotli: '1.0.7',
  cldr: '36.0',
  icu: '65.1',
  llhttp: '1.1.4',
  modules: '79',
  napi: '5',
  nghttp2: '1.39.2',
  node: '13.0.0',
  openssl: '1.1.1d',
  tz: '2019c',
  unicode: '12.1',
  uv: '1.32.0',
  v8: '7.8.279.17-node.14',
  zlib: '1.2.11'
}

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 34 (34 by maintainers)

Commits related to this issue

Most upvoted comments

$ ls
db  node.api.armv8.tar.gz  node_modules

!!! You did it. Thanks so much for all the work you’ve put into this issue.

What’s the difference between ccflags (where we have -fexceptions) and cflags! (where we have -fno-exceptions)?

The “!” means: exclude -fno-exceptions from cflags. So a correction: on both our binding.cc and leveldb files, exceptions are enabled.

A build without exceptions (compiled on prebuild/android-arm64): node.napi.armv8.tar.gz

To test, run the following commands in an empty directory:

npm i leveldown --ignore-scripts --no-save
curl -OL https://github.com/Level/leveldown/files/4238293/node.napi.armv8.tar.gz
tar -zxvf node.napi.armv8.tar.gz

# Make sure prebuilds are not loaded
rm -rf node_modules/leveldown/prebuilds

mkdir -p node_modules/leveldown/build/Release
mv node.napi.armv8.node node_modules/leveldown/build/Release/leveldown.node
node -e "require('leveldown')('db').open(console.log)"

Hmm, interesting. Maybe try pkg install nodejs to see if the problem is happening on Node 13? I was getting “Segmentation fault” on Node 12 and re-upgraded to Node 13. No core dump or anything useful, so the segfault could’ve been coming from anywhere.

@#$@#$% knows. We need to do some .gyp digging 🕺

When running npm install --verbose with Leveldown as a dependency, it seems that the node-gyp-build command prints the “dlopen failed” error and then tries compiling from source. If I have all of the build dependencies, it compiles from source, but if I don’t have the build dependencies then it leaves me with a Leveldown that crashes with the “dlopen failed” error when I start my project.

That is as expected: node-gyp-build checks if a suitable prebuild exists and then tries to load it (as a smoke test, if you will). If that fails, it falls back to compiling. But if compiling also fails, then you still only have the (broken) prebuild.

My new confusion is that if I try to npm install --verbose --only=prod in the Leveldown repository, it tries to build from source and then fails when port_posix.h tries to include Snappy and I get “‘snappy.h’ file not found”.

Snappy is a git submodule. You may have to git submodule update --init --recursive.