addaleax / lzma-native

Node.js interface to the native liblzma compression library (.xz file format, among others)
MIT License
105 stars 37 forks source link

"version `CXXABI_1.3.8' not found" on Amazon Linux with Node 12 #93

Open rchampeimont opened 4 years ago

rchampeimont commented 4 years ago

After upgrading to Node 12 on my Amazon Linux server, I get this error when trying to load lzma-native:

$ node
Welcome to Node.js v12.18.2.
Type ".help" for more information.
> require('lzma-native')
Uncaught:
Error: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /home/ec2-user/test/nodejs-doctrine-test/node_modules/lzma-native/binding-v6.0.1-n-api-linux-x64/lzma_native.node)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1188:18)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at /home/ec2-user/test/nodejs-doctrine-test/node_modules/lzma-native/index.js:13:14
>

It seems that this is because the binary package is built with a more recent C++ ABI than the one with Amazon Linux:

$ strings /usr/lib64/libstdc++.so.6 |grep CXXABI
CXXABI_1.3
CXXABI_1.3.1
CXXABI_1.3.2
CXXABI_1.3.3
CXXABI_1.3.4
CXXABI_1.3.5
CXXABI_1.3.6
CXXABI_1.3.7
CXXABI_TM_1

I am using lzma-native 6.0.1, Node.js v12.18.2 on Amazon Linux AMI 2018.03.

It is possible to temporarily work around the issue by running npm rebuild lzma-native --build-from-source after npm install in my build process but of course this is kind of a hack.

Is there any better way to fix this for me? A way to fix it on your side?

addaleax commented 4 years ago

Hm yeah, not sure what to do about this – the prebuilt binaries are built on Travis CI, so that’s where the ABI requirement comes from. I’m not sure if there’s a way to request a lower built target value? Other than that, building from source when installing seems like a fair workaround …

rchampeimont commented 4 years ago

Thanks for you fast answer! Do you know if there a way to specify "permanently" that I always want to install lzma-native from source? like in package.json/npmrc or anything I could checkout in my own project repo?

addaleax commented 4 years ago

@raphaelchampeimont Sorry, I’m not aware of anything like that … :/

baparham commented 3 years ago

@raphaelchampeimont I've had success with this same issue by specifying --build-from-source=lzma-native when running npm install or npm rebuild to have it recompile (and more importantly, re-link) lzma using node-gyp against my current toolchain and libstdc++ library version. You'll need the prereqs outline on node-gyp's site though: https://github.com/nodejs/node-gyp