diff --git a/src/BuildToolchains.jl b/src/BuildToolchains.jl index 31fef5f0..e68bcebf 100644 --- a/src/BuildToolchains.jl +++ b/src/BuildToolchains.jl @@ -125,12 +125,16 @@ meson_cxx_link_args(p::AbstractPlatform) = meson_c_link_args(p) meson_objc_link_args(p::AbstractPlatform) = meson_c_link_args(p) meson_fortran_link_args(p::AbstractPlatform) = meson_c_link_args(p) -# We can run native programs only on +# We can run native programs only if the platform matches the default host +# platform, but when this is `x86_64-linux-musl` we can run executables for # * i686-linux-gnu # * x86_64-linux-gnu # * x86_64-linux-musl function meson_is_foreign(p::AbstractPlatform) - if Sys.islinux(p) && proc_family(p) == "intel" && (libc(p) == "glibc" || (libc(p) == "musl" && arch(p) == "x86_64")) + if platforms_match(p, default_host_platform) || + (platforms_match(default_host_platform, Platform("x86_64", "linux"; libc="musl")) + && Sys.islinux(p) && proc_family(p) == "intel" && + (libc(p) == "glibc" || (libc(p) == "musl" && arch(p) == "x86_64"))) # Better to explicitly return the string we expect rather than # relying on the representation of the boolean values (even though # the result is the same) diff --git a/src/Rootfs.jl b/src/Rootfs.jl index 89a01bd7..3af648c6 100644 --- a/src/Rootfs.jl +++ b/src/Rootfs.jl @@ -631,7 +631,7 @@ function choose_shards(p::AbstractPlatform; return shards end -# XXX: we want AnyPlatform to look like `x86_64-linux-musl` in the build environment. +# We want AnyPlatform to look like `default_host_platform` in the build environment. choose_shards(::AnyPlatform; kwargs...) = choose_shards(default_host_platform; kwargs...) """ diff --git a/src/Runner.jl b/src/Runner.jl index cb3e9169..75f80b14 100644 --- a/src/Runner.jl +++ b/src/Runner.jl @@ -11,7 +11,7 @@ export default_host_platform The default host platform in the build environment. """ -const default_host_platform = Platform("x86_64", "linux"; libc="musl", cxxstring_abi="cxx11") +const default_host_platform = Platform(arch(HostPlatform()), "linux"; libc="musl", cxxstring_abi="cxx11") function nbits(p::AbstractPlatform) if arch(p) in ("i686", "armv6l", "armv7l") @@ -44,7 +44,7 @@ function aatriplet(p::AbstractPlatform) t = replace(t, "armv6l" => "arm") return t end -# XXX: we want AnyPlatform to look like `x86_64-linux-musl` in the build environment. +# We want AnyPlatform to look like `default_host_platform` in the build environment. aatriplet(p::AnyPlatform) = aatriplet(default_host_platform) function ld_library_path(target::AbstractPlatform, @@ -896,7 +896,7 @@ function platform_envs(platform::AbstractPlatform, src_name::AbstractString; "dlext" => platform_dlext(platform), "exeext" => platform_exeext(platform), "PATH" => "/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin", - "MACHTYPE" => "x86_64-linux-musl", + "MACHTYPE" => aatriplet(default_host_platform), # Set location parameters "WORKSPACE" => "/workspace", diff --git a/src/utils.jl b/src/utils.jl index 8a2147e5..0ac8070d 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -57,6 +57,6 @@ function get_concrete_platform(platform::AbstractPlatform; kwargs...) return get_concrete_platform(platform, shards) end -# XXX: we want the AnyPlatform to look like `x86_64-linux-musl`, +# We want the AnyPlatform to look like `default_host_platform`, get_concrete_platform(::AnyPlatform, shards::Vector{CompilerShard}) = get_concrete_platform(default_host_platform, shards)