Skip to content

building nodejs from source partially used export CC, ... #26877

Closed

Description

@janemba

Hello,

I have two gcc versions installed. However, I'm building node 8.15.1 with gcc-5. To achieve this, I'm using environment variables with CC,CXX,AR,... It works but at some point environment variables are not used. I noticed it when building process is using mksnapshot.

below failed make step:

  g++-5 '-DV8_GYP_BUILD' '-DV8_TARGET_ARCH_X64' '-DENABLE_DISASSEMBLER' '-DV8_PROMISE_INTERNAL_FIELD_COUNT' '-Dv8_promise_internal_field_count' '-DV8_INTL_SUPPORT' '-DUCONFIG_NO_SERVICE=1' '-DUCONFIG_NO_REGULAR_EXPRESSIONS=1' '-DU_ENABLE_DYLOAD=0' '-DU_STATIC_IMPLEMENTATION=1' '-DU_HAVE_STD_STRING=0' '-DUCONFIG_NO_BREAK_ITERATION=0' -I../deps/v8 -I../. -I../deps/v8/include -I../deps/icu-small/source/i18n -I../deps/icu-small/source/common  -pthread -Wall -Wextra -Wno-unused-parameter -m64 -fno-strict-aliasing -m64 -fdata-sections -ffunction-sections -O3 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF /tmp/node-v8.15.1/out/Release/.deps//tmp/node-v8.15.1/out/Release/obj.target/mksnapshot/deps/v8/src/snapshot/mksnapshot.o.d.raw  -O2 -fPIC -c -o /tmp/node-v8.15.1/out/Release/obj.target/mksnapshot/deps/v8/src/snapshot/mksnapshot.o ../deps/v8/src/snapshot/mksnapshot.cc
  g++-5 -pthread -rdynamic -m64 -m64  -o /tmp/node-v8.15.1/out/Release/mksnapshot -Wl,--start-group /tmp/node-v8.15.1/out/Release/obj.target/mksnapshot/deps/v8/src/snapshot/mksnapshot.o /tmp/node-v8.15.1/out/Release/obj.target/deps/v8/src/libv8_base.a /tmp/node-v8.15.1/out/Release/obj.target/deps/v8/src/libv8_builtins_setup.a /tmp/node-v8.15.1/out/Release/obj.target/deps/v8/src/libv8_libbase.a /tmp/node-v8.15.1/out/Release/obj.target/deps/v8/src/libv8_libplatform.a /tmp/node-v8.15.1/out/Release/obj.target/deps/v8/src/libv8_nosnapshot.a /tmp/node-v8.15.1/out/Release/obj.target/tools/icu/libicui18n.a /tmp/node-v8.15.1/out/Release/obj.target/deps/v8/src/libv8_libsampler.a /tmp/node-v8.15.1/out/Release/obj.target/tools/icu/libicuucx.a /tmp/node-v8.15.1/out/Release/obj.target/tools/icu/libicudata.a /tmp/node-v8.15.1/out/Release/obj.target/tools/icu/libicustubdata.a /tmp/node-v8.15.1/out/Release/obj.target/deps/v8/src/libv8_builtins_generators.a -lz -lcrypto -lssl -ldl -lrt -Wl,--end-group
  LD_LIBRARY_PATH=/tmp/node-v8.15.1/out/Release/lib.host:/tmp/node-v8.15.1/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../deps/v8/src; mkdir -p /tmp/node-v8.15.1/out/Release/obj.target/v8_snapshot/geni; "/tmp/node-v8.15.1/out/Release/mksnapshot" --startup_src "/tmp/node-v8.15.1/out/Release/obj.target/v8_snapshot/geni/snapshot.cc" ""
/tmp/node-v8.15.1/out/Release/mksnapshot: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /tmp/node-v8.15.1/out/Release/mksnapshot)
make[1]: *** [/tmp/node-v8.15.1/out/Release/obj.target/v8_snapshot/geni/snapshot.cc] Error 1
rm 98682b60ad7e40c6592e0a7d2cd9f4fab62dbc00.intermediate
make[1]: Leaving directory `/tmp/node-v8.15.1/out'
make: *** [node] Error 2

So it seems, mksnapshot is not built using the gcc version I set with export.

Activity

  1. refack commented on Mar 23, 2019

    @refack
    Contributor

    I believe it's more subtle.

    g++-5 -pthread -rdynamic -m64 -m64 -o /tmp/node-v8.15.1/out/Release/mksnapshot

    This line would indicate mksnapshot is being linked using g++-5.

    /tmp/node-v8.15.1/out/Release/mksnapshot: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /tmp/node-v8.15.1/out/Release/mksnapshot)

    This would also indicate it was built by GCC >= 4.9.
    But the runtime loader can't find the right libstdc++.so.6 version. Try locate libstdc++.so.6 to search for the version ones. For example:

    # locate libstdc++.so.6
    /data/gcc-4.9/lib64/libstdc++.so.6
    /data/gcc-4.9/lib64/libstdc++.so.6.0.20
    /usr/lib/libstdc++.so.6
    /usr/lib/libstdc++.so.6.0.19
    /usr/lib64/libstdc++.so.6
    /usr/lib64/libstdc++.so.6.0.19

    We are currently investigating the optimal way to solve this, but so your case I can suggest three options:

    1. configure the node build with ./configure --partly-static. That will statically link libstdc++ into binaries
    2. find the latest libstdc++.so.6 on your system, and symlink it to /usr/lib/libstdc++.so.6
    3. set LD_LIBRARY_PATH to where the newer lib is
  2. janemba commented on Mar 23, 2019

    @janemba
    Author

    @refack

    I used the second options and it works. Thank you.

  3. added
    buildIssues and PRs related to Node.js builds or CI infrastructure.
    on Mar 23, 2019
  4. refack commented on Mar 23, 2019

    @refack
    Contributor

    Happy to help 🎩

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildIssues and PRs related to Node.js builds or CI infrastructure.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions