Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Cross-compilation bug when compiling for loongarch64 on a non-loongarch64 host with Linux #56280

Open
wojiushixiaobai opened this issue Dec 17, 2024 · 4 comments

Comments

@wojiushixiaobai
Copy link
Contributor

Version

v22.12.0

Platform

Linux debian 6.1.0-27-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.115-1 (2024-11-01) x86_64 GNU/Linux

Subsystem

Cross-compiling for Linux loongarch64 on a Linux x86_64 machine.

What steps will reproduce the bug?

curl -L https://github.com/loongson/build-tools/releases/download/2023.08.08/CLFS-loongarch64-8.1-x86_64-cross-tools-gcc-glibc.tar.xz | tar xJf - -C /opt

export 'CC=ccache /opt/cross-tools/bin/loongarch64-unknown-linux-gnu-gcc'
export 'CXX=ccache /opt/cross-tools/bin/loongarch64-unknown-linux-gnu-g++'

make -j8 binary V= DESTCPU=loong64 ARCH=loong64 VARIATION= DISTTYPE=release CUSTOMTAG= DATESTRING= COMMIT= RELEASE_URLBASE=https://unofficial-builds.nodejs.org/download/release/ CONFIG_FLAGS=--openssl-no-asm

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

always

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

Should compile.

What do you see instead?

/usr/bin/ld: /home/node/node-v22.12.0/out/Release/obj.host/v8_base_without_compiler/deps/v8/src/execution/loong64/simulator-loong64.o: in function `v8::internal::Simulator::ProbeMemory(unsigned long, unsigned long)':
simulator-loong64.cc:(.text._ZN2v88internal9Simulator11ProbeMemoryEmm+0x1e): undefined reference to `v8_internal_simulator_ProbeMemory'
/usr/bin/ld: /home/node/node-v22.12.0/out/Release/obj.host/v8_base_without_compiler/deps/v8/src/execution/loong64/simulator-loong64.o: in function `v8::internal::Simulator::DecodeTypeOp8()':
simulator-loong64.cc:(.text._ZN2v88internal9Simulator13DecodeTypeOp8Ev+0x9f): undefined reference to `v8_internal_simulator_ProbeMemory'
/usr/bin/ld: simulator-loong64.cc:(.text._ZN2v88internal9Simulator13DecodeTypeOp8Ev+0x135): undefined reference to `v8_internal_simulator_ProbeMemory'
/usr/bin/ld: simulator-loong64.cc:(.text._ZN2v88internal9Simulator13DecodeTypeOp8Ev+0x19e): undefined reference to `v8_internal_simulator_ProbeMemory'
/usr/bin/ld: simulator-loong64.cc:(.text._ZN2v88internal9Simulator13DecodeTypeOp8Ev+0x2e9): undefined reference to `v8_internal_simulator_ProbeMemory'
/usr/bin/ld: /home/node/node-v22.12.0/out/Release/obj.host/v8_base_without_compiler/deps/v8/src/execution/loong64/simulator-loong64.o:simulator-loong64.cc:(.text._ZN2v88internal9Simulator13DecodeTypeOp8Ev+0x41a): more undefined references to `v8_internal_simulator_ProbeMemory' follow
/usr/bin/ld: /home/node/node-v22.12.0/out/Release/obj.host/v8_base_without_compiler/deps/v8/src/trap-handler/handler-inside-posix.o: in function `v8::internal::trap_handler::TryHandleSignal(int, siginfo_t*, void*)':
handler-inside-posix.cc:(.text._ZN2v88internal12trap_handler15TryHandleSignalEiP9siginfo_tPv+0x12a): undefined reference to `v8_simulator_probe_memory_continuation'
/usr/bin/ld: /home/node/node-v22.12.0/out/Release/obj.host/v8_base_without_compiler/deps/v8/src/trap-handler/handler-inside-posix.o: in function `v8::internal::trap_handler::HandleSignal(int, siginfo_t*, void*)':
handler-inside-posix.cc:(.text._ZN2v88internal12trap_handler12HandleSignalEiP9siginfo_tPv+0xf5): undefined reference to `v8_internal_simulator_ProbeMemory'
/usr/bin/ld: handler-inside-posix.cc:(.text._ZN2v88internal12trap_handler12HandleSignalEiP9siginfo_tPv+0x175): undefined reference to `v8_simulator_probe_memory_continuation'
collect2: error: ld returned 1 exit status
make[2]: *** [tools/v8_gypfiles/mksnapshot.host.mk:236: /home/node/node-v22.12.0/out/Release/mksnapshot] Error 1
make[2]: *** Waiting for unfinished jobs....
rm b4a0d10d3c29914b575ce9ad4666728a0d995d28.intermediate bb54289c543f1d9b876c0edabd6e91b29871ca2d.intermediate 29fc33456ce4ab84d02eefe81cbf9d94fdf35786.intermediate 4cee9ba7988dd93bec236edf2979db37428f6a95.intermediate 1382e7b097370c924d1bc8d2ba172e7ce6f4d202.intermediate
make[1]: *** [Makefile:135: node] Error 2
make: *** [Makefile:1279: node-v22.12.0-linux-loong64.tar] Error 2

Additional information

@jakecastelli
Copy link
Member

jakecastelli commented Dec 21, 2024

@wojiushixiaobai
Copy link
Contributor Author

wojiushixiaobai commented Dec 21, 2024

@jakecastelli This is another question, not related to #56271.

  CXX(target) /home/node/node-v23.5.0/out/Release/obj.target/simdjson/deps/simdjson/simdjson.o
  CXX(target) /home/node/node-v23.5.0/out/Release/obj.target/simdutf/deps/simdutf/simdutf.o
In file included from ../deps/simdutf/simdutf.cpp:3:
../deps/simdutf/simdutf.h: In function 'uint32_t simdutf::internal::detect_supported_architectures()':
../deps/simdutf/simdutf.h:1010:15: error: 'HWCAP_LOONGARCH_LSX' was not declared in this scope; did you mean 'NT_LOONGARCH_LSX'?
 1010 |   if (hwcap & HWCAP_LOONGARCH_LSX) {
      |               ^~~~~~~~~~~~~~~~~~~
      |               NT_LOONGARCH_LSX
../deps/simdutf/simdutf.h:1013:15: error: 'HWCAP_LOONGARCH_LASX' was not declared in this scope; did you mean 'NT_LOONGARCH_LASX'?
 1013 |   if (hwcap & HWCAP_LOONGARCH_LASX) {
      |               ^~~~~~~~~~~~~~~~~~~~
      |               NT_LOONGARCH_LASX
make[2]: *** [deps/simdutf/simdutf.target.mk:86: /home/node/node-v23.5.0/out/Release/obj.target/simdutf/deps/simdutf/simdutf.o] Error 1
make[2]: *** Waiting for unfinished jobs....
rm b3e7be9c273d1b3e28c4c7a2c640f007e0b1a736.intermediate d5d23d9e558114923b72eb56873d6fc9b5ff4d1f.intermediate
make[1]: *** [Makefile:135: node] Error 2
make: *** [Makefile:1288: node-v23.5.0-linux-loong64.tar] Error 2

@jakecastelli
Copy link
Member

Sorry about that!

@Xiao-Tao
Copy link
Contributor

Xiao-Tao commented Jan 4, 2025

@wojiushixiaobai
Fix undefined reference to 'v8_internal_simulator_ProbeMemory'
#56466

The loongarch64-clfs-7.3-cross-tools-gcc-glibc.tar.xz compilation toolchain used does not support LSX/LASX yet.
We may need to upgrade the toolchain to Binutils (>=2.41) and GCC (>=14.1.0)
nodejs/unofficial-builds#165

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants