Skip to content

NodeJS 12.13.0 CentOS fail compile #30077

Description

@delagen
  • Version: 12.13.0
  • Platform: CentOS 6 inside Docker
  • Subsystem:

../deps/v8/src/inspector/v8-runtime-agent-impl.cc: In member function 'virtual v8_inspector::protocol::Response v8_inspector::V8RuntimeAgentImpl::getIsolateId(v8_inspector::String16*)':
../deps/v8/src/inspector/v8-runtime-agent-impl.cc:626:38: error: expected ')' before 'PRIx64'
std::snprintf(buf, sizeof(buf), "%" PRIx64, m_inspector->isolateId());
~ ^~~~~~~
)
make[1]: *** [/tmp/tmp.Om2rLi9DCC/BUILD/node-v12.13.0/out/Release/obj.target/v8_base_without_compiler/deps/v8/src/inspector/v8-runtime-agent-impl.o] Error 1
make: *** [node] Error 2

Activity

  1. added
    buildIssues and PRs related to Node.js builds or CI infrastructure.
    on Oct 23, 2019
  2. bnoordhuis commented on Oct 23, 2019

    @bnoordhuis
    Member

    I'm going to guess that your system's header files don't define the PRIx64 macro that normally lives in inttypes.h.

    Are you using devtoolset? Can you post the exact steps you use to set up your build environment and configure and build node?

  3. delagen commented on Oct 23, 2019

    @delagen
    Author

    I am using devtoolset-8 devtoolset-8-make devtoolset-8-gcc devtoolset-8-gcc-c++ inside docker container from centos:6.
    Latest Node 10.x was compiled successfully

  4. bnoordhuis commented on Oct 23, 2019

    @bnoordhuis
    Member

    I'm not 100% sure but I think we use devtoolset-6 or 7 to build on centos 6. Maybe give them a go.

  5. delagen commented on Oct 23, 2019

    @delagen
    Author
    docker run -it centos:6
    
    yum update -y \
    	&& yum install -y ca-certificates sudo yum-utils epel-release centos-release-scl-rh \
    	&& yum-config-manager --enable rhel-server-rhscl-6-rpms \
    	&& yum update -y
    
    yum install -y \
    		openssh-clients \
    		devtoolset-7 devtoolset-7-make devtoolset-7-gcc devtoolset-7-gcc-c++ \
    		python27 git \
    		curl wget jq \
    		bzip2 xz \
    		pkgconfig automake autoconf \
    		rpm-build rpm-sign rpmdevtools
    
    . /opt/rh/devtoolset-7/enable
    . /opt/rh/python27/enable
    
    wget https://nodejs.org/dist/v12.13.0/node-v12.13.0.tar.gz
    tar xf node-v12.13.0.tar.gz
    cd node-v12.13.0
    
     ./configure --prefix=/usr/local
    make

    Result:

    g++ -o /node-v12.13.0/out/Release/obj.target/v8_base_without_compiler/deps/v8/src/inspector/v8-runtime-agent-impl.o ../deps/v8/src/inspector/v8-runtime-agent-impl.cc '-DV8_GYP_BUILD' '-DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DV8_TARGET_ARCH_X64' '-DV8_EMBEDDER_STRING="-node.12"' '-DENABLE_DISASSEMBLER' '-DV8_PROMISE_INTERNAL_FIELD_COUNT=1' '-DENABLE_MINOR_MC' '-DV8_INTL_SUPPORT' '-DV8_USE_SNAPSHOT' '-DV8_CONCURRENT_MARKING' '-DV8_EMBEDDED_BUILTINS' '-DV8_USE_SIPHASH' '-DDISABLE_UNTRUSTED_CODE_MITIGATIONS' '-DV8_WIN64_UNWINDING_INFO' '-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC' '-DUCONFIG_NO_SERVICE=1' '-DU_ENABLE_DYLOAD=0' '-DU_STATIC_IMPLEMENTATION=1' '-DU_HAVE_STD_STRING=1' '-DUCONFIG_NO_BREAK_ITERATION=0' -I../deps/v8 -I../deps/v8/include -I/node-v12.13.0/out/Release/obj/gen/inspector-generated-output-root -I../deps/v8/third_party/inspector_protocol -I/node-v12.13.0/out/Release/obj/gen/torque-output-root -I/node-v12.13.0/out/Release/obj/gen/generate-bytecode-output-root -I../deps/icu-small/source/i18n -I../deps/icu-small/source/common  -pthread -Wno-unused-parameter -m64 -Wno-return-type -fno-strict-aliasing -m64 -O3 -fno-omit-frame-pointer -fdata-sections -ffunction-sections -O3 -fno-rtti -fno-exceptions -std=gnu++1y -MMD -MF /node-v12.13.0/out/Release/.deps//node-v12.13.0/out/Release/obj.target/v8_base_without_compiler/deps/v8/src/inspector/v8-runtime-agent-impl.o.d.raw   -c
    
    ../deps/v8/src/inspector/v8-runtime-agent-impl.cc: In member function 'virtual v8_inspector::protocol::Response v8_inspector::V8RuntimeAgentImpl::getIsolateId(v8_inspector::String16*)':
    ../deps/v8/src/inspector/v8-runtime-agent-impl.cc:626:39: error: expected ')' before 'PRIx64'
       std::snprintf(buf, sizeof(buf), "%" PRIx64, m_inspector->isolateId());
                                           ^~~~~~
    make[1]: *** [tools/v8_gypfiles/v8_base_without_compiler.target.mk:627: /node-v12.13.0/out/Release/obj.target/v8_base_without_compiler/deps/v8/src/inspector/v8-runtime-agent-impl.o] Error 1
    rm a7d68dbc8fa1baa5f00537069835f94762111292.intermediate 466fb3915b04088edda5f262d4298bb1334a1bf8.intermediate
    make: *** [Makefile:101: node] Error 2
    
  6. devnexen commented on Oct 23, 2019

    @devnexen
    Contributor

    I'm going to guess that your system's header files don't define the PRIx64 macro that normally lives in inttypes.h.

    Are you using devtoolset? Can you post the exact steps you use to set up your build environment and configure and build node?

    Seem they are in fact but might need to pass -D__STDC_FORMAT_MACROS flag, what do you think ?
    In addition I needed to pass -lrt linker flag too and the build passes.

  7. bnoordhuis commented on Oct 26, 2019

    @bnoordhuis
    Member

    gnulib has a note on it:

    On some hosts that predate C++11, when using C++ one must define __STDC_FORMAT_MACROS to make visible the declarations of format macros such as PRIdMAX.

    So I guess that means we need to define it for systems like OP's...

    Someone want to send a PR? It should be added to cflags_cc in common.gypi.

  8. likema commented on Nov 13, 2019

    @likema

    By GCC 6.5.0 on Ubuntu 12.04, it also has the same issue.

  9. delagen commented on Jan 8, 2020

    @delagen
    Author

    I think it not included in 12.14.1 release ((

  10. bnoordhuis commented on Jan 8, 2020

    @bnoordhuis
    Member

    It was fixed in v13.6.0 but it'll take some time before it's eligible for v12.x LTS. Maybe in the next release. I'll close this out.

  11. delagen commented on Jan 14, 2020

    @delagen
    Author

    @bnoordhuis Even in 13.6.0 does not compile
    Error

     undefined reference to `clock_gettime'
    
    LINK(target) /tmp/tmp.FC9mvdvjih/BUILD/node-v13.6.0/out/Release/cctest
    4334 /tmp/tmp.FC9mvdvjih/BUILD/node-v13.6.0/out/Release/obj.target/libuv/deps/uv/src/unix/linux-core.o: In function `uv__hrtime':
    4335 /tmp/tmp.FC9mvdvjih/BUILD/node-v13.6.0/out/../deps/uv/src/unix/linux-core.c:489: undefined reference to `clock_gettime'
    4336 /tmp/tmp.FC9mvdvjih/BUILD/node-v13.6.0/out/../deps/uv/src/unix/linux-core.c:477: undefined reference to `clock_getres'
    4337 /tmp/tmp.FC9mvdvjih/BUILD/node-v13.6.0/out/../deps/uv/src/unix/linux-core.c:489: undefined reference to `clock_gettime'
    4338 /tmp/tmp.FC9mvdvjih/BUILD/node-v13.6.0/out/../deps/uv/src/unix/linux-core.c:477: undefined reference to `clock_getres'
    4339 /tmp/tmp.FC9mvdvjih/BUILD/node-v13.6.0/out/Release/obj.target/libuv/deps/uv/src/unix/linux-core.o: In function `uv_uptime':
    4340 /tmp/tmp.FC9mvdvjih/BUILD/node-v13.6.0/out/../deps/uv/src/unix/linux-core.c:563: undefined reference to `clock_gettime'
    4341 /tmp/tmp.FC9mvdvjih/BUILD/node-v13.6.0/out/../deps/uv/src/unix/linux-core.c:565: undefined reference to `clock_gettime'
    4342 /tmp/tmp.FC9mvdvjih/BUILD/node-v13.6.0/out/Release/obj.target/v8_base_without_compiler/deps/v8/src/diagnostics/perf-jit.o: In function `v8::internal::PerfJitLogger::WriteJitCodeLoadEntry(unsigned char const*, unsigned int, char const*, int) [clone .constprop.72]':
    4343 perf-jit.cc:(.text._ZN2v88internal13PerfJitLogger21WriteJitCodeLoadEntryEPKhjPKci.constprop.72+0x32): undefined reference to `clock_gettime'
    4344 /tmp/tmp.FC9mvdvjih/BUILD/node-v13.6.0/out/Release/obj.target/v8_base_without_compiler/deps/v8/src/diagnostics/perf-jit.o: In function `v8::internal::PerfJitLogger::LogWriteUnwindingInfo(v8::internal::Code) [clone .constprop.71]':
    4345 perf-jit.cc:(.text._ZN2v88internal13PerfJitLogger21LogWriteUnwindingInfoENS0_4CodeE.constprop.71+0x28): undefined reference to `clock_gettime'
    4346 /tmp/tmp.FC9mvdvjih/BUILD/node-v13.6.0/out/Release/obj.target/v8_base_without_compiler/deps/v8/src/diagnostics/perf-jit.o: In function `v8::internal::PerfJitLogger::LogRecordedBuffer(v8::internal::wasm::WasmCode const*, char const*, int)':
    4347 perf-jit.cc:(.text._ZN2v88internal13PerfJitLogger17LogRecordedBufferEPKNS0_4wasm8WasmCodeEPKci+0x22f): undefined reference to `clock_gettime'
    4348 /tmp/tmp.FC9mvdvjih/BUILD/node-v13.6.0/out/Release/obj.target/v8_base_without_compiler/deps/v8/src/diagnostics/perf-jit.o:perf-jit.cc:(.text._ZN2v88internal13PerfJitLogger17LogWriteDebugInfoENS0_4CodeENS0_18SharedFunctionInfoE.constprop.69+0xd6): more undefined references to `clock_gettime' follow
    4349 /tmp/tmp.FC9mvdvjih/BUILD/node-v13.6.0/out/Release/obj.target/uvwasi/deps/uvwasi/src/clocks.o: In function `uvwasi__clock_getres_process_cputime':
    4350 clocks.c:(.text+0x126): undefined reference to `clock_getres'
    4351 /tmp/tmp.FC9mvdvjih/BUILD/node-v13.6.0/out/Release/obj.target/uvwasi/deps/uvwasi/src/clocks.o: In function `uvwasi__clock_getres_thread_cputime':
    4352 clocks.c:(.text+0x166): undefined reference to `clock_gettime'
    4353 /tmp/tmp.FC9mvdvjih/BUILD/node-v13.6.0/out/Release/obj.target/cares/deps/cares/src/ares__timeval.o: In function `ares__tvnow':
    4354 /tmp/tmp.FC9mvdvjih/BUILD/node-v13.6.0/out/../deps/cares/src/ares__timeval.c:48: undefined reference to `clock_gettime'
    4355 /tmp/tmp.FC9mvdvjih/BUILD/node-v13.6.0/out/Release/obj.target/v8_libbase/deps/v8/src/base/platform/condition-variable.o: In function `v8::base::ConditionVariable::WaitFor(v8::base::Mutex*, v8::base::TimeDelta const&)':
    4356 condition-variable.cc:(.text._ZN2v84base17ConditionVariable7WaitForEPNS0_5MutexERKNS0_9TimeDeltaE+0x20): undefined reference to `clock_gettime'
    4357 /tmp/tmp.FC9mvdvjih/BUILD/node-v13.6.0/out/Release/obj.target/v8_libbase/deps/v8/src/base/platform/time.o: In function `v8::base::TimeTicks::HighResolutionNow()':
    4358 time.cc:(.text._ZN2v84base9TimeTicks17HighResolutionNowEv+0x12): undefined reference to `clock_gettime'
    4359 /tmp/tmp.FC9mvdvjih/BUILD/node-v13.6.0/out/Release/obj.target/v8_libbase/deps/v8/src/base/platform/time.o: In function `v8::base::TimeTicks::Now()':
    4360 time.cc:(.text._ZN2v84base9TimeTicks3NowEv+0x12): undefined reference to `clock_gettime'
    4361 /tmp/tmp.FC9mvdvjih/BUILD/node-v13.6.0/out/Release/obj.target/v8_libbase/deps/v8/src/base/platform/time.o:time.cc:(.text._ZN2v84base9TimeTicks16IsHighResolutionEv+0x5a): more undefined references to `clock_gettime' follow
    4362 collect2: error: ld returned 1 exit status
    4363 make[1]: *** [/tmp/tmp.FC9mvdvjih/BUILD/node-v13.6.0/out/Release/cctest] Error 1
    4364 make: *** [node] Error 2
    
  12. bnoordhuis commented on Jan 14, 2020

    @bnoordhuis
    Member

    @delagen That's an issue with your glibc being too old. You can probably work around it with this patch but it comes with zero warranties (as does node in general, of course.)

    diff --git a/node.gypi b/node.gypi
    index e6f5872cc7..4ed0207f0f 100644
    --- a/node.gypi
    +++ b/node.gypi
    @@ -298,7 +298,7 @@
           'ldflags': [ '-Wl,-M,/usr/lib/ld/map.noexstk' ],
         }],
         [ 'OS=="linux"', {
    -      'libraries!': [
    +      'libraries': [
             '-lrt'
           ],
         }],

    If it still doesn't work after that, you're on your own. :-)

  13. delagen commented on Jan 15, 2020

    @delagen
    Author

    @bnoordhuis Yes it works, but I fixed via ENV LDFLAGS: '-lrt'. Thanks

  14. ledbit commented on Feb 7, 2020

    @ledbit

    @bnoordhuis is there a timeline to land this on 12.x? (it doesn't seem to be on 12.15.0)

  15. bnoordhuis commented on Feb 8, 2020

    @bnoordhuis
    Member

    v12.15.0 was a security release, those don't contain regular bug fixes. It'll probably be in the next one.

  16. richardlau commented on Feb 8, 2020

    @richardlau
    Member

    Next one will be #31691.

  17. bnoordhuis commented on Feb 8, 2020

    @bnoordhuis
    Member

    That one contains the fix.

  18. ledbit commented on Feb 12, 2020

    @ledbit

    Confirming that 12.16.0 has the fix - as @delagen mentioned you need to set LDFLAGS=-lrt env variable when compiling. Thanks!!

  19. atoomic commented on Oct 2, 2020

    @atoomic

    Seems like you want to use both of these to compile nodejs v12 on CentOS 6

    export LDFLAGS=-lrt
    export CPPFLAGS=-D__STDC_FORMAT_MACROS
    
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