Error: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27'

joe.kovalski picture joe.kovalski · Feb 10, 2019 · Viewed 32.1k times · Source

I am building my node module (using N-API) both for Mac (10.9+) and Linux (Ubuntu 18). When I am deploying my module to remote machine (to Heroku), I am getting:

Error: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by /opt/atlassian/pipelines/agent/build/addons/Release-linux/module.node)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:717:18)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    (...)

Running ldd --version on both machines:

~ $ ldd --version
ldd (Ubuntu GLIBC 2.27-3ubuntu1) 2.27

and:

~ $ ls /lib/x86_64-linux-gnu/
libm.so.6 (...)

Also, I am not sure why linking to libm is necessary, as I am not using #include <math.h> within my code (compiler is adding libm implicitly?).

Any help would be appreciated.

Answer

Florian Weimer picture Florian Weimer · Feb 10, 2019

You need to deploy into an operation system that is compatible with your build environment. Usually, this means to use the same distribution version. In some cases, it is also possible to deploy on a newer version of the same distribution.

Your version of Ubuntu uses glibc 2.27. Your deployment target uses something earlier, presumably either Heroku-16 or Cedar-14, since you said you are trying to deploy on Heroku. You either have to rebuild your software in a matching build environment (for example, using pbuilder, or using a virtual machine), or deploy into something that is compatible with your version of Ubuntu (presumably, Heroku-18).