-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Change target GLIBC version #2317
Comments
gee, Node.js 6.9.1, we're reaching quite a bit into history here. Your problem is going to be that your gcc version is tied to your glibc version (and libc++). So your newer Ubuntu 20.04 compiler is producing binaries linked against newer glibc. There's no pleasant way to deal with this unfortunately. You could try and switch to clang and fiddle with that. But what I'd recommend doing is using Docker on your 20.04 machine to either compile on an older image with an older compiler and glibc version, or use Docker to run CentOS 7 (or Fedora, maybe, I'm not sure about that) and use whatever the latest devtoolset is that you can get on there and compile with that. The RHEL devtoolsets are hacked so that their gcc will compile against the glibc that's available on the base system (well, I think it statically compiles in some diffs, or something clever). This is how we make official Node.js binaries that support older systems. This table is your friend: https://en.wikipedia.org/wiki/GNU_C_Library#Version_history - find the minimum system you want to support and find an OS that has a glibc at least that old. You'll see that RHEL7 is on there with a glibc compatible with even Ubuntu 13.04! So if you manage to compile on CentOS7, then you end up with binaries that are very compatible with older systems. The further you push back the harder this process is, though. If I were you I'd work on getting a nice Docker container setup that will perform the compile for you and make a binary on exactly the system you want. Ubuntu 16.04 should be OK, but there are issues as you start to get to newer versions of Node.js that need a newer compiler, which brings in new challenges because if you upgrade the base compiler on Ubuntu (using the ubuntu-toolchain-r, for instance), then that brings in a newer version of glibc and libc++ than is on the base system so you lose out in your compatibility! So you need to find a sweet spot of not-too-complicated a setup and an old-enough glibc. If you know your target is always Ubuntu 16.04, then just try for a Docker container with that and see how you go. |
Thanks for the answer! I'll have to learn to use Docker then |
nw-gyp rebuild --production --runtime=node-webkit --target=0.29.1
The full error message I get when I try to do
require(printer)
is:And I can't really get a verbose output from this nwjs app, so this is all I've goto
The issue started happening when I upgraded the machine I compile on to Ubuntu 20. If my understanding is correct, the problem here is that it's getting compiled targeting GLIBC_2.28, but the PC it;s running on (Ubuntu 16) has an older version.
I've tried adding
--libs=flib-2.26
to the cflags in the binding.gyp file, but I got the following warning on compile time, and the error persisted:cc1plus: warning: command line option ‘-flibs=glib-2.26’ is valid for Modula-2 but not for C++
I see here they mention that Snap may be causing the issue, but I'm not using Snap. Also, I've found in many forums that upgrading/downgrading your system's GLIBC version is not recommended, as it is highly likely that you'll break something systemwide
So the question is: Is there any way to change the target GLIBC version to an older one, so that my module can run in older systems?
Any help will be appreciated!
The text was updated successfully, but these errors were encountered: