From 0fe40dadfad477c62c968b136f84f714823e7543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= Date: Sun, 19 Oct 2025 21:27:43 +0100 Subject: [PATCH 1/2] [Rootfs] Exclude some old ABIs from output of `expand_*` functions This was [announced](https://discourse.julialang.org/t/psa-intent-to-deprecate-cxx03-libgfortran3-libgfortran4-abis/130799) a few months ago and no one reacted, this implements the suggested changes. --- Project.toml | 2 +- src/Rootfs.jl | 17 ++++------------- test/rootfs.jl | 12 ------------ 3 files changed, 5 insertions(+), 26 deletions(-) diff --git a/Project.toml b/Project.toml index 63921a0b..eddbdead 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "BinaryBuilderBase" uuid = "7f725544-6523-48cd-82d1-3fa08ff4056e" authors = ["Elliot Saba "] -version = "1.41.0" +version = "1.42.0" [deps] Bzip2_jll = "6e34b625-4abd-537c-b88f-471c36dfa7a0" diff --git a/src/Rootfs.jl b/src/Rootfs.jl index aa7f00da..1b56df6f 100644 --- a/src/Rootfs.jl +++ b/src/Rootfs.jl @@ -850,17 +850,8 @@ function expand_gfortran_versions(platform::AbstractPlatform) return [platform] #MSAN doesn't use libgfortran, it uses libflang end - # If this is an platform that has limited GCC support (such as aarch64-apple-darwin), - # the libgfortran versions we can expand to are similarly limited. - local libgfortran_versions - if Sys.isbsd(platform) && arch(platform) == "aarch64" - libgfortran_versions = [v"5"] - elseif arch(platform) == "riscv64" - # We don't have older GCC versions - libgfortran_versions = [v"5"] - else - libgfortran_versions = [v"3", v"4", v"5"] - end + # At the moment we only support libgfortran 5. + libgfortran_versions = [v"5",] # Create a new platform for each libgfortran version return map(libgfortran_versions) do v @@ -899,8 +890,8 @@ function expand_cxxstring_abis(platform::AbstractPlatform; skip=Sys.isbsd) return [p] end - # Otherwise, generate new versions! - map(["cxx03", "cxx11"]) do abi + # Otherwise, generate new versions! At the moment we only support the C++11 string ABI. + map(["cxx11",]) do abi p = deepcopy(platform) p["cxxstring_abi"] = abi return p diff --git a/test/rootfs.jl b/test/rootfs.jl index 9081d1d0..aa1a2934 100644 --- a/test/rootfs.jl +++ b/test/rootfs.jl @@ -6,23 +6,15 @@ using BinaryBuilderBase: RustBuild, CompilerShard @testset "Expand platforms" begin # expand_gfortran_versions @test expand_gfortran_versions(Platform("i686", "windows")) == [ - Platform("i686", "windows"; libgfortran_version=v"3"), - Platform("i686", "windows"; libgfortran_version=v"4"), Platform("i686", "windows"; libgfortran_version=v"5"), ] @test expand_gfortran_versions([Platform("i686", "windows"), Platform("x86_64", "windows")]) == [ - Platform("i686", "windows"; libgfortran_version=v"3"), - Platform("i686", "windows"; libgfortran_version=v"4"), Platform("i686", "windows"; libgfortran_version=v"5"), - Platform("x86_64", "windows"; libgfortran_version=v"3"), - Platform("x86_64", "windows"; libgfortran_version=v"4"), Platform("x86_64", "windows"; libgfortran_version=v"5"), ] @test expand_gfortran_versions([Platform("x86_64", "freebsd"; libgfortran_version=v"3")]) == [Platform("x86_64", "freebsd"; libgfortran_version=v"3")] @test expand_gfortran_versions([Platform("x86_64", "macos"), Platform("aarch64", "macos")]) == [ - Platform("x86_64", "macos"; libgfortran_version=v"3"), - Platform("x86_64", "macos"; libgfortran_version=v"4"), Platform("x86_64", "macos"; libgfortran_version=v"5"), Platform("aarch64", "macos"; libgfortran_version=v"5"), ] @@ -34,7 +26,6 @@ using BinaryBuilderBase: RustBuild, CompilerShard # expand_cxxstring_abis @test expand_cxxstring_abis(Platform("x86_64", "linux"; libc="musl")) == [ - Platform("x86_64", "linux", libc="musl", cxxstring_abi="cxx03"), Platform("x86_64", "linux", libc="musl", cxxstring_abi="cxx11"), ] @test expand_cxxstring_abis([Platform("x86_64", "freebsd"), Platform("x86_64", "macos")]) == [ @@ -42,13 +33,10 @@ using BinaryBuilderBase: RustBuild, CompilerShard Platform("x86_64", "macos"), ] @test expand_cxxstring_abis([Platform("x86_64", "freebsd"), Platform("x86_64", "macos")]; skip=_->false) == [ - Platform("x86_64", "freebsd"; cxxstring_abi="cxx03"), Platform("x86_64", "freebsd"; cxxstring_abi="cxx11"), - Platform("x86_64", "macos"; cxxstring_abi="cxx03"), Platform("x86_64", "macos"; cxxstring_abi="cxx11"), ] @test expand_cxxstring_abis([Platform("x86_64", "freebsd"), Platform("x86_64", "linux")]; skip=Sys.islinux) == [ - Platform("x86_64", "freebsd"; cxxstring_abi="cxx03"), Platform("x86_64", "freebsd"; cxxstring_abi="cxx11"), Platform("x86_64", "linux"), ] From a0c34b83e94ec7092b5a263dd82506e3a3192ad6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= Date: Mon, 20 Oct 2025 22:56:09 +0100 Subject: [PATCH 2/2] Add new keyword argument for restoring old behaviour --- src/Rootfs.jl | 35 +++++++++++++++++++++++++---------- test/rootfs.jl | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 10 deletions(-) diff --git a/src/Rootfs.jl b/src/Rootfs.jl index 1b56df6f..35b93f36 100644 --- a/src/Rootfs.jl +++ b/src/Rootfs.jl @@ -831,16 +831,18 @@ function supported_platforms(;exclude::Union{Vector{<:Platform},Function}=Return end """ - expand_gfortran_versions(p::AbstractPlatform) + expand_gfortran_versions(p::AbstractPlatform; old_abis::Bool=false) Given a `Platform`, returns an array of `Platforms` with a spread of identical entries with the exception of the `libgfortran_version` tag within the `Platform`. This is used to take, for example, a list of supported platforms and expand them to include multiple GCC versions for the purposes of ABI matching. If the given `Platform` already specifies a `libgfortran_version` -(as opposed to `nothing`) only that `Platform` is returned. +(as opposed to `nothing`) only that `Platform` is returned. If `old_abis` is +`true`, old ABIs are included in the expanded list, otherwise only the new +ones are included. """ -function expand_gfortran_versions(platform::AbstractPlatform) +function expand_gfortran_versions(platform::AbstractPlatform; old_abis::Bool=false) # If this platform is already explicitly libgfortran-versioned, exit out fast here. if libgfortran_version(platform) !== nothing return [platform] @@ -850,8 +852,16 @@ function expand_gfortran_versions(platform::AbstractPlatform) return [platform] #MSAN doesn't use libgfortran, it uses libflang end - # At the moment we only support libgfortran 5. - libgfortran_versions = [v"5",] + # If this is an platform that has limited GCC support (such as aarch64-apple-darwin), + # the libgfortran versions we can expand to are similarly limited. + libgfortran_versions = if Sys.isbsd(platform) && arch(platform) == "aarch64" + [v"5"] + elseif arch(platform) == "riscv64" + # We don't have older GCC versions + [v"5"] + else + old_abis ? [v"3", v"4", v"5"] : [v"5"] + end # Create a new platform for each libgfortran version return map(libgfortran_versions) do v @@ -860,12 +870,12 @@ function expand_gfortran_versions(platform::AbstractPlatform) return p end end -function expand_gfortran_versions(ps::Vector{T}) where {T<:AbstractPlatform} - return collect(T,Iterators.flatten(expand_gfortran_versions.(ps))) +function expand_gfortran_versions(ps::Vector{T}; old_abis::Bool=false) where {T<:AbstractPlatform} + return collect(T,Iterators.flatten(expand_gfortran_versions.(ps; old_abis))) end """ - expand_cxxstring_abis(p::AbstractPlatform; skip=Sys.isbsd) + expand_cxxstring_abis(p::AbstractPlatform; skip=Sys.isbsd, old_abis::Bool=false) Given a `Platform`, returns an array of `Platforms` with a spread of identical entries with the exception of the `cxxstring_abi` tag within the `Platform` @@ -877,8 +887,12 @@ If the given `Platform` already specifies a `cxxstring_abi` (as opposed to `skip(platform)` evaluates to `true`, the given platform is not expanded. By default FreeBSD and macOS platforms are skipped, due to their lack of a dependence on `libstdc++` and not needing this compatibility shim. + +If `old_abis` is `true`, old ABIs are included in the expanded list, otherwise +only the new ones are included. + """ -function expand_cxxstring_abis(platform::AbstractPlatform; skip=Sys.isbsd) +function expand_cxxstring_abis(platform::AbstractPlatform; skip=Sys.isbsd, old_abis::Bool=false) # If this platform cannot/should not be expanded, then exit out fast here. if cxxstring_abi(platform) !== nothing || skip(platform) return [platform] @@ -891,7 +905,8 @@ function expand_cxxstring_abis(platform::AbstractPlatform; skip=Sys.isbsd) end # Otherwise, generate new versions! At the moment we only support the C++11 string ABI. - map(["cxx11",]) do abi + abis = old_abis ? ["cxx03", "cxx11"] : ["cxx11"] + map(abis) do abi p = deepcopy(platform) p["cxxstring_abi"] = abi return p diff --git a/test/rootfs.jl b/test/rootfs.jl index aa1a2934..73241d8c 100644 --- a/test/rootfs.jl +++ b/test/rootfs.jl @@ -8,16 +8,35 @@ using BinaryBuilderBase: RustBuild, CompilerShard @test expand_gfortran_versions(Platform("i686", "windows")) == [ Platform("i686", "windows"; libgfortran_version=v"5"), ] + @test expand_gfortran_versions(Platform("i686", "windows"); old_abis=true) == [ + Platform("i686", "windows"; libgfortran_version=v"3"), + Platform("i686", "windows"; libgfortran_version=v"4"), + Platform("i686", "windows"; libgfortran_version=v"5"), + ] @test expand_gfortran_versions([Platform("i686", "windows"), Platform("x86_64", "windows")]) == [ Platform("i686", "windows"; libgfortran_version=v"5"), Platform("x86_64", "windows"; libgfortran_version=v"5"), ] + @test expand_gfortran_versions([Platform("i686", "windows"), Platform("x86_64", "windows")]; old_abis=true) == [ + Platform("i686", "windows"; libgfortran_version=v"3"), + Platform("i686", "windows"; libgfortran_version=v"4"), + Platform("i686", "windows"; libgfortran_version=v"5"), + Platform("x86_64", "windows"; libgfortran_version=v"3"), + Platform("x86_64", "windows"; libgfortran_version=v"4"), + Platform("x86_64", "windows"; libgfortran_version=v"5"), + ] @test expand_gfortran_versions([Platform("x86_64", "freebsd"; libgfortran_version=v"3")]) == [Platform("x86_64", "freebsd"; libgfortran_version=v"3")] @test expand_gfortran_versions([Platform("x86_64", "macos"), Platform("aarch64", "macos")]) == [ Platform("x86_64", "macos"; libgfortran_version=v"5"), Platform("aarch64", "macos"; libgfortran_version=v"5"), ] + @test expand_gfortran_versions([Platform("x86_64", "macos"), Platform("aarch64", "macos")]; old_abis=true) == [ + Platform("x86_64", "macos"; libgfortran_version=v"3"), + Platform("x86_64", "macos"; libgfortran_version=v"4"), + Platform("x86_64", "macos"; libgfortran_version=v"5"), + Platform("aarch64", "macos"; libgfortran_version=v"5"), + ] @test expand_gfortran_versions(Platform("aarch64", "freebsd")) == [Platform("aarch64", "freebsd"; libgfortran_version=v"5")] @test expand_gfortran_versions([Platform("x86_64", "linux"; sanitize="memory")]) == @@ -28,6 +47,10 @@ using BinaryBuilderBase: RustBuild, CompilerShard @test expand_cxxstring_abis(Platform("x86_64", "linux"; libc="musl")) == [ Platform("x86_64", "linux", libc="musl", cxxstring_abi="cxx11"), ] + @test expand_cxxstring_abis(Platform("x86_64", "linux"; libc="musl"); old_abis=true) == [ + Platform("x86_64", "linux", libc="musl", cxxstring_abi="cxx03"), + Platform("x86_64", "linux", libc="musl", cxxstring_abi="cxx11"), + ] @test expand_cxxstring_abis([Platform("x86_64", "freebsd"), Platform("x86_64", "macos")]) == [ Platform("x86_64", "freebsd"), Platform("x86_64", "macos"), @@ -36,10 +59,21 @@ using BinaryBuilderBase: RustBuild, CompilerShard Platform("x86_64", "freebsd"; cxxstring_abi="cxx11"), Platform("x86_64", "macos"; cxxstring_abi="cxx11"), ] + @test expand_cxxstring_abis([Platform("x86_64", "freebsd"), Platform("x86_64", "macos")]; skip=_->false, old_abis=true) == [ + Platform("x86_64", "freebsd"; cxxstring_abi="cxx03"), + Platform("x86_64", "freebsd"; cxxstring_abi="cxx11"), + Platform("x86_64", "macos"; cxxstring_abi="cxx03"), + Platform("x86_64", "macos"; cxxstring_abi="cxx11"), + ] @test expand_cxxstring_abis([Platform("x86_64", "freebsd"), Platform("x86_64", "linux")]; skip=Sys.islinux) == [ Platform("x86_64", "freebsd"; cxxstring_abi="cxx11"), Platform("x86_64", "linux"), ] + @test expand_cxxstring_abis([Platform("x86_64", "freebsd"), Platform("x86_64", "linux")]; skip=Sys.islinux, old_abis=true) == [ + Platform("x86_64", "freebsd"; cxxstring_abi="cxx03"), + Platform("x86_64", "freebsd"; cxxstring_abi="cxx11"), + Platform("x86_64", "linux"), + ] @test expand_cxxstring_abis([Platform("i686", "linux"; cxxstring_abi="cxx11")]) == [Platform("i686", "linux"; cxxstring_abi="cxx11")] @test expand_cxxstring_abis([Platform("x86_64", "linux"; sanitize="memory")]) ==