-
Notifications
You must be signed in to change notification settings - Fork 281
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
How *is* the official Linux binary built? #1073
Comments
I'm reasonably sure it's a debian wheezy box with g++ 4.8 from debian-backports. It's linking against wheezy's libstdc++. Caveat emptor: we're pretty sure that won't be workable going forward, see nodejs/build#1087, but for now that should be enough to get you up and running. |
Thanks for the quick reply.
g++ 4.8? In that case, why the documented requirement for 4.9.4 ? Futureproofing? |
Oh, it was probably 4.8 for node 6 and 7, not 8 and 9. (I even authored that change in BUILDING.md...) |
Have you tried devtoolset? |
OK... I set up a Debian Wheezy box (7.11, the last version of Wheezy / 7). I had no success with the default GCC/G++ that comes from the standard repo for that version, which is not surprising because it's GCC/G++ 4.7.2. I couldn't find any GCC or G++ in the wheezy-backports repo, or the backports repos for any of the newer Debians. However, the main repo for jessie has GCC and G++ 4.9. I installed this by hacking the apt sources.list file to point at the jessie repos (I think this is going to be a very disposable VM). I was able to build node with this. But the executable does not run on a standard RHEL 6, or RHEL 7 for that matter. It's linked at build time to the libstdc++ from GCC 4.9.2, and that's newer than the the base library versions of both of those RH releases. I'm intrigued by your comment that 'it's linking against wheezy's libstdc++'. Do you mean that you are making g++ link against an older version of the library than the one that is built with the compiler? How? (I also took a look at the discussion in the other thread you linked to. This is a problem right now - keeping the compiler new enough to build modern code but old enough to target systems that are still widely used and supported). |
It picks up the system libstdc++ automatically. See https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html - libstdc++ releases are forward and backward-compatible to a high degree. By the way, it seems I remembered right about the wheezy box using g++ 4.8. We're starting to hit its limits now, it's making V8 upgrades problematic. |
I was able to build my Node add-on using GCC 4.9 from the devtoolset for CentOS and produce binaries that are compatible with the 'base' runtime libraries on RHEL 6 / CentOS 6. So many thanks to @kasicka for that suggestion - I hadn't really looked at devtoolset before, but it's a very useful package. (@bnoordhuis: I still have no idea how to get this to build on Debian wheezy with the newer compiler in such are way that it targets the old runtimes, as you suggested, and I've tried a few approaches. But I don't need to do that now. Regarding your issues with V8 updates: perhaps a switch to CentOS and the devtoolset might be worth considering?) |
@dtopham75 - is this still outstanding? |
inactive, closing |
First: I'm aware there was a recent question (#1039) along very similar lines. The answers there were certainly informative and provided some useful insight, but didn't completely answer my question, so I'm asking anyway. (The poster of that question was also working on a very old Fedora, which I'm glad to say I'm not).
The 64-bit Linux binary distribution of Node 8.9.4 (https://nodejs.org/dist/v8.9.4/node-v8.9.4-linux-x64.tar.xz) runs on a RHEL 6 with no modifications. It does not, as far as I can see, ship with any C or C++ runtime libraries and appears to be dynamically linked.
The base GCC/G++ version for RHEL 6 (by which I mean the one you get from the base RH repos with yum installl gcc gcc-c++) is GCC 4.4.7. The base libgcc and libstdc++ libraries are also from GCC 4.4.7.
That version of GCC/G++ is too old to build Node now, which requires GCC/G++ 4.9.4 or later (https://github.com/nodejs/node/blob/master/BUILDING.md#building-nodejs-on-supported-platforms). I assume this is for C++11 support.
So.... if I build GCC 4.9.4 from source on my RHEL server, I have v4.9.4 of gcc and g++, and also the 4.9.4 versions of libgcc and libstdc++, which are built as part of the GCC build process.
I can use this version of the compilers to build Node 8.9.4 from source. BUT, the node binary resulting from that build (and the various dependencies) has been linked against the GCC/G++ 4.9.4 runtimes, as I would expect. If I try to run that node binary on a clean RHEL 6 server that only has the standard runtimes (from GCC / G++ 4.4.7), it won't run - it's looking for the newer runtime libraries with the newer ABI version.
As noted above, this is not the case with the official distribution.
Thanks to the previous article, I'm aware of the --fully-static and --partly-static options for the node configure script. But it doesn't seem that the official distribution has been built this way. The make binary rule in the node makefile doesn't specify either of these, and in any case ldd node shows that it is dynamically linked to the runtimes.
So, the real questions are:
What platform is the official Linux distribution built on?
How do you build it with GCC/G++ 4.9.4 (or whatever) but get it to link to the older C/C++ runtimes in such a way that it works on RHEL 6?
The reason for the questions: I'm trying to build a Node C++ add-on, and I have the same problem. I can't build it against G++4.9.4 in such a way that it will run with the base runtimes on RHEL 6. And I can't use an older compiler because of the C++11 code in the v8 headers.
Thanks in anticipation.
The text was updated successfully, but these errors were encountered: