build: fix arm64 host cross-compilation in GN

Should use `current_cpu` instead of `target_cpu` in GN build files,
otherwise the host build may use wrong configs when doing cross
compilation.

PR-URL: https://github.com/nodejs/node/pull/51903
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Cheng Zhao 2024-02-28 09:48:27 +09:00
parent d96606d9aa
commit 384fd17876
4 changed files with 27 additions and 25 deletions

View file

@ -54,8 +54,10 @@ declare_args() {
node_use_node_code_cache = host_os == target_os && host_cpu == target_cpu
# Use snapshot to speed up startup.
# TODO(zcbenz): node_mksnapshot is not ready for cross-os compilation.
node_use_node_snapshot = host_os == target_os
# TODO(zcbenz): There are few broken things for now:
# 1. cross-os compilation is not supported.
# 2. node_mksnapshot crashes when cross-compiling for x64 from arm64.
node_use_node_snapshot = (host_os == target_os) && !(host_cpu == "arm64" && target_cpu == "x64")
}
assert(!node_enable_inspector || node_use_openssl,