nodejs / node

Node.js JavaScript runtime ✨🐢🚀✨
https://nodejs.org
Other
106.6k stars 29.07k forks source link

Building v12 and v13 fails on NetBSD #30638

Closed moubctez closed 4 years ago

moubctez commented 4 years ago

I am unable to build NodeJS on NetBSD with clang 9.0.0 (for packaging for PkgSrc). The build fails on:

  clang++ -o /tmp/pkgsrc/lang/nodejs12/work/node-v12.13.1/out/Release/obj.target/v8_base_without_compiler/deps/v8/src/asmjs/asm-parser.o ../deps/v8/src/asmjs/asm-parser.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.16"' '-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' -I/usr/pkg/include -I../deps/v8 -I../deps/v8/include -I/tmp/pkgsrc/lang/nodejs12/work/node-v12.13.1/out/Release/obj/gen/inspector-generated-output-root -I../deps/v8/third_party/inspector_protocol -I/tmp/pkgsrc/lang/nodejs12/work/node-v12.13.1/out/Release/obj/gen/torque-output-root -I/tmp/pkgsrc/lang/nodejs12/work/node-v12.13.1/out/Release/obj/gen/generate-bytecode-output-root  -pthread -Wno-unused-parameter -m64 -Wno-return-type -fno-strict-aliasing -I/usr/pkg/include -O3 -fno-omit-frame-pointer -fdata-sections -ffunction-sections -O3 -fno-rtti -fno-exceptions -std=gnu++1y -MMD -MF /tmp/pkgsrc/lang/nodejs12/work/node-v12.13.1/out/Release/.deps//tmp/pkgsrc/lang/nodejs12/work/node-v12.13.1/out/Release/obj.target/v8_base_without_compiler/deps/v8/src/asmjs/asm-parser.o.d.raw -I/usr/include -I/usr/pkg/include -O2 -pipe -fno-stack-protector -march=native -pthread -I/usr/include -I/usr/pkg/include -stdlib=libc++ -c
In file included from ../deps/v8/src/asmjs/asm-parser.cc:17:
In file included from ../deps/v8/src/numbers/conversions-inl.h:21:
In file included from ../deps/v8/src/objects/heap-number-inl.h:11:
In file included from ../deps/v8/src/objects/objects-inl.h:32:
In file included from ../deps/v8/src/objects/lookup-inl.h:11:
In file included from ../deps/v8/src/heap/factory-inl.h:18:
In file included from ../deps/v8/src/objects/string-inl.h:17:
In file included from ../deps/v8/src/strings/string-hasher-inl.h:12:
../deps/v8/src/strings/char-predicates-inl.h:90:30: warning: operator '?:' has lower precedence than '|'; '|' will be evaluated
      first [-Wbitwise-conditional-parentheses]
    (c == '\r' || c == '\n') ? kIsWhiteSpaceOrLineTerminator : 0;
    ~~~~~~~~~~~~~~~~~~~~~~~~ ^
../deps/v8/src/strings/char-predicates-inl.h:90:30: note: place parentheses around the '|' expression to silence this warning
    (c == '\r' || c == '\n') ? kIsWhiteSpaceOrLineTerminator : 0;
                             ^
                            )
../deps/v8/src/strings/char-predicates-inl.h:90:30: note: place parentheses around the '?:' expression to evaluate it first
    (c == '\r' || c == '\n') ? kIsWhiteSpaceOrLineTerminator : 0;
                             ^
    (                                                           )
../deps/v8/src/strings/char-predicates-inl.h:88:55: warning: operator '?:' has lower precedence than '|'; '|' will be evaluated
      first [-Wbitwise-conditional-parentheses]
    (c == ' ' || c == '\t' || c == '\v' || c == '\f') ?
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
../deps/v8/src/strings/char-predicates-inl.h:88:55: note: place parentheses around the '|' expression to silence this warning
    (c == ' ' || c == '\t' || c == '\v' || c == '\f') ?
                                                      ^
                                                     )
../deps/v8/src/strings/char-predicates-inl.h:88:55: note: place parentheses around the '?:' expression to evaluate it first
    (c == ' ' || c == '\t' || c == '\v' || c == '\f') ?
                                                      ^
    (
In file included from ../deps/v8/src/asmjs/asm-parser.cc:5:
In file included from ../deps/v8/src/asmjs/asm-parser.h:12:
In file included from ../deps/v8/src/asmjs/asm-types.h:13:
In file included from ../deps/v8/src/zone/zone-containers.h:20:
../deps/v8/src/zone/zone-allocator.h:59:5: error: no matching function for call to 'operator new'
    new (v_p) U(std::forward<Args>(args)...);
    ^~~
/usr/include/c++/memory:1647:18: note: in instantiation of function template specialization
      'v8::internal::ZoneAllocator<std::__1::__hash_node<std::__1::__hash_value_type<v8::internal::Signature<v8::internal::wasm::ValueType>,
      unsigned int>, void *> >::construct<const v8::internal::Signature<v8::internal::wasm::ValueType>, const
      v8::internal::Signature<v8::internal::wasm::ValueType> &>' requested here
            {__a.construct(__p, _VSTD::forward<_Args>(__args)...);}
                 ^
/usr/include/c++/memory:1493:14: note: in instantiation of function template specialization
      'std::__1::allocator_traits<v8::internal::ZoneAllocator<std::__1::__hash_node<std::__1::__hash_value_type<v8::internal::Signature<v8::internal::wasm::ValueType>,
      unsigned int>, void *> > >::__construct<const v8::internal::Signature<v8::internal::wasm::ValueType>, const
      v8::internal::Signature<v8::internal::wasm::ValueType> &>' requested here
            {__construct(__has_construct<allocator_type, _Tp*, _Args...>(),
             ^
/usr/include/c++/unordered_map:1510:20: note: in instantiation of function template specialization
      'std::__1::allocator_traits<v8::internal::ZoneAllocator<std::__1::__hash_node<std::__1::__hash_value_type<v8::internal::Signature<v8::internal::wasm::ValueType>,
      unsigned int>, void *> > >::construct<const v8::internal::Signature<v8::internal::wasm::ValueType>, const
      v8::internal::Signature<v8::internal::wasm::ValueType> &>' requested here
    __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first), __k);
                   ^
/usr/include/c++/unordered_map:1535:25: note: in instantiation of member function
      'std::__1::unordered_map<v8::internal::Signature<v8::internal::wasm::ValueType>, unsigned int,
      v8::base::hash<v8::internal::Signature<v8::internal::wasm::ValueType> >,
      std::__1::equal_to<v8::internal::Signature<v8::internal::wasm::ValueType> >,
      v8::internal::ZoneAllocator<std::__1::pair<const v8::internal::Signature<v8::internal::wasm::ValueType>, unsigned int> >
      >::__construct_node_with_key' requested here
    __node_holder __h = __construct_node_with_key(__k);
                        ^
../deps/v8/src/asmjs/asm-parser.cc:2253:35: note: in instantiation of member function
      'std::__1::unordered_map<v8::internal::Signature<v8::internal::wasm::ValueType>, unsigned int,
      v8::base::hash<v8::internal::Signature<v8::internal::wasm::ValueType> >,
      std::__1::equal_to<v8::internal::Signature<v8::internal::wasm::ValueType> >,
      v8::internal::ZoneAllocator<std::__1::pair<const v8::internal::Signature<v8::internal::wasm::ValueType>, unsigned int> >
      >::operator[]' requested here
      function_info->import->cache[*sig] = index;
                                  ^
../deps/v8/src/zone/zone.h:143:9: note: candidate function not viable: cannot convert argument of incomplete type 'void *' to
      'v8::internal::Zone *' for 2nd argument
  void* operator new(size_t size, Zone* zone) { return zone->New(size); }
        ^
2 warnings and 1 error generated.

NodeJS v10.17.0 and v8.16.2 build correctly. Maybe someone can point out what has changed between versions and, eventually, how to fix the build?

sam-github commented 4 years ago

Note that netbsd isn't even an experimental platform: https://github.com/nodejs/node/blob/master/BUILDING.md#platform-list, so netbsd builds might be a bit DIY.

I'll ping @nodejs/platform-freebsd, they might have a comment.

I checked https://github.com/nodejs/node/blob/master/BUILDING.md, and it is silent on minimum clang versions needed to build V8. @nodejs/v8 might have a comment on that, but perhaps a more recent clang is required now?

sam-github commented 4 years ago

perhaps a more recent clang is required now?

^--- Also, not sure why you are using clang, but if its an option, g++ 6 or higher or might work better, clang is a bit off the beaten track

devnexen commented 4 years ago

clang 9 is the most recent release available ... using the same version on FreeBSD and the build goes fine. libc++ ? anything ?

moubctez commented 4 years ago

This turned out to be an issue with older libc++. Thank you for you attention.