Skip to content

AIX: gcc upgrade requirement #925

Closed
Closed

Description

@gibfahn

As a result of nodejs/node#14785 and nodejs/help#784 we have discovered that a backwards incompatible change was made in libstdc++ AIX between gcc 4.8 and gcc 4.9. This means that the requirement for GCC 4.9.3 for Node 8 requires that we raise the minimum gcc/libstdc++ version for that platform. Ideally we should do this before Node 8 goes LTS, or stick with gcc 4.8.4 for 8.x.

AIX is a special case here, because it doesn't come with libstdc++ or gcc by default, so everyone running on the platform needs to install gcc in order to run Node. There are two places to get gcc versions, the AIX Toolbox and Bull Freeware. Currently the AIX toolbox only has GCC 6.3.0 available, and Bull Freeware has 7.2.0, 6.4.0, and 5.5.0 (and older minor versions).

It's worth noting at this point that gcc changed their versioning scheme after 4.9, so 4.10 became 5.0, and 4.11 became 6.0. So the gap between 4.9 and 7.0 is not as large as it seems.

Given that AIX users have to download gcc anyway, and given that they will have to update their gcc levels for this release, I think we should bump to a relatively new version (so they don't have to upgrade again for as long as possible). I'd suggest using 6.3.0, GCC 7 came out this year, so might be too new to move to.

Activity

  1. mhdawson commented on Oct 19, 2017

    @mhdawson
    Member

    We'll need to have both the existing version of gcc (to build older node versions) as well as the newer version and figure out how to make them co-exist.

    I'm +1 for going with 6.3.0

  2. seishun commented on Dec 1, 2017

    @seishun
    Contributor

    @gibfahn Any progress on this? Any way I can help?

    We'll need to have both the existing version of gcc (to build older node versions) as well as the newer version and figure out how to make them co-exist.

    Is it not possible to run node built with gcc 4.9 on AIX with gcc 4.8 installed?

  3. self-assigned this
    on Dec 1, 2017
  4. gibfahn commented on Dec 14, 2017

    @gibfahn
    MemberAuthor

    Is it not possible to run node built with gcc 4.9 on AIX with gcc 4.8 installed?

    Unfortunately not, you need the right version of libstdc++.

  5. seawatcher2011 commented on Feb 8, 2018

    @seawatcher2011

    I am receiving the same error on AIX 7.1 while while verifying node ibm-8.9.4.0-node-v8.9.4-aix-ppc64.bin installation. Is there now a fix for the problem? Thanks.

    oracle@stpisa02sa:/opt/freeware/lib/pthread/ppc64/ [] node --version
    exec(): 0509-036 Cannot load program node because of the following errors:
    0509-130 Symbol resolution failed for node because:
    0509-136 Symbol ZNKSt9type_infoeqERKS (number 359) is not exported from
    dependent module /opt/freeware/lib/pthread/ppc64/libstdc++.a[libstdc++.so.6].
    0509-192 Examine .loader section symbols with the
    'dump -Tv' command.

  6. gibfahn commented on Feb 8, 2018

    @gibfahn
    MemberAuthor

    @seawatcher2011 do you have gcc 4.8 installed? See nodejs/node#14785 for more info.

  7. seawatcher2011 commented on Feb 8, 2018

    @seawatcher2011

    @gibfahn - no, not gcc 4.8. I have gcc 6.3.0. What is the suggestion workaround? Deinstall gcc6.3.0 and install gcc 4.8?

    oracle@stpisa02sa:/opt/freeware/lib/pthread/ppc64/ []  gcc -v
    Using built-in specs.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=/opt/freeware/libexec/gcc/powerpc-ibm-aix7.1.0.0/6.3.0/lto-wrapper
    Target: powerpc-ibm-aix7.1.0.0
    Configured with: ../gcc-6.3.0/configure --prefix=/opt/freeware --mandir=/opt/freeware/man --infodir=/opt/freeware/info --with-local-prefix=/opt/freeware --with-as=/usr/bin/as --with-ld=/usr/bin/ld --enable-languages=c,c++,fortran,objc,obj-c++ --enable-version-specific-runtime-libs --disable-nls --enable-decimal-float=dpd --with-cloog=no --with-ppl=no --disable-libstdcxx-pch --enable-__cxa_atexit --host=powerpc-ibm-aix7.1.0.0
    Thread model: aix
    gcc version 6.3.0 (GCC)
    oracle@stpisa02sa:/opt/freeware/lib/pthread/ppc64/ [] lslpp -Lq | grep c++
      libstdc++                  6.3.0-1    C     R    GNU Standard C++ Library
    oracle@stpisa02sa:/opt/freeware/lib/pthread/ppc64/ []  lslpp -Lq | grep gcc
      gcc                        6.3.0-1    C     R    GNU Compiler Collection
      gcc-cpp                    6.3.0-1    C     R    The C Preprocessor (/bin/rpm)
      libgcc                     6.3.0-1    C     R    GCC version 6.3.0 shared
    
  8. gibfahn commented on Feb 11, 2018

    @gibfahn
    MemberAuthor

    @gibfahn - no, not gcc 4.8. I have gcc 6.3.0. What is the suggestion workaround? Deinstall gcc6.3.0 and install gcc 4.8?

    Unfortunately you will need 4.8. However you should be able to have them both installed side-by-side. I've heard this is possible but haven't confirmed it myself, that's in fact the point of this issue.

  9. gibfahn commented on Apr 12, 2018

    @gibfahn
    MemberAuthor

    I have now managed to get this working, but there was one pain point.

    On one machine I tested on I got this error persistently, implying that the LIBPATH wasn't being passed down to the g++ call.

      LD_LIBRARY_PATH=/home/gib/node/out/Release/lib.host:/home/gib/node/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../.; mkdir -p /home/gib/node/out/Release/obj/gen; python tools/js2c.py "/home/gib/node/out/Release/obj/gen/node_javascript.cc" lib/internal/bootstrap/loaders.js lib/internal/bootstrap/node.js lib/async_hooks.js lib/assert.js lib/buffer.js lib/child_process.js lib/console.js lib/constants.js lib/crypto.js lib/cluster.js lib/dgram.js lib/dns.js lib/domain.js lib/events.js lib/fs.js lib/fs/promises.js lib/http.js lib/http2.js lib/_http_agent.js lib/_http_client.js lib/_http_common.js lib/_http_incoming.js lib/_http_outgoing.js lib/_http_server.js lib/https.js lib/inspector.js lib/module.js lib/net.js lib/os.js lib/path.js lib/perf_hooks.js lib/process.js lib/punycode.js lib/querystring.js lib/readline.js lib/repl.js lib/stream.js lib/_stream_readable.js lib/_stream_writable.js lib/_stream_duplex.js lib/_stream_transform.js lib/_stream_passthrough.js lib/_stream_wrap.js lib/string_decoder.js lib/sys.js lib/timers.js lib/tls.js lib/_tls_common.js lib/_tls_wrap.js lib/tty.js lib/url.js lib/util.js lib/v8.js lib/vm.js lib/zlib.js lib/internal/async_hooks.js lib/internal/buffer.js lib/internal/cli_table.js lib/internal/child_process.js lib/internal/cluster/child.js lib/internal/cluster/master.js lib/internal/cluster/round_robin_handle.js lib/internal/cluster/shared_handle.js lib/internal/cluster/utils.js lib/internal/cluster/worker.js lib/internal/crypto/certificate.js lib/internal/crypto/cipher.js lib/internal/crypto/diffiehellman.js lib/internal/crypto/hash.js lib/internal/crypto/pbkdf2.js lib/internal/crypto/random.js lib/internal/crypto/sig.js lib/internal/crypto/util.js lib/internal/constants.js lib/internal/encoding.js lib/internal/errors.js lib/internal/freelist.js lib/internal/fs.js lib/internal/http.js lib/internal/inspector_async_hook.js lib/internal/linkedlist.js lib/internal/modules/cjs/helpers.js lib/internal/modules/cjs/loader.js lib/internal/modules/esm/loader.js lib/internal/modules/esm/create_dynamic_module.js lib/internal/modules/esm/default_resolve.js lib/internal/modules/esm/module_job.js lib/internal/modules/esm/module_map.js lib/internal/modules/esm/translators.js lib/internal/safe_globals.js lib/internal/net.js lib/internal/os.js lib/internal/process/esm_loader.js lib/internal/process/next_tick.js lib/internal/process/promises.js lib/internal/process/stdio.js lib/internal/process/warning.js lib/internal/process.js lib/internal/querystring.js lib/internal/process/write-coverage.js lib/internal/readline.js lib/internal/repl.js lib/internal/repl/await.js lib/internal/socket_list.js lib/internal/test/binding.js lib/internal/test/unicode.js lib/internal/timers.js lib/internal/tls.js lib/internal/trace_events_async_hooks.js lib/internal/tty.js lib/internal/url.js lib/internal/util.js lib/internal/util/comparisons.js lib/internal/util/inspector.js lib/internal/util/types.js lib/internal/http2/core.js lib/internal/http2/compat.js lib/internal/http2/util.js lib/internal/v8.js lib/internal/v8_prof_polyfill.js lib/internal/v8_prof_processor.js lib/internal/stream_base_commons.js lib/internal/vm/module.js lib/internal/streams/lazy_transform.js lib/internal/streams/async_iterator.js lib/internal/streams/buffer_list.js lib/internal/streams/duplexpair.js lib/internal/streams/legacy.js lib/internal/streams/destroy.js lib/internal/streams/state.js lib/internal/wrap_js_stream.js deps/v8/tools/splaytree.js deps/v8/tools/codemap.js deps/v8/tools/consarray.js deps/v8/tools/csvparser.js deps/v8/tools/profile.js deps/v8/tools/profile_view.js deps/v8/tools/logreader.js deps/v8/tools/arguments.js deps/v8/tools/tickprocessor.js deps/v8/tools/SourceMap.js deps/v8/tools/tickprocessor-driver.js deps/node-inspect/lib/_inspect.js deps/node-inspect/lib/internal/inspect_client.js deps/node-inspect/lib/internal/inspect_repl.js deps/acorn/dist/acorn.js deps/acorn/dist/walk.js ./config.gypi tools/check_macros.py src/notrace_macros.py src/noperfctr_macros.py tools/nodcheck_macros.py
      touch e54431f42526df1774c55ade864265c11db54855.intermediate
      LD_LIBRARY_PATH=/home/gib/node/out/Release/lib.host:/home/gib/node/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../deps/v8/gypfiles; mkdir -p /home/gib/node/out/Release/obj/gen/src/inspector/protocol /home/gib/node/out/Release/obj/gen/include/inspector; python ../third_party/inspector_protocol/CodeGenerator.py --jinja_dir ../third_party --output_base "/home/gib/node/out/Release/obj/gen/src/inspector" --config ../src/inspector/inspector_protocol_config.json
      /home/gib/tmp/gcc-6.3.0-1/opt/freeware/bin/g++ '-DU_COMMON_IMPLEMENTATION=1' '-DU_ATTRIBUTE_DEPRECATED=' '-D_CRT_SECURE_NO_DEPRECATE=' '-DU_STATIC_IMPLEMENTATION=1' '-DUCONFIG_NO_SERVICE=1' '-DUCONFIG_NO_REGULAR_EXPRESSIONS=1' '-DU_ENABLE_DYLOAD=0' '-DU_HAVE_STD_STRING=1' '-DUCONFIG_NO_BREAK_ITERATION=0' -I../deps/icu-small/source/common  -pthread -Wall -Wextra -Wno-unused-parameter -maix64 -Wno-deprecated-declarations -O3 -fno-omit-frame-pointer -fno-exceptions -std=gnu++1y -frtti -MMD -MF /home/gib/node/out/Release/.deps//home/gib/node/out/Release/obj.target/icuucx/deps/icu-small/source/common/appendable.o.d.raw   -c -o /home/gib/node/out/Release/obj.target/icuucx/deps/icu-small/source/common/appendable.o ../deps/icu-small/source/common/appendable.cpp
    exec(): 0509-036 Cannot load program /home/gib/tmp/gcc-6.3.0-1/opt/freeware/bin/../libexec/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/cc1plus because of the following errors:
    	0509-150   Dependent module /opt/freeware/lib/libmpc.a(libmpc.so.3) could not be loaded.
    	0509-152   Member libmpc.so.3 is not found in archive 
    gmake[1]: *** [/home/gib/node/out/Release/obj.target/icuucx/deps/icu-small/source/common/appendable.o] Error 1
    gmake[1]: Leaving directory `/home/gib/node/out'
    gmake: *** [node] Error 2
    

    With @refack's help I eventually tracked this down to this mailing list discussion:
    https://lists.gnu.org/archive/html/bug-make/2001-03/msg00067.html

    $ ls -l `which gmake`
    lrwxrwxrwx    1 root     system           27 Jul 25 2013  /usr/bin/gmake -> ../../opt/freeware/bin/make
                                                                                     
    $ ls -l /opt/freeware/bin/make
    -rwxr-sr-x    1 root     system       280288 Sep 22 2011  /opt/freeware/bin/make

    Running sudo chmod 755 /opt/freeware/bin/make did indeed resolve the issue.

    The setuid bit is not set in the test or release machines (although it was on the machine I was using to test).

  10. gibfahn commented on Apr 13, 2018

    @gibfahn
    MemberAuthor

    @seawatcher2011 your mileage may vary, but what worked for me is to extract the contents of the libstdc++ rpm into a directory, then set the LIBPATH to point to that directory.

    I used rpm2cpio to extract the rpm, which isn't available on AIX (I got it from a RHEL box, but I think it's available on Ubuntu).

    So first you need to download the rpm from wherever you got gcc from, either AIX Toolbox or Bull Freeware. Either should work, but you can't mix and match.

    AIX Toolbox: ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc-6.1/gcc/libstdcplusplus-4.8.5-1.aix6.1.ppc.rpm
    Bull Freeware: I can't get a direct link, but for AIX 6.1 the file is libstdc++-4.8.4-6.aix6.1.ppc.rpm

    You extract the file (on a different machine) with:

    rpm2cpio libstdcplusplus-4.8.5-1.aix6.1.ppc.rpm | cpio -idmv

    Then zip it up and scp it to the machine. Unzip it, and then add the opt/freeware/lib/pthread/ppc64 subdirectory to your LIBPATH

    export LIBPATH="$PWD/opt/freeware/lib/pthread/ppc64:$LIBPATH"

    You should then be able to do ldd ./node and ./node and it should all work.

    Note that Node 10 is expected to be built with gcc 6.3, so you won't need this workaround once you upgrade to that version.

    For info, the reason this is necessary is because there was a breaking change in libstdc++ on AIX between gcc 4.8 and 4.9.

    Let me know if it works!

  11. gibfahn commented on Apr 13, 2018

    @gibfahn
    MemberAuthor

    I have generated a zip file containing gcc and dependencies, by downloading the zip from Bull Freeware. For some reason the dependency resolver on Bull Freeware downloaded the wrong version of libstdc++ (7.1 instead of 6.1) so I had to manually fix up the with-deps zip.

    #!/bin/bash -ex
    
    # Builds a zip file containing gcc and dependencies, installed from Bull Freeware rpms.
    
    
    rm -rf rpms gcc-6.3.0-1
    rm -f gcc-6.3.0-1.zip
    mkdir rpms gcc-6.3.0-1
    
    cp gcc-c++-6.3.0-1.aix6.1.ppc.rpm-with-deps.zip rpms
    (cd rpms && unzip gcc-c++-6.3.0-1.aix6.1.ppc.rpm-with-deps.zip)
    
    for rpm in rpms/*.rpm; do
      (cd gcc-6.3.0-1 && rpm2cpio ../$rpm | cpio -idmv)
    done
    
    zip -r gcc-6.3.0-1.zip gcc-6.3.0-1/

    Once you have the zip on the system, it's just a matter of unzipping it somewhere, and then setting up the paths correctly, so:

    # Setting the LIBPATH doesn't seem to be necessary.
    # export LIBPATH="$PWD/gcc-6.3.0-1/opt/freeware/lib/pthread/ppc64:$PWD/gcc-6.3.0-1/opt/freeware/lib"
    export PATH="$PWD/gcc-6.3.0-1/opt/freeware/bin:$PATH"
    cd ~/node
    export CC=`which gcc` CXX=`which g++` CXX_host=`which g++`
    ./configure --dest-cpu=ppc64 && gmake -j4

    The version I generated is stored at https://ci.nodejs.org/downloads/aix/ (see #871 (comment)), there's a zip and an md5sum for checking that everything downloads correctly.

  12. gibfahn commented on Apr 13, 2018

    @gibfahn
    MemberAuthor

    I also ran with C++ 14 enabled to make sure that worked, by applying this diff:

    diff --git a/common.gypi b/common.gypi
    index 6d83d8a..dcbb2a0 100644
    --- a/common.gypi
    +++ b/common.gypi
    @@ -321,7 +321,7 @@
           }],
           [ 'OS in "linux freebsd openbsd solaris android aix cloudabi"', {
             'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ],
    -        'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++1y' ],
    +        'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++14' ],
             'ldflags': [ '-rdynamic' ],
             'target_conditions': [
               # The 1990s toolchain on SmartOS can't handle thin archives.
    
  13. seishun commented on Apr 13, 2018

    @seishun
    Contributor

    '-std=gnu++1y' and '-std=gnu++14' are synonyms.

  14. gibfahn commented on Apr 13, 2018

    @gibfahn
    MemberAuthor

    '-std=gnu++1y' and '-std=gnu++14' are synonyms.

    Ahh, so how would I enable gcc 14 features (to check that it works)? I want to get something that fails on 4.8.4 and passes on 6.3.0.

  15. 16 remaining items

  16. gibfahn commented on Apr 17, 2018

    @gibfahn
    MemberAuthor

    The net is that we use the libiconv.a that gmake needs as opposed to the one that comes from the bundle build for gcc.

    Do you know why the gmake on the test machines is different to the one on dal-pax?

  17. mhdawson commented on Apr 17, 2018

    @mhdawson
    Member

    No idea and in fact even copying over the gmake to the community machine did not help as I tried that first. It is different though based on the output from dump -H

  18. BethGriggs commented on Apr 19, 2018

    @BethGriggs
    Member

    @gibfahn, dal-pax is 6100-07, IIRC the community CI AIX machines (https://ci.nodejs.org/label/aix61-ppc64/) are both 6100-09. Maybe that is why we're seeing differences?

  19. mhdawson commented on Apr 19, 2018

    @mhdawson
    Member

    The upgrade has now been rolled out to test and release machines. Things seem to be building ok.
    Have a suggestion from AIX team on how to improve the config, will do that but likely after 10.x goes out.

  20. mhdawson commented on May 10, 2018

    @mhdawson
    Member

    We ran into one more problem. Turns out there were a few non-relative symbolic links and the process documented above resulted in those being missing in the deployed compilers.

    We've talked to the AIX teams about fixing them so they are relative and have fixed up the links on the community machines with:

    cp opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/libatomic.a opt/freeware/li
    b/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/ppc64/libatomic.a
    cp opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/libgcc_s.a opt/freeware/lib
    /gcc/powerpc-ibm-aix6.1.0.0/6.3.0/ppc64/libgcc_s.a
    cp opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/libstdc++.a opt/freeware/li
    b/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/ppc64/libstdc++.a
    cp opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/libsupc++.a opt/freeware/li
    b/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/ppc64/libsupc++.a
    
    cp opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/pthread/libatomic.a opt/fre
    eware/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/pthread/ppc64/libatomic.a
    cp opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/pthread/libgcc_s.a opt/free
    ware/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/pthread/ppc64/libgcc_s.a
    cp opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/pthread/libstdc++.a opt/fre
    eware/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/pthread/ppc64/libstdc++.a
    cp opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/pthread/libsupc++.a opt/fre
    eware/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/pthread/ppc64/libsupc++.a
    
    cp opt/freeware/lib/libmpc.a opt/freeware/lib64/libmpc.a
    cp opt/freeware/lib/libxml2.a opt/freeware/lib64/libxml2.a
    cp opt/freeware/lib/libz.a opt/freeware/lib64/libz.a
    

    The updated fixed binary is in the downloads directory on the ci machine as: V2-gcc-6.3.0-1.tar.gz

    The next step is to update the manual install steps for AIX.

  21. Trott commented on Apr 25, 2019

    @Trott
    Member

    This is almost a year inactive at this point. Is it still a thing or has this been addressed and can be closed? @mhdawson @nodejs/platform-aix

  22. sam-github commented on Apr 25, 2019

    @sam-github
    Contributor

    I think its still a thing. I've notes somewhere, I think we are still working on it, slowly. I'll check with @mhdawson again when he's back from vacation.

  23. mhdawson commented on Apr 26, 2019

    @mhdawson
    Member

    The remaining stuff I think is to update the manual install steps for AIX and then it can be closed.

  24. AshCripps commented on Nov 15, 2019

    @AshCripps
    Member

    @mhdawson is this the updated install steps you mentioned - https://github.com/nodejs/help/wiki/Installation#how-to-install-nodejs-via-binary-archive-on-aix.

    If so, can this issue be closed?

  25. mhdawson commented on Nov 21, 2019

    @mhdawson
    Member

    I'm ok with closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions