From 19be158d8814030b271d6d6f496d502c73a47635 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Tue, 6 Feb 2024 01:24:11 +0100 Subject: [PATCH] Fix build on X11 following 64-bit detection changes This also ports over the cross-compilation logic to the `server` platform, and allows Embree to be used in server tools builds on aarch64. --- platform/server/detect.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/platform/server/detect.py b/platform/server/detect.py index 447e948136..f06d466139 100644 --- a/platform/server/detect.py +++ b/platform/server/detect.py @@ -83,9 +83,17 @@ def configure(env): ## Architecture - is64 = sys.maxsize > 2 ** 32 + # Cross-compilation + # TODO: Support cross-compilation on architectures other than x86. + host_is_64_bit = sys.maxsize > 2**32 if env["bits"] == "default": - env["bits"] = "64" if is64 else "32" + env["bits"] = "64" if host_is_64_bit else "32" + if host_is_64_bit and (env["bits"] == "32" or env["arch"] == "x86"): + env.Append(CCFLAGS=["-m32"]) + env.Append(LINKFLAGS=["-m32"]) + elif not host_is_64_bit and (env["bits"] == "64" or env["arch"] == "x86_64"): + env.Append(CCFLAGS=["-m64"]) + env.Append(LINKFLAGS=["-m64"]) if env["arch"] == "" and platform.machine() == "riscv64": env["arch"] = "rv64"