Skip to content

Cross Compilation for arm64 on x64 fails #42544

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

Open
Marv-CZ opened this issue Mar 31, 2022 · 12 comments
Open

Cross Compilation for arm64 on x64 fails #42544

Marv-CZ opened this issue Mar 31, 2022 · 12 comments
Labels
build Issues and PRs related to build files or the CI.

Comments

@Marv-CZ
Copy link

Marv-CZ commented Mar 31, 2022

Version

16.14.2

Platform

Linux (Fedora 34 64bit)

Subsystem

No response

What steps will reproduce the bug?

I cross compile Node.js 16.14.2 from sources for 64bit arm on 64bit Intel PC. I use the following options:

./configure --without-dtrace --without-etw --without-npm --cross-compiling --partly-static --dest-cpu=arm64 --dest-os=linux

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

No response

What is the expected behavior?

No response

What do you see instead?

It fails with following:

g++ -o /home/cernockym/Vyvoj/modulesnodered/packages/nodejs/node-v16.14.2/out/Release/mksnapshot -pthread -rdynamic -m64  -Wl,--start-group /home/cernockym/Vyvoj/modulesnodered/packages/nodejs/node-v16.14.2/out/Release/obj.host/mksnapshot/deps/v8/src/snapshot/embedded/embedded-empty.o /home/cernockym/Vyvoj/modulesnodered/packages/nodejs/node-v16.14.2/out/Release/obj.host/mksnapshot/deps/v8/src/snapshot/embedded/embedded-file-writer.o /home/cernockym/Vyvoj/modulesnodered/packages/nodejs/node-v16.14.2/out/Release/obj.host/mksnapshot/deps/v8/src/snapshot/embedded/platform-embedded-file-writer-aix.o /home/cernockym/Vyvoj/modulesnodered/packages/nodejs/node-v16.14.2/out/Release/obj.host/mksnapshot/deps/v8/src/snapshot/embedded/platform-embedded-file-writer-base.o /home/cernockym/Vyvoj/modulesnodered/packages/nodejs/node-v16.14.2/out/Release/obj.host/mksnapshot/deps/v8/src/snapshot/embedded/platform-embedded-file-writer-generic.o /home/cernockym/Vyvoj/modulesnodered/packages/nodejs/node-v16.14.2/out/Release/obj.host/mksnapshot/deps/v8/src/snapshot/embedded/platform-embedded-file-writer-mac.o /home/cernockym/Vyvoj/modulesnodered/packages/nodejs/node-v16.14.2/out/Release/obj.host/mksnapshot/deps/v8/src/snapshot/embedded/platform-embedded-file-writer-win.o /home/cernockym/Vyvoj/modulesnodered/packages/nodejs/node-v16.14.2/out/Release/obj.host/mksnapshot/deps/v8/src/snapshot/mksnapshot.o /home/cernockym/Vyvoj/modulesnodered/packages/nodejs/node-v16.14.2/out/Release/obj.host/mksnapshot/deps/v8/src/snapshot/snapshot-empty.o /home/cernockym/Vyvoj/modulesnodered/packages/nodejs/node-v16.14.2/out/Release/obj.host/tools/v8_gypfiles/libv8_base_without_compiler.a /home/cernockym/Vyvoj/modulesnodered/packages/nodejs/node-v16.14.2/out/Release/obj.host/tools/v8_gypfiles/libv8_init.a /home/cernockym/Vyvoj/modulesnodered/packages/nodejs/node-v16.14.2/out/Release/obj.host/tools/v8_gypfiles/libv8_libbase.a /home/cernockym/Vyvoj/modulesnodered/packages/nodejs/node-v16.14.2/out/Release/obj.host/tools/v8_gypfiles/libv8_libplatform.a /home/cernockym/Vyvoj/modulesnodered/packages/nodejs/node-v16.14.2/out/Release/obj.host/tools/v8_gypfiles/libv8_zlib.a /home/cernockym/Vyvoj/modulesnodered/packages/nodejs/node-v16.14.2/out/Release/obj.host/tools/v8_gypfiles/libv8_compiler.a /home/cernockym/Vyvoj/modulesnodered/packages/nodejs/node-v16.14.2/out/Release/obj.host/tools/v8_gypfiles/libv8_initializers.a -static-libgcc -static-libstdc++ -ldl -lrt -Wl,--end-group
/usr/bin/ld: /home/cernockym/Vyvoj/modulesnodered/packages/nodejs/node-v16.14.2/out/Release/obj.host/v8_base_without_compiler/deps/v8/src/api/api.o: in function 'v8::TryHandleWebAssemblyTrapPosix(int, siginfo_t*, void*)':
api.cc:(.text._ZN2v829TryHandleWebAssemblyTrapPosixEiP9siginfo_tPv+0x1): undefined reference to 'v8::internal::trap_handler::TryHandleSignal(int, siginfo_t*, void*)'
/usr/bin/ld: /home/cernockym/Vyvoj/modulesnodered/packages/nodejs/node-v16.14.2/out/Release/obj.host/v8_base_without_compiler/deps/v8/src/api/api.o: in function 'v8::V8::TryHandleSignal(int, void*, void*)':
api.cc:(.text._ZN2v82V815TryHandleSignalEiPvS1_+0x1): undefined reference to 'v8::internal::trap_handler::TryHandleSignal(int, siginfo_t*, void*)'
/usr/bin/ld: /home/cernockym/Vyvoj/modulesnodered/packages/nodejs/node-v16.14.2/out/Release/obj.host/v8_base_without_compiler/deps/v8/src/trap-handler/handler-outside.o: in function 'v8::internal::trap_handler::EnableTrapHandler(bool)':
handler-outside.cc:(.text._ZN2v88internal12trap_handler17EnableTrapHandlerEb+0x2d): undefined reference to 'v8::internal::trap_handler::RegisterDefaultTrapHandler()'
/usr/bin/ld: /home/cernockym/Vyvoj/modulesnodered/packages/nodejs/node-v16.14.2/out/Release/obj.host/v8_base_without_compiler/deps/v8/src/execution/arm64/simulator-arm64.o: in function 'v8::internal::Simulator::ProbeMemory(unsigned long, unsigned long)':
simulator-arm64.cc:(.text._ZN2v88internal9Simulator11ProbeMemoryEmm+0x1c): undefined reference to `ProbeMemory'
/usr/bin/ld: /home/cernockym/Vyvoj/modulesnodered/packages/nodejs/node-v16.14.2/out/Release/obj.host/v8_base_without_compiler/deps/v8/src/execution/arm64/simulator-arm64.o: in function 'v8::internal::Simulator::LoadStoreHelper(v8::internal::Instruction*, long, v8::internal::AddrMode)':
simulator-arm64.cc:(.text._ZN2v88internal9Simulator15LoadStoreHelperEPNS0_11InstructionElNS0_8AddrModeE+0x85): undefined reference to 'ProbeMemory'
/usr/bin/ld: /home/cernockym/Vyvoj/modulesnodered/packages/nodejs/node-v16.14.2/out/Release/obj.host/v8_base_without_compiler/deps/v8/src/execution/arm64/simulator-arm64.o: in function 'v8::internal::Simulator::NEONLoadStoreSingleStructHelper(v8::internal::Instruction const*, v8::internal::AddrMode)':
simulator-arm64.cc:(.text._ZN2v88internal9Simulator31NEONLoadStoreSingleStructHelperEPKNS0_11InstructionENS0_8AddrModeE+0xde): undefined reference to 'ProbeMemory'
/usr/bin/ld: simulator-arm64.cc:(.text._ZN2v88internal9Simulator31NEONLoadStoreSingleStructHelperEPKNS0_11InstructionENS0_8AddrModeE+0x258): undefined reference to 'ProbeMemory'
/usr/bin/ld: simulator-arm64.cc:(.text._ZN2v88internal9Simulator31NEONLoadStoreSingleStructHelperEPKNS0_11InstructionENS0_8AddrModeE+0x40a): undefined reference to 'ProbeMemory'
/usr/bin/ld: /home/cernockym/Vyvoj/modulesnodered/packages/nodejs/node-v16.14.2/out/Release/obj.host/v8_base_without_compiler/deps/v8/src/execution/arm64/simulator-arm64.o:simulator-arm64.cc:(.text._ZN2v88internal9Simulator31NEONLoadStoreSingleStructHelperEPKNS0_11InstructionENS0_8AddrModeE+0x83c): more undefined references to 'ProbeMemory' follow
collect2: error: ld returned 1 exit status
make[2]: *** [tools/v8_gypfiles/mksnapshot.host.mk:183: /home/cernockym/Vyvoj/modulesnodered/packages/nodejs/node-v16.14.2/out/Release/mksnapshot] Error1
rm 9f3f2e3c4ad47a90f02b3b7187e9a3474a4663fa.intermediate 7cd555c6c2320e6d4413897b735e5c5c5d6e73a6.intermediate 6bcf538ce384c5de2b15bb794e81c50b7ea812d0.intermediate fc574ff59cc128ac3e7879ba202a247eb6792904.intermediate
make[1]: *** [Makefile:113: node] Error 2

Additional information

No response

@VoltrexKeyva VoltrexKeyva added the build Issues and PRs related to build files or the CI. label Apr 1, 2022
@bnoordhuis
Copy link
Member

bnoordhuis commented Apr 9, 2022

Where did you get the source tarball from? I'm pretty sure simulator-arm64.cc isn't built by the official distribution.

edit: I was wrong, it's scraped at configure time from deps/v8/BUILD.gn.

@Marv-CZ
Copy link
Author

Marv-CZ commented Apr 11, 2022

@Marv-CZ
Copy link
Author

Marv-CZ commented Apr 11, 2022

Actually, no, because of the size, I downloaded xz archive: https://nodejs.org/dist/v16.14.2/node-v16.14.2.tar.xz

@Hypfer
Copy link

Hypfer commented Apr 11, 2022

Can confirm that the same happens by checking out the v16.14.2 git tag

@bnoordhuis
Copy link
Member

Can you check if HEAD of the master branch cross-compiles okay? I think there's a good chance 6ac1ccc fixed this.

@Hypfer
Copy link

Hypfer commented Apr 11, 2022

What I can say right now is that compilation of git tag v17.8.0 works fine
Same for v16.10.0

I can try building HEAD of master later today

@Marv-CZ
Copy link
Author

Marv-CZ commented Apr 11, 2022

Yes, I used 16.10.0 previously and it works fine. I try to find which version is breaking.

@Marv-CZ
Copy link
Author

Marv-CZ commented Apr 12, 2022

So, I tried to build various versions and it is broken from 16.11.0.

I also tried to apply Ben's suggested patch 6ac1ccc back to 16.14.2 and it works. Thank you very much Ben.

@bnoordhuis
Copy link
Member

@targos is 6ac1ccc eligible for cherry-picking to the release branches? Looks low risk to me.

@targos
Copy link
Member

targos commented Apr 14, 2022

I don't have any problem with it if it doesn't break the build.

@bnoordhuis
Copy link
Member

bnoordhuis commented Apr 15, 2022

@Hypfer @Marv-CZ you want to take a stab at back-porting it? Details are here.

edit: deleted an OoO auto-reply from @Tronzo

@nodejs nodejs deleted a comment from Tronzo Apr 15, 2022
@AHgPuK
Copy link
Contributor

AHgPuK commented Jun 14, 2022

Here is a working patch link

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
build Issues and PRs related to build files or the CI.
Projects
None yet
Development

No branches or pull requests

6 participants