Uh oh!
There was an error while loading. Please reload this page.
build: fix arm64 cross-compilation - #51256
Conversation
Commit 938212f added -msign-return-address=all to _all_ cflags but that is wrong when cross-compiling, it should only be added to the target's cflags. The flag being deprecated, it is also changed to `-mbranch-protection=standard`. Fixes: nodejs#42888 Co-Authored-By: Michaël Zasso <targos@protonmail.com>
nodejs-github-bot
commented
Dec 22, 2023
Review requested:
|
nodejs-github-bot
commented
Dec 22, 2023
nodejs-github-bot
commented
Dec 22, 2023
nodejs-github-bot
commented
Dec 27, 2023
Landed in c21b2be |
Commit 938212f added -msign-return-address=all to _all_ cflags but that is wrong when cross-compiling, it should only be added to the target's cflags. The flag being deprecated, it is also changed to `-mbranch-protection=standard`. Fixes: #42888 Co-Authored-By: Michaël Zasso <targos@protonmail.com> PR-URL: #51256Fixes: nodejs/build#3319 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
spmiller
commented
Apr 11, 2024
I've tried cross compiling node 21.7.2, which has this patch, on x86_64 targetting aarch64. The build fails: If I remove the |
richardlau
commented
Apr 12, 2024
This means you are using a compiler earlier than gcc 9 -- |
spmiller
commented
Apr 13, 2024
Hi @richardlau, thanks for looking at this.
I thought this too, but I double-checked and I'd built GCC13. It seems like the build is trying to use the host gcc (it's passing |
richardlau
commented
Apr 13, 2024
Do you have |
spmiller
commented
Apr 14, 2024
Hi @richardlau, I was using: |
richardlau
commented
Apr 17, 2024
mahdisharifithedev
commented
Apr 17, 2024
I was able to cross-compile for ARM64 on my x64 machine with #52559. Here are the commands I used: # Setting up the envexport CC_host="gcc"export CXX_host="g++"export CC="aarch64-linux-gnu-gcc"export CXX="aarch64-linux-gnu-g++"export AS="aarch64-linux-gnu-as"export LD="aarch64-linux-gnu-ld"export RANLIB="aarch64-linux-gnu-ranlib"# Building as a shared library also works with --shared
./configure --dest-cpu arm64 --dest-os linux
# Build it
make -j12 |
spmiller
commented
Apr 29, 2024
Thanks a lot @richardlau and @devraymondsh, I got a successful cross-compilation with those patches too. |
Commit 938212f added -msign-return-address=all to _all_ cflags but that is wrong when cross-compiling, it should only be added to the target's cflags. The flag being deprecated, it is also changed to `-mbranch-protection=standard`. Fixes: #42888 Co-Authored-By: Michaël Zasso <targos@protonmail.com> PR-URL: #51256Fixes: nodejs/build#3319 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Alternative to #45756 (@bnoordhuis)
Commit 938212f added -msign-return-address=all to all cflags but that
is wrong when cross-compiling, it should only be added to the target's
cflags.
The flag being deprecated, it is also changed to
-mbranch-protection=standard.Fixes: #42888
Fixes: nodejs/build#3319