Repository navigation
Cross-compilation bug when compiling for loongarch64 on a non-loongarch64 host with Linux #56280
Description
Activity
wojiushixiaobai commented
on Dec 21, 2024 ContributorAuthorMore actions@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
Sorry about that!
@wojiushixiaobai
Fixundefined reference to 'v8_internal_simulator_ProbeMemory'
#56466The 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#165wojiushixiaobai commented
on Mar 10, 2025 ContributorAuthorMore actions@Xiao-Tao Feedback a new question.
- https://github.com/loong64/node/actions/runs/13754844958/job/38460588897
- https://github.com/loong64/node/actions/runs/13754844958/job/38460589684
Done, source tarball is at /home/runner/work/node/node/workdir/staging/src/v18.20.7/node-v18.20.7.tar.xz Building musl recipe... WARNING: The requested image's platform (linux/loong64) does not match the detected host platform (linux/amd64/v3) and no specific platform was requested + release_urlbase=https://unofficial-builds.nodejs.org/download/release/ + disttype=release + customtag= + datestring= + commit= + fullversion=v18.20.7 + source_url=https://nodejs.org/download/release/v18.20.7/node-v18.20.7.tar.xz + source_urlbase=https://nodejs.org/download/release/v18.20.7 + config_flags=--openssl-no-asm + cd /home/node + tar -xf node.tar.xz + cd node-v18.20.7 + export 'CC=ccache gcc' + CC='ccache gcc' + export 'CXX=ccache g++' + CXX='ccache g++' ++ getconf _NPROCESSORS_ONLN + make -j4 binary V= DESTCPU=loong64 ARCH=loong64 VARIATION=musl DISTTYPE=release CUSTOMTAG= DATESTRING= COMMIT= RELEASE_URLBASE=https://unofficial-builds.nodejs.org/download/release/ CONFIG_FLAGS=--openssl-no-asm /bin/sh: git: not found rm -f -r node-v18.20.7-linux-loong64-musl rm -f -r out/deps out/Release python3 ./configure \ --prefix=/ \ --dest-cpu=loong64 \ --tag= \ --release-urlbase=https://unofficial-builds.nodejs.org/download/release/ \ --openssl-no-asm --download=all --with-intl=full-icu Node.js configure: Found Python 3.12.9... WARNING: --openssl-no-asm will result in binaries that do not take advantage of modern CPU cryptographic instructions and will therefore be slower. Please refer to BUILDING.md WARNING: warnings were emitted in the configure phase INFO: configure completed successfully /usr/bin/make install DESTDIR=node-v18.20.7-linux-loong64-musl V= PORTABLE=1 /usr/bin/make -C out BUILDTYPE=Release V=
CXX(target) /home/node/node-v18.20.7/out/Release/obj.target/libnode/src/crypto/crypto_context.o In file included from ../deps/postject/postject-api.h:14, from ../src/node_sea.cc:16: /usr/include/link.h:22:9: error: 'Elf64_Addr' does not name a type 22 | ElfW(Addr) dlpi_addr; | ^~~~ /usr/include/link.h:24:15: error: 'Elf64_Phdr' does not name a type 24 | const ElfW(Phdr) *dlpi_phdr; | ^~~~ /usr/include/link.h:25:9: error: 'Elf64_Half' does not name a type 25 | ElfW(Half) dlpi_phnum; | ^~~~ /usr/include/link.h:33:9: error: 'Elf64_Addr' does not name a type 33 | ElfW(Addr) l_addr; | ^~~~ /usr/include/link.h:35:9: error: 'Elf64_Dyn' does not name a type 35 | ElfW(Dyn) *l_ld; | ^~~~ /usr/include/link.h:42:9: error: 'Elf64_Addr' does not name a type 42 | ElfW(Addr) r_brk; | ^~~~ /usr/include/link.h:44:9: error: 'Elf64_Addr' does not name a type 44 | ElfW(Addr) r_ldbase; | ^~~~ ../deps/postject/postject-api.h: In function 'const void* postject_find_resource(const char*, size_t*, const postject_options*)': ../deps/postject/postject-api.h:129:46: error: 'struct dl_phdr_info' has no member named 'dlpi_phdr'; did you mean 'dlpi_adds'? 129 | uintptr_t p = (uintptr_t)main_program_info.dlpi_phdr; | ^~~~~~~~~ | dlpi_adds ../deps/postject/postject-api.h:130:32: error: 'struct dl_phdr_info' has no member named 'dlpi_phnum' 130 | size_t n = main_program_info.dlpi_phnum; | ^~~~~~~~~~ ../deps/postject/postject-api.h:131:43: error: 'struct dl_phdr_info' has no member named 'dlpi_addr'; did you mean 'dlpi_adds'? 131 | uintptr_t base_addr = main_program_info.dlpi_addr; | ^~~~~~~~~ | dlpi_adds ../deps/postject/postject-api.h:134:34: error: 'Elf64_Phdr' was not declared in this scope; did you mean 'simdutf::internal::Elf64_Phdr'? 134 | for (; n > 0; n--, p += sizeof(ElfW(Phdr))) { | ^~~~ In file included from /usr/include/sys/auxv.h:8, from ../deps/simdutf/simdutf.h:999, from ../src/node_sea.cc:7: /usr/include/elf.h:597:3: note: 'simdutf::internal::Elf64_Phdr' declared here 597 | } Elf64_Phdr; | ^~~~~~~~~~ ../deps/postject/postject-api.h:135:17: error: 'phdr' was not declared in this scope; did you mean 'tcphdr'? 135 | ElfW(Phdr)* phdr = (ElfW(Phdr)*)p; | ^~~~ | tcphdr ../deps/postject/postject-api.h:135:36: error: expected primary-expression before ')' token 135 | ElfW(Phdr)* phdr = (ElfW(Phdr)*)p; | ^ ../deps/postject/postject-api.h:148:24: error: 'Elf64_Nhdr' was not declared in this scope; did you mean 'simdutf::internal::Elf64_Nhdr'? 148 | if (pos + sizeof(ElfW(Nhdr)) > end) { | ^~~~ /usr/include/elf.h:1080:3: note: 'simdutf::internal::Elf64_Nhdr' declared here 1080 | } Elf64_Nhdr; | ^~~~~~~~~~ ../deps/postject/postject-api.h:152:7: error: 'Elf64_Nhdr' was not declared in this scope; did you mean 'simdutf::internal::Elf64_Nhdr'? 152 | ElfW(Nhdr)* note = (ElfW(Nhdr)*)(uintptr_t)pos; | ^~~~ /usr/include/elf.h:1080:3: note: 'simdutf::internal::Elf64_Nhdr' declared here 1080 | } Elf64_Nhdr; | ^~~~~~~~~~ ../deps/postject/postject-api.h:152:19: error: 'note' was not declared in this scope; did you mean 'node'? 152 | ElfW(Nhdr)* note = (ElfW(Nhdr)*)(uintptr_t)pos; | ^~~~ | node ../deps/postject/postject-api.h:152:38: error: expected primary-expression before ')' token 152 | ElfW(Nhdr)* note = (ElfW(Nhdr)*)(uintptr_t)pos; | ^ ../deps/postject/postject-api.h:152:49: error: expected primary-expression before ')' token 152 | ElfW(Nhdr)* note = (ElfW(Nhdr)*)(uintptr_t)pos; | ^ make[2]: *** [libnode.target.mk:435: /home/node/node-v18.20.7/out/Release/obj.target/libnode/src/node_sea.o] Error 1 make[2]: *** Waiting for unfinished jobs.... rm 2df1916b8b4150fc990af368fcf6e90c1992bbd1.intermediate 9c0e6b56e087088647d0eae76012a1ff1730b388.intermediate 38cf139ba6b3cd5b1e33129273a666243bb1704f.intermediate make[1]: *** [Makefile:135: node] Error 2 make: *** [Makefile:1280: node-v18.20.7-linux-loong64-musl.tar] Error 2@wojiushixiaobai Thanks for the report!!!
This issue has been fixed at simdutf/simdutf#691CXX(target) /home/node/node-v18.20.7/out/Release/obj.target/libnode/src/crypto/crypto_context.o
In file included from ../deps/postject/postject-api.h:14,
from ../src/node_sea.cc:16:
/usr/include/link.h:22:9: error: 'Elf64_Addr' does not name a type
22 | ElfW(Addr) dlpi_addr;
| ^~~~
/usr/include/link.h:24:15: error: 'Elf64_Phdr' does not name a type
24 | const ElfW(Phdr) *dlpi_phdr;
| ^~~~Upgrading simdutf to 6.2.1 may solve the issue
Reacted by 吴小白Reacted by JOHANA DE ROXASwojiushixiaobai commented
on May 16, 2025 ContributorAuthorMore actions@Xiao-Tao Upgrading
simdutfto6.2.1, build completed.
Version
v22.12.0
Platform
Subsystem
Cross-compiling for Linux loongarch64 on a Linux x86_64 machine.
What steps will reproduce the bug?
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?
Additional information