node
node copied to clipboard
Unefined PushAllRegistersAndIterateStack: building node 18.7.0 using Ubuntu 22
Version
18.7.0
Platform
Ubuntu 22 x86_x64
Subsystem
No response
What steps will reproduce the bug?
While trying to build node on ubuntu22 (using pbuilder) and gcc-11 using
./configure --with-intl=full-icu
How often does it reproduce? Is there a required condition?
Can reproduce every time I try to build it. Does not happen while building with Ubuntu 20.
What is the expected behavior?
ld succeeds for stack.cc
What do you see instead?
I got the following issue: undefined reference to PushAllRegistersAndIterateStack
while trying to link ltrans.o
Here is the extract
g++ -o /build/my-node-18.7.0/out/Release/obj.target/v8_base_without_compiler/deps/v8/src/heap/base/stack.o ../deps/v8/src/heap/base/stack.cc '-D_GLIBCXX_USE_CXX11_ABI=1' '-DNODE_OPENSSL_CONF_NAME=nodejs_conf' '-DNODE_OPENSSL_HAS_QUIC' '-DV8_GYP_BUILD' '-DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DV8_TARGET_ARCH_X64' '-DV8_HAVE_TARGET_OS' '-DV8_TARGET_OS_LINUX' '-DV8_EMBEDDER_STRING="-node.9"' '-DENABLE_DISASSEMBLER' '-DV8_PROMISE_INTERNAL_FIELD_COUNT=1' '-DV8_SHORT_BUILTIN_CALLS' '-DOBJECT_PRINT' '-DV8_INTL_SUPPORT' '-DV8_ATOMIC_OBJECT_FIELD_WRITES' '-DV8_ENABLE_LAZY_SOURCE_POSITIONS' '-DV8_USE_SIPHASH' '-DV8_SHARED_RO_HEAP' '-DV8_WIN64_UNWINDING_INFO' '-DV8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH' '-DV8_SNAPSHOT_COMPRESSION' '-DV8_ENABLE_WEBASSEMBLY' '-DV8_ENABLE_JAVASCRIPT_PROMISE_HOOKS' '-DV8_ALLOCATION_FOLDING' '-DV8_ALLOCATION_SITE_TRACKING' '-DV8_SCRIPTORMODULE_LEGACY_LIFETIME' '-DV8_ADVANCED_BIGINT_ALGORITHMS' '-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/build/my-node-18.7.0/out/Release/obj/gen/inspector-generated-output-root -I../deps/v8/third_party/inspector_protocol -I/build/my-node-18.7.0/out/Release/obj/gen -I/build/my-node-18.7.0/out/Release/obj/gen/generate-bytecode-output-root -I../deps/icu-small/source/i18n -I../deps/icu-small/source/common -I../deps/v8/third_party/zlib -I../deps/v8/third_party/zlib/google -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++17 -MMD -MF /build/my-node-18.7.0/out/Release/.deps//build/my-node-18.7.0/out/Release/obj.target/v8_base_without_compiler/deps/v8/src/heap/base/stack.o.d.raw -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -ffile-prefix-map=/build/my-node-18.7.0=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -c
....
....
....
....
/usr/bin/ld:
/tmp/ccCmYsME.ltrans35.ltrans.o: in function `cppgc::internal::MarkerBase::VisitRoots(cppgc::EmbedderStackState)':
/build/my-node-18.7.0/out/../deps/v8/src/heap/base/stack.cc:154: undefined reference to `PushAllRegistersAndIterateStack'
/usr/bin/ld: /tmp/ccCmYsME.ltrans35.ltrans.o: in function `heap::base::Stack::IteratePointers(heap::base::StackVisitor*) const':
/build/my-node-18.7.0/out/../deps/v8/src/heap/base/stack.cc:154: undefined reference to `PushAllRegistersAndIterateStack'
collect2: error: ld returned 1 exit status
make[2]: *** [tools/v8_gypfiles/mksnapshot.target.mk:206: /build/my-node-18.7.0/out/Release/mksnapshot] Error 1
rm 16c3313ec29f488a1f658eb0c291287d0fbcf12a.intermediate 9b81ff9373a52bd5ed274fe4fc392bc9720e6183.intermediate a57eef9352b0548383eff12843672d01e5c8c48c.intermediate
make[1]: *** [Makefile:113: node] Error 2
Additional information
This looks similar to the problem fixed by #23440 or maybe #38501.
The fix from bec959ef8b97b5a589775e554964cb14548c9895 seems to provide a workaround for it.
I wonder if in my case it's not applied as lto=auto
.
Going to give a try using an explicit --enable-lto
and provide an update to this case
Same issue using ./configure --with-intl=full-icu --enable-lto
on ubuntu 22
~~current workaround~~ is to use the gcc-9
instead of the gcc-11
export CC = gcc-9
export CXX = g++-9
and add this to the debian/control
file as Build-Depends
libgcc-9-dev,
libstdc++-9-dev,
gcc-9,
g++-9
nope this does not work, same issue...
same issue trying to build 16.16.0
on ubuntu 22
/usr/bin/ld:
/tmp/cc7eO4V2.ltrans50.ltrans.o: in function `cppgc::internal::MarkerBase::VisitRoots(cppgc::EmbedderStackState)':
/build/my-node-16.16.0/out/../deps/v8/src/heap/base/stack.cc:133: undefined reference to `PushAllRegistersAndIterateStack'
/usr/bin/ld:
/tmp/cc7eO4V2.ltrans52.ltrans.o: in function `heap::base::Stack::IteratePointers(heap::base::StackVisitor*) const':
/build/my-node-16.16.0/out/../deps/v8/src/heap/base/stack.cc:133: undefined reference to `PushAllRegistersAndIterateStack'
collect2: error: ld returned 1 exit status
make[2]: *** [tools/v8_gypfiles/mksnapshot.target.mk:204: /build/my-node-16.16.0/out/Release/mksnapshot] Error 1
rm 68014a9316e25b948e71c5dfa9f1fdd8b16312f1.intermediate 6bae4e71c3f25b8fb3ae02be87a96cd8f26e9064.intermediate 157c41ae593b77aacd64c70523394706c52a0607.intermediate
make[1]: *** [Makefile:113: node] Error 2
make[1]: Leaving directory '/build/my-node-16.16.0'
dh_auto_build: error: make -j2 returned exit code 2
make: *** [debian/rules:42: build] Error 25
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2
@atoomic I'm facing same issue. Did you find a workaround?
I was able to move forward and build node 16.17.0
using these rules in my debian/rules
but also by applying some patches from debian (view attached zip file)
( you probably do not need all and some are specific to our package )
SOURCES/0001-hard-code-shebangs-to-use-python3.patch
SOURCES/0002-Fix-shebangs-for-node.patch
SOURCES/0003-Fix-shebangs-for-perl-paths.patch
SOURCES/0004-Fix-node-gyp-to-call-node-with-its-absolute-path.patch
SOURCES/0005-Fix-ambiguous-python-shebang.patch
SOURCES/0006-mips-no-jitless.patch
SOURCES/0007-mips-compilation-error.patch
SOURCES/0008-mips-less-mem.patch
SOURCES/0009-mips-fpu.patch
SOURCES/0010-build-test-ci.patch
SOURCES/0011-test-fix-test-socket-write-after-fin-error.patch
SOURCES/0012-skip-buffer-NaN-internal-representation-check-this-f.patch
SOURCES/0013-build-cctest-disable.patch
# node needs a lot of ram/swap when linking binaries...
# consider increasing the ram/swap on your box
# avoid running out of memory by using --max-parallel
JOBS := $(shell perl -E 'print( int( qx{/usr/bin/nproc} / 8 ) // 1 ) ')
MAKEFLAGS := --jobs=$(JOBS)
DH_FLAGS += --max-parallel=$(JOBS)
export JOBS
export CC = gcc-9
export CXX = g++-9
CFLAGS += -g
CFLAGS += -fPIC
CFLAGS += -march=native
CPPFLAGS += $(CFLAGS)
CXXFLAGS += $(CFLAGS)
export CFLAGS
export CPPLAGS
export CXXFLAGS
CONFIGURE_OPTIONS := --prefix=$(PREFIX) --verbose \
--with-intl=small-icu \
--without-corepack
override_dh_auto_configure:
echo "JOBS: ${JOBS}"
./configure $(CONFIGURE_OPTIONS)
override_dh_dwz:
-dh_dwz -- --max-die-limit 100000000
hope this helps
I believe the conclusion here is that it's basically a binutils LTO bug, right? In that case I suggest closing the issue because that's not under our control.
fine with me
If someone can provide details about this issue please report that under https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111964