nodejs / node

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

Compiling string.cc: Error: selected processor does not support `yield' in ARM mode #49287

Closed crichmon762 closed 1 year ago

crichmon762 commented 1 year ago

Version

node-v18.17.1

Platform

Linux renogy0 6.1.21-v7+ #1642 SMP Mon Apr 3 17:20:52 BST 2023 armv7l GNU/Linux

Subsystem

string

What steps will reproduce the bug?

Same error message from issue: #44357

  g++ -o /home/crichmon/nodejs/node-v18.17.1/out/Release/obj.target/v8_base_without_compiler/deps/v8/src/objects/string.o ../deps/v8/src/objects/string.cc '-D_GLIBCXX_USE_CXX11_ABI=1' '-DNODE_OPENSSL_CONF_NAME=nodejs_conf' '-DNODE_OPENSSL_HAS_QUIC' '-DICU_NO_USER_DATA_OVERRIDE' '-DV8_GYP_BUILD' '-DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DV8_TARGET_ARCH_ARM' '-DV8_HAVE_TARGET_OS' '-DV8_TARGET_OS_LINUX' '-DV8_EMBEDDER_STRING="-node.26"' '-DENABLE_DISASSEMBLER' '-DV8_PROMISE_INTERNAL_FIELD_COUNT=1' '-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_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/home/crichmon/nodejs/node-v18.17.1/out/Release/obj/gen/inspector-generated-output-root -I../deps/v8/third_party/inspector_protocol -I/home/crichmon/nodejs/node-v18.17.1/out/Release/obj/gen -I/home/crichmon/nodejs/node-v18.17.1/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 -Wno-return-type -fno-strict-aliasing -mfloat-abi=hard -marm -O3 -fno-omit-frame-pointer -fdata-sections -ffunction-sections -O3 -fno-rtti -fno-exceptions -std=gnu++17 -MMD -MF /home/crichmon/nodejs/node-v18.17.1/out/Release/.deps//home/crichmon/nodejs/node-v18.17.1/out/Release/obj.target/v8_base_without_compiler/deps/v8/src/objects/string.o.d.raw   -c
In file included from ../deps/v8/src/objects/string.cc:28:
../deps/v8/src/strings/string-stream.h: In member function 'void v8::internal::String::PrintUC16(v8::internal::StringStream*, int, int)':
../deps/v8/src/strings/string-stream.h:155:8: note: parameter passing for argument of type 'v8::base::Vector<v8::internal::StringStream::FmtElm>' changed in GCC 7.1
  155 |     Add(format, base::Vector<FmtElm>());
      |     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../deps/v8/src/strings/string-stream.h:155:8: note: parameter passing for argument of type 'v8::base::Vector<v8::internal::StringStream::FmtElm>' changed in GCC 7.1
../deps/v8/src/strings/string-stream.h:155:8: note: parameter passing for argument of type 'v8::base::Vector<v8::internal::StringStream::FmtElm>' changed in GCC 7.1
  155 |     Add(format, base::Vector<FmtElm>());
      |     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../deps/v8/src/strings/string-stream.h:155:8: note: parameter passing for argument of type 'v8::base::Vector<v8::internal::StringStream::FmtElm>' changed in GCC 7.1
../deps/v8/src/strings/string-stream.h:155:8: note: parameter passing for argument of type 'v8::base::Vector<v8::internal::StringStream::FmtElm>' changed in GCC 7.1
  155 |     Add(format, base::Vector<FmtElm>());
      |     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../deps/v8/src/strings/string-stream.h:155:8: note: parameter passing for argument of type 'v8::base::Vector<v8::internal::StringStream::FmtElm>' changed in GCC 7.1
../deps/v8/src/strings/string-stream.h:166:8: note: parameter passing for argument of type 'v8::base::Vector<v8::internal::StringStream::FmtElm>' changed in GCC 7.1
  166 |     Add(format, base::ArrayVector(elems));
      |     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../deps/v8/src/strings/string-stream.h:166:8: note: parameter passing for argument of type 'v8::base::Vector<v8::internal::StringStream::FmtElm>' changed in GCC 7.1
../deps/v8/src/strings/string-stream.h: In member function 'void v8::internal::String::StringShortPrint(v8::internal::StringStream*)':
../deps/v8/src/strings/string-stream.h:155:8: note: parameter passing for argument of type 'v8::base::Vector<v8::internal::StringStream::FmtElm>' changed in GCC 7.1
  155 |     Add(format, base::Vector<FmtElm>());
      |     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../deps/v8/src/strings/string-stream.h:155:8: note: parameter passing for argument of type 'v8::base::Vector<v8::internal::StringStream::FmtElm>' changed in GCC 7.1
../deps/v8/src/strings/string-stream.h:166:8: note: parameter passing for argument of type 'v8::base::Vector<v8::internal::StringStream::FmtElm>' changed in GCC 7.1
  166 |     Add(format, base::ArrayVector(elems));
      |     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../deps/v8/src/strings/string-stream.h:166:8: note: parameter passing for argument of type 'v8::base::Vector<v8::internal::StringStream::FmtElm>' changed in GCC 7.1
../deps/v8/src/strings/string-stream.h:155:8: note: parameter passing for argument of type 'v8::base::Vector<v8::internal::StringStream::FmtElm>' changed in GCC 7.1
  155 |     Add(format, base::Vector<FmtElm>());
      |     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../deps/v8/src/strings/string-stream.h:155:8: note: parameter passing for argument of type 'v8::base::Vector<v8::internal::StringStream::FmtElm>' changed in GCC 7.1
../deps/v8/src/strings/string-stream.h:155:8: note: parameter passing for argument of type 'v8::base::Vector<v8::internal::StringStream::FmtElm>' changed in GCC 7.1
  155 |     Add(format, base::Vector<FmtElm>());
      |     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../deps/v8/src/strings/string-stream.h:155:8: note: parameter passing for argument of type 'v8::base::Vector<v8::internal::StringStream::FmtElm>' changed in GCC 7.1
../deps/v8/src/strings/string-stream.h:155:8: note: parameter passing for argument of type 'v8::base::Vector<v8::internal::StringStream::FmtElm>' changed in GCC 7.1
  155 |     Add(format, base::Vector<FmtElm>());
      |     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../deps/v8/src/strings/string-stream.h:155:8: note: parameter passing for argument of type 'v8::base::Vector<v8::internal::StringStream::FmtElm>' changed in GCC 7.1
../deps/v8/src/strings/string-stream.h:155:8: note: parameter passing for argument of type 'v8::base::Vector<v8::internal::StringStream::FmtElm>' changed in GCC 7.1
  155 |     Add(format, base::Vector<FmtElm>());
      |     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../deps/v8/src/strings/string-stream.h:155:8: note: parameter passing for argument of type 'v8::base::Vector<v8::internal::StringStream::FmtElm>' changed in GCC 7.1
/tmp/ccjtR6Pr.s: Assembler messages:
/tmp/ccjtR6Pr.s:1868: Error: selected processor does not support `yield' in ARM mode
/tmp/ccjtR6Pr.s:2052: Error: selected processor does not support `yield' in ARM mode
make[1]: *** [tools/v8_gypfiles/v8_base_without_compiler.target.mk:1015: /home/crichmon/nodejs/node-v18.17.1/out/Release/obj.target/v8_base_without_compiler/deps/v8/src/objects/string.o] Error 1
rm d6535d9e1b0fb771b7035604d7baf4c95cb62f94.intermediate 2f69391e72d4a3c4066672cf35e5c642943bde53.intermediate 645e227ba4a03c5e3414a7d89573a4b0ebfda1a0.intermediate
make: *** [Makefile:134: node] Error 2

How often does it reproduce? Is there a required condition?

Every time during compile. Initially, compiling with make -j2 failed for out of memory. Adding more swap space and using -j1 avoided that issue. Build docs could be updated. string.cc error occurred after about 8hrs after 'make clean'. Rerunning make after failure results in the same failure in <5min.

What is the expected behavior? Why is that the expected behavior?

Compile to successful completion.

What do you see instead?

Compiler error on string.cc

Additional information

g++ -v: gcc version 10.2.1 20210110 (Raspbian 10.2.1-6+rpi1)

python3 --version Python 3.9.2

cat /proc/cpuinfo

processor       : 0
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4
...
Hardware        : BCM2835
Revision        : a02042
Serial          : 0000000080676cdd
Model           : Raspberry Pi 2 Model B Rev 1.2

cat /etc/apt/sources.list

deb http://raspbian.raspberrypi.org/raspbian/ bullseye main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://raspbian.raspberrypi.org/raspbian/ bullseye main contrib non-free rpi
mscdex commented 1 year ago

Judging by the fact that your toolchain is using a +rpi1 suffix in its versions, that suggests that maybe the toolchain is only designed for compiling for armv6, which would explain the error you're seeing.

Try installing and using a toolchain that is suitable for the Pi 2 v1.2 (armv7) instead.

crichmon762 commented 1 year ago

Thanks. So I figured out how configure was getting the value and sure enough it's correct. I check apt search for a different gcc version that doesn't have a tailing +rpi1 and didn't find any. In configure.py, the only thing the v7 arch is used for is for setting the FPU type, so I'm re-trying with ./configure --with-arm-fpu vfpv3. I also modified config.gypi as: 'arm_version': '7', It's not clear if this will work. If not, it seems the next alternative is to build gcc with the required config. Any more thoughts?

mscdex commented 1 year ago

Well, you can try explicitly setting CFLAGS/CXXFLAGS to set the arch to something like native and see if that works:

export CFLAGS=-march=native
export CXXFLAGS=-march=native
./configure ... && make
crichmon762 commented 1 year ago

So, it seems my solution was "successful" in that the build completed successfully. The whole process took about 20hrs. After that, I ran make -j1 test-only, and from that I got two test failures. Failed tests: out/Release/node /home/crichmon/nodejs/node-v18.17.1/test/parallel/test-crypto-dh.js out/Release/node /home/crichmon/nodejs/node-v18.17.1/test/js-native-api/test_cannot_run_js/test.js For now, I'm calling this good and will close the Issue. Thanks again for pointing out the detail I missed.