Linux: Remove hardcoded lib path for x86 cross-compilation

This breaks the build with our updated i686 Linux SDK which doesn't contain
this path, and may not be needed at all.

(cherry picked from commit 63153c9d36768b1e5ab9c1562f400a2bd8c2f8cd)
This commit is contained in:
Rémi Verschelde 2023-11-01 14:13:48 +01:00 committed by Relintai
parent 5f0558c000
commit 1089d60dae

View File

@ -119,9 +119,17 @@ def configure(env):
## Architecture ## 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": 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"])
machines = { machines = {
"riscv64": "rv64", "riscv64": "rv64",
@ -402,22 +410,12 @@ def configure(env):
else: else:
env.Append(LINKFLAGS=["-T", "platform/x11/pck_embed.legacy.ld"]) env.Append(LINKFLAGS=["-T", "platform/x11/pck_embed.legacy.ld"])
## Cross-compilation
if is64 and env["bits"] == "32":
env.Append(CCFLAGS=["-m32"])
env.Append(LINKFLAGS=["-m32", "-L/usr/lib/i386-linux-gnu"])
elif not is64 and env["bits"] == "64":
env.Append(CCFLAGS=["-m64"])
env.Append(LINKFLAGS=["-m64", "-L/usr/lib/i686-linux-gnu"])
# Link those statically for portability # Link those statically for portability
if env["use_static_cpp"]: if env["use_static_cpp"]:
env.Append(LINKFLAGS=["-static-libgcc", "-static-libstdc++"]) env.Append(LINKFLAGS=["-static-libgcc", "-static-libstdc++"])
if env["use_llvm"] and platform.system() != "FreeBSD": if env["use_llvm"] and platform.system() != "FreeBSD":
#env["LINKCOM"] = env["LINKCOM"] + " -l:libatomic.a" env["LINKCOM"] = env["LINKCOM"] + " -l:libatomic.a"
env["LINKCOM"] = env["LINKCOM"] + " -latomic" #env["LINKCOM"] = env["LINKCOM"] + " -latomic"
else: else:
if env["use_llvm"] and platform.system() != "FreeBSD": if env["use_llvm"] and platform.system() != "FreeBSD":
env.Append(LIBS=["atomic"]) env.Append(LIBS=["atomic"])