diff --git a/src/AutoBuild.jl b/src/AutoBuild.jl index 6252f96f7..b6984f708 100644 --- a/src/AutoBuild.jl +++ b/src/AutoBuild.jl @@ -629,25 +629,41 @@ function autobuild(dir::AbstractString, build_path = joinpath(dir, "build", triplet(platform)) mkpath(build_path) + shards = choose_shards(platform; extract_kwargs(kwargs, (:preferred_gcc_version,:preferred_llvm_version,:bootstrap_list,:compilers))...) + # We want to get dependencies that have exactly the same GCC ABI as the + # choosen compiler, otherwise we risk, e.g., to build in an environment + # with libgfortran3 a dependency built with libgfortran5. + # `concrete_platform` is needed only to setup the dependencies and the + # runner. We _don't_ want the platform passed to `audit()` or + # `package()` to be more specific than it is. + concrete_platform = platform + gccboostrap_shard_idx = findfirst(x -> x.name == "GCCBootstrap" && x.target.arch == platform.arch && x.target.libc == platform.libc, shards) + if !isnothing(gccboostrap_shard_idx) + libgfortran_version = preferred_libgfortran_version(platform, shards[gccboostrap_shard_idx]) + cxxstring_abi = preferred_cxxstring_abi(platform, shards[gccboostrap_shard_idx]) + concrete_platform = replace_cxxstring_abi(replace_libgfortran_version(platform, libgfortran_version), cxxstring_abi) + end + prefix = setup_workspace( build_path, src_paths, src_hashes; verbose=verbose, ) - artifact_paths = setup_dependencies(prefix, dependencies, platform) + artifact_paths = setup_dependencies(prefix, dependencies, concrete_platform) # Create a runner to work inside this workspace with the nonce built-in ur = preferred_runner()( prefix.path; cwd = "/workspace/srcdir", - platform = platform, + platform = concrete_platform, verbose = verbose, workspaces = [ joinpath(prefix, "metadir") => "/meta", ], compiler_wrapper_dir = joinpath(prefix, "compiler_wrappers"), src_name = src_name, + shards = shards, extract_kwargs(kwargs, (:preferred_gcc_version,:preferred_llvm_version,:compilers,:allow_unsafe_flags))..., ) diff --git a/src/DockerRunner.jl b/src/DockerRunner.jl index 1aa666277..7a181874d 100644 --- a/src/DockerRunner.jl +++ b/src/DockerRunner.jl @@ -72,6 +72,7 @@ function DockerRunner(workspace_root::String; verbose::Bool = false, compiler_wrapper_path::String = mktempdir(), src_name::AbstractString = "", + shards = nothing, kwargs...) global use_ccache @@ -97,8 +98,10 @@ function DockerRunner(workspace_root::String; push!(workspaces, "binarybuilder_ccache" => "/root/.ccache") end - # Choose the shards we're going to mount - shards = choose_shards(platform; extract_kwargs(kwargs, (:preferred_gcc_version,:preferred_llvm_version,:bootstrap_list,:compilers))...) + if isnothing(shards) + # Choose the shards we're going to mount + shards = choose_shards(platform; extract_kwargs(kwargs, (:preferred_gcc_version,:preferred_llvm_version,:bootstrap_list,:compilers))...) + end # Import docker image import_docker_image(shards[1], workspace_root; verbose=verbose) diff --git a/src/Rootfs.jl b/src/Rootfs.jl index 9303a0a57..6584ad5d4 100644 --- a/src/Rootfs.jl +++ b/src/Rootfs.jl @@ -319,15 +319,78 @@ function select_closest_version(preferred::VersionNumber, versions::Vector{Versi return versions[closest_idx] end -const available_gcc_builds = [v"4.8.5", v"5.2.0", v"6.1.0", v"7.1.0", v"8.1.0", v"9.1.0"] -const available_llvm_builds = [v"6.0.1", v"7.1.0", v"8.0.1", v"9.0.1"] +abstract type CompilerBuild end + +struct GCCBuild <: CompilerBuild + version::VersionNumber + abi::CompilerABI +end +GCCBuild(v::VersionNumber) = GCCBuild(v, CompilerABI()) + +struct LLVMBuild <: CompilerBuild + version::VersionNumber + abi::CompilerABI +end +LLVMBuild(v::VersionNumber) = LLVMBuild(v, CompilerABI()) + +getversion(c::CompilerBuild) = c.version +getabi(c::CompilerBuild) = c.abi + +const available_gcc_builds = [GCCBuild(v"4.8.5", CompilerABI(libgfortran_version = v"3", libstdcxx_version = v"3.4.19", cxxstring_abi = :cxx03)), + GCCBuild(v"5.2.0", CompilerABI(libgfortran_version = v"3", libstdcxx_version = v"3.4.21", cxxstring_abi = :cxx11)), + GCCBuild(v"6.1.0", CompilerABI(libgfortran_version = v"3", libstdcxx_version = v"3.4.22", cxxstring_abi = :cxx11)), + GCCBuild(v"7.1.0", CompilerABI(libgfortran_version = v"4", libstdcxx_version = v"3.4.23", cxxstring_abi = :cxx11)), + GCCBuild(v"8.1.0", CompilerABI(libgfortran_version = v"5", libstdcxx_version = v"3.4.25", cxxstring_abi = :cxx11)), + GCCBuild(v"9.1.0", CompilerABI(libgfortran_version = v"5", libstdcxx_version = v"3.4.26", cxxstring_abi = :cxx11))] +const available_llvm_builds = [LLVMBuild(v"6.0.1"), + LLVMBuild(v"7.1.0"), + LLVMBuild(v"8.0.1"), + LLVMBuild(v"9.0.1")] + +""" + gcc_version(cabi::CompilerABI, GCC_builds::Vector{GCCBuild}) + +Returns the closest matching GCC version number for the given CompilerABI +representing a particular platofrm, from the given set of options. If no match +is found, returns an empty list. This method assumes that `cabi` represents a +platform that binaries will be run on, and thus versions are always rounded +down; e.g. if the platform supports a `libstdc++` version that corresponds to +`GCC 5.1.0`, but the only GCC versions available to be picked from are `4.8.5` +and `5.2.0`, it will return `4.8.5`, as binaries compiled with that version +will run on this platform, whereas binaries compiled with `5.2.0` may not. +""" +function gcc_version(cabi::CompilerABI, GCC_builds::Vector{GCCBuild}) + # First, filter by libgfortran version. + if cabi.libgfortran_version !== nothing + GCC_builds = filter(b -> getabi(b).libgfortran_version == cabi.libgfortran_version, GCC_builds) + end + + # Next, filter by libstdc++ GLIBCXX symbol version. Note that this + # mapping is conservative; it is often the case that we return a + # version that is slightly lower than what is actually installed on + # a system. See https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html + # for the whole list, as well as many other interesting factoids. + if cabi.libstdcxx_version !== nothing + GCC_builds = filter(b -> getabi(b).libstdcxx_version <= cabi.libstdcxx_version, GCC_builds) + end + + # Finally, enforce cxxstring_abi guidelines. It is possible to build + # :cxx03 binaries on GCC 5+, (although increasingly rare) so the only + # filtering we do is that if the platform is explicitly :cxx11, we + # disallow running on < GCC 5. + if cabi.cxxstring_abi !== nothing && cabi.cxxstring_abi === :cxx11 + GCC_builds = filter(b -> getversion(b) >= v"5", GCC_builds) + end + + return getversion.(GCC_builds) +end function select_gcc_version(p::Platform, - GCC_builds::Vector{VersionNumber} = available_gcc_builds, - preferred_gcc_version::VersionNumber = GCC_builds[1], + GCC_builds::Vector{GCCBuild} = available_gcc_builds, + preferred_gcc_version::VersionNumber = getversion(GCC_builds[1]), ) # Determine which GCC build we're going to match with this CompilerABI: - GCC_builds = Pkg.BinaryPlatforms.gcc_version(compiler_abi(p), GCC_builds) + GCC_builds = gcc_version(compiler_abi(p), GCC_builds) if isempty(GCC_builds) error("Impossible CompilerABI constraints $(cabi)!") @@ -350,19 +413,22 @@ function choose_shards(p::Platform; compilers::Vector{Symbol} = [:c], rootfs_build::VersionNumber=v"2020.01.07", ps_build::VersionNumber=v"2020.01.15", - GCC_builds::Vector{VersionNumber}=available_gcc_builds, - LLVM_builds::Vector{VersionNumber}=available_llvm_builds, + GCC_builds::Vector{GCCBuild}=available_gcc_builds, + LLVM_builds::Vector{LLVMBuild}=available_llvm_builds, Rust_build::VersionNumber=v"1.18.3", Go_build::VersionNumber=v"1.13", archive_type::Symbol = (use_squashfs ? :squashfs : :unpacked), bootstrap_list::Vector{Symbol} = bootstrap_list, - # We prefer the oldest GCC version by default - preferred_gcc_version::VersionNumber = GCC_builds[1], - preferred_llvm_version::VersionNumber = LLVM_builds[end], + # Because GCC has lots of compatibility issues, we always default to + # the earliest version possible. + preferred_gcc_version::VersionNumber = getversion(GCC_builds[1]), + # Because LLVM doesn't have compatibilty issues, we always default + # to the newest version possible. + preferred_llvm_version::VersionNumber = getversion(LLVM_builds[end]), ) GCC_build = select_gcc_version(p, GCC_builds, preferred_gcc_version) - LLVM_build = select_closest_version(preferred_llvm_version, LLVM_builds) + LLVM_build = select_closest_version(preferred_llvm_version, getversion.(LLVM_builds)) # Our host platform is x86_64-linux-musl host_platform = Linux(:x86_64; libc=:musl) @@ -531,6 +597,58 @@ function expand_cxxstring_abis(ps::Vector{<:Platform}) return Platform[p for p in Iterators.flatten(expand_cxxstring_abis.(ps))] end +""" + preferred_libgfortran_version(platform::Platform, shard::CompilerShard) + +Return the libgfortran version preferred by the given platform or GCCBootstrap shard. +""" +function preferred_libgfortran_version(platform::Platform, shard::CompilerShard) + # Some input validation + if shard.name != "GCCBootstrap" + error("Shard must be `GCCBootstrap`") + end + if shard.target.arch != platform.arch || shard.target.libc != platform.libc + error("Incompatible platform and shard target") + end + + if compiler_abi(platform).libgfortran_version != nothing + # Here we can't use `shard.target` because the shard always has the + # target as ABI-agnostic, thus we have also to ask for the platform. + return compiler_abi(platform).libgfortran_version + elseif shard.version < v"7" + return v"3" + elseif v"7" <= shard.version < v"8" + return v"4" + else + return v"5" + end +end + +""" + preferred_cxxstring_abi(platform::Platform, shard::CompilerShard) + +Return the C++ string ABI preferred by the given platform or GCCBootstrap shard. +""" +function preferred_cxxstring_abi(platform::Platform, shard::CompilerShard) + # Some input validation + if shard.name != "GCCBootstrap" + error("Shard must be `GCCBootstrap`") + end + if shard.target.arch != platform.arch || shard.target.libc != platform.libc + error("Incompatible platform and shard target") + end + + if compiler_abi(platform).cxxstring_abi != nothing + # Here we can't use `shard.target` because the shard always has the + # target as ABI-agnostic, thus we have also to ask for the platform. + return compiler_abi(platform).cxxstring_abi + elseif shard.version < v"5" + return :cxx03 + else + return :cxx11 + end +end + """ download_all_shards(; verbose::Bool=false) diff --git a/src/Runner.jl b/src/Runner.jl index 5701a407f..ca301374d 100644 --- a/src/Runner.jl +++ b/src/Runner.jl @@ -33,7 +33,11 @@ exeext(p::Union{Linux,FreeBSD,MacOS}) = "" exeext(p::Platform) = error("Unknown exeext for platform $(p)") """ - generate_compiler_wrappers(p::Platform, bin_path::AbstractString) + generate_compiler_wrappers!(platform::Platform; bin_path::AbstractString, + host_platform::Platform = Linux(:x86_64; libc=:musl), + rust_platform::Platform = Linux(:x86_64; libc=:glibc), + compilers::Vector{Symbol} = [:c], + allow_unsafe_flags::Bool = false) We generate a set of compiler wrapper scripts within our build environment to force all build systems to honor the necessary sets of compiler flags to build for our systems. @@ -61,6 +65,32 @@ function generate_compiler_wrappers!(platform::Platform; bin_path::AbstractStrin host_target = aatriplet(host_platform) rust_target = aatriplet(rust_platform) + + # If the ABI-agnostic triplets of the target and the host platform are the + # same, then we have to be very careful: we can't have distinct wrappers, so + # we have to be sure that their ABIs are consistent, in particular that + # we're correctly writing the wrappers for the target platform. In + # particular, what we care about with regard to the wrappers is the C++ + # string ABI. We have the following situations: + # * they are equal: this is fine + # * they're different and the host has a prefernce for the C++ string ABI: + # we can't deal with this situation as the host wrappers will be always + # overwritten, then error out + # * in all other cases we don't do anything here but later below we'll let + # the host wrappers to be overwritten by the wrappers for the target + if target == host_target + target_cxxabi = compiler_abi(platform).cxxstring_abi + host_cxxabi = compiler_abi(host_platform).cxxstring_abi + if target_cxxabi !== host_cxxabi + if host_cxxabi !== nothing + # This is a very unlikely situation as ideally the host + # shouldn't have particular preferences for the ABI, thus in + # practice we shouldn't never reach this. + error("Incompatible C++ string ABIs between the host and target platforms") + end + end + end + # If we should use ccache, prepend this to every compiler invocation ccache = use_ccache ? "ccache" : "" @@ -73,7 +103,7 @@ function generate_compiler_wrappers!(platform::Platform; bin_path::AbstractStrin unsafe_flags = String[]) write(io, """ #!/bin/bash - # This compiler wrapper script brought into existence by `generate_compiler_wrappers()` + # This compiler wrapper script brought into existence by `generate_compiler_wrappers!()` if [ "x\${SUPER_VERBOSE}" = "x" ]; then vrun() { "\$@"; } @@ -308,8 +338,11 @@ function generate_compiler_wrappers!(platform::Platform; bin_path::AbstractStrin chmod(joinpath(bin_path, fname), 0o775) end - ## Generate compiler wrappers for both our target and our host - for p in unique((platform, host_platform)) + ## Generate compiler wrappers for both our host and our target. In + ## particular, we write the wrapper for the target after those for the host, + ## to override host-specific ABI in case this is incompatible with that of + ## the target + for p in unique((host_platform, platform)) t = aatriplet(p) # Generate `:c` compilers diff --git a/src/UserNSRunner.jl b/src/UserNSRunner.jl index 366b5d84a..5c514b13e 100644 --- a/src/UserNSRunner.jl +++ b/src/UserNSRunner.jl @@ -27,6 +27,7 @@ function UserNSRunner(workspace_root::String; verbose::Bool = false, compiler_wrapper_path::String = mktempdir(), src_name::AbstractString = "", + shards = nothing, kwargs...) global use_ccache, use_squashfs, runner_override @@ -55,8 +56,10 @@ function UserNSRunner(workspace_root::String; push!(workspaces, ccache_dir() => "/root/.ccache") end - # Choose the shards we're going to mount - shards = choose_shards(platform; extract_kwargs(kwargs, (:preferred_gcc_version,:preferred_llvm_version,:bootstrap_list,:compilers))...) + if isnothing(shards) + # Choose the shards we're going to mount + shards = choose_shards(platform; extract_kwargs(kwargs, (:preferred_gcc_version,:preferred_llvm_version,:bootstrap_list,:compilers))...) + end # Construct sandbox command to look at the location it'll be mounted under mpath = mount_path(shards[1], workspace_root) diff --git a/src/wizard/deploy.jl b/src/wizard/deploy.jl index bf70985ab..c427f4172 100644 --- a/src/wizard/deploy.jl +++ b/src/wizard/deploy.jl @@ -43,11 +43,11 @@ function print_build_tarballs(io::IO, state::WizardState) push!(kwargs_vec, "compilers = [$(join(map(x -> ":$(x)", state.compilers), ", "))]") end # Default GCC version is the oldest one - if state.preferred_gcc_version != available_gcc_builds[1] + if state.preferred_gcc_version != getversion(available_gcc_builds[1]) push!(kwargs_vec, "preferred_gcc_version = v\"$(state.preferred_gcc_version)\"") end # Default LLVM version is the latest one - if state.preferred_llvm_version != available_llvm_builds[end] + if state.preferred_llvm_version != getversion(available_llvm_builds[end]) push!(kwargs_vec, "preferred_llvm_version = v\"$(state.preferred_llvm_version)\"") end kwargs = "" diff --git a/src/wizard/obtain_source.jl b/src/wizard/obtain_source.jl index 9a1763e5b..be5390304 100644 --- a/src/wizard/obtain_source.jl +++ b/src/wizard/obtain_source.jl @@ -404,13 +404,13 @@ function step2(state::WizardState) get_name_and_version(state) if yn_prompt(state, "Do you want to customize the set of compilers?", :n) == :y get_compilers(state) - get_preferred_version(state, "GCC", available_gcc_builds) - get_preferred_version(state, "LLVM", available_llvm_builds) + get_preferred_version(state, "GCC", getversion.(available_gcc_builds)) + get_preferred_version(state, "LLVM", getversion.(available_llvm_builds)) else state.compilers = [:c] # Default GCC version is the oldest one - state.preferred_gcc_version = available_gcc_builds[1] + state.preferred_gcc_version = getversion(available_gcc_builds[1]) # Default LLVM version is the latest one - state.preferred_llvm_version = available_llvm_builds[end] + state.preferred_llvm_version = getversion(available_llvm_builds[end]) end end diff --git a/test/basic.jl b/test/basic.jl index 328d9689c..3ec892470 100644 --- a/test/basic.jl +++ b/test/basic.jl @@ -1,7 +1,6 @@ ## Basic tests for simple utilities within BB using BinaryBuilder, Test, Pkg -using BinaryBuilder: preferred_runner, resolve_jlls - +using BinaryBuilder: preferred_runner, resolve_jlls, CompilerShard, preferred_libgfortran_version, preferred_cxxstring_abi, gcc_version, available_gcc_builds, getversion, generate_compiler_wrappers! @testset "File Collection" begin temp_prefix() do prefix @@ -310,3 +309,103 @@ end @test truefalse @test all(x->x.uuid !== nothing, resolved_deps) end + +@testset "Compiler Shards" begin + @test_throws ErrorException CompilerShard("GCCBootstrap", v"4", Linux(:x86_64), :invalid_archive_type) + + @testset "GCC ABI matching" begin + # Preferred libgfortran version and C++ string ABI + platform = FreeBSD(:x86_64) + shard = CompilerShard("GCCBootstrap", v"4.8.5", Linux(:x86_64, libc=:musl), :squashfs, target = platform) + @test preferred_libgfortran_version(platform, shard) == v"3" + @test preferred_cxxstring_abi(platform, shard) == :cxx03 + shard = CompilerShard("GCCBootstrap", v"5.2.0", Linux(:x86_64, libc=:musl), :squashfs, target = platform) + @test preferred_libgfortran_version(platform, shard) == v"3" + @test preferred_cxxstring_abi(platform, shard) == :cxx11 + shard = CompilerShard("GCCBootstrap", v"7.10.0", Linux(:x86_64, libc=:musl), :squashfs, target = platform) + @test preferred_libgfortran_version(platform, shard) == v"4" + @test preferred_cxxstring_abi(platform, shard) == :cxx11 + shard = CompilerShard("GCCBootstrap", v"9.10.0", Linux(:x86_64, libc=:musl), :squashfs, target = platform) + @test preferred_libgfortran_version(platform, shard) == v"5" + @test preferred_cxxstring_abi(platform, shard) == :cxx11 + shard = CompilerShard("LLVMBootstrap", v"4.8.5", Linux(:x86_64, libc=:musl), :squashfs) + @test_throws ErrorException preferred_libgfortran_version(platform, shard) + @test_throws ErrorException preferred_cxxstring_abi(platform, shard) + platform = Linux(:x86_64, libc=:musl) + shard = CompilerShard("GCCBootstrap", v"4.8.5", Linux(:x86_64, libc=:musl), :squashfs, target = MacOS(:x86_64)) + @test_throws ErrorException preferred_libgfortran_version(platform, shard) + shard = CompilerShard("GCCBootstrap", v"4.8.5", Linux(:x86_64, libc=:musl), :squashfs, target = Linux(:x86_64, libc=:glibc)) + @test_throws ErrorException preferred_cxxstring_abi(platform, shard) + + # With no constraints, we should get them all back + @test gcc_version(CompilerABI(), available_gcc_builds) == getversion.(available_gcc_builds) + + # libgfortran v3 and libstdcxx 22 restrict us to only v4.8, v5.2 and v6.1 + cabi = CompilerABI(;libgfortran_version=v"3", libstdcxx_version=v"3.4.22") + @test gcc_version(cabi, available_gcc_builds) == [v"4.8.5", v"5.2.0", v"6.1.0"] + + # Adding `:cxx11` eliminates `v"4.X"`: + cabi = CompilerABI(cabi; cxxstring_abi=:cxx11) + @test gcc_version(cabi, available_gcc_builds) == [v"5.2.0", v"6.1.0"] + + # Just libgfortran v3 allows GCC 6 as well though + cabi = CompilerABI(;libgfortran_version=v"3") + @test gcc_version(cabi, available_gcc_builds) == [v"4.8.5", v"5.2.0", v"6.1.0"] + + # Test libgfortran version v4, then splitting on libstdcxx_version: + cabi = CompilerABI(;libgfortran_version=v"4") + @test gcc_version(cabi, available_gcc_builds) == [v"7.1.0"] + cabi = CompilerABI(cabi; libstdcxx_version=v"3.4.23") + @test gcc_version(cabi, available_gcc_builds) == [v"7.1.0"] + end + + @testset "Compiler wrappers" begin + platform = Linux(:x86_64, libc=:musl) + mktempdir() do bin_path + generate_compiler_wrappers!(platform; bin_path = bin_path) + # Make sure the C++ string ABI is not set + @test !occursin("-D_GLIBCXX_USE_CXX11_ABI", read(joinpath(bin_path, "gcc"), String)) + # Make sure gfortran doesn't uses ccache when BinaryBuilder.use_ccache is true + BinaryBuilder.use_ccache && @test !occursin("ccache", read(joinpath(bin_path, "gfortran"), String)) + end + platform = Linux(:x86_64, libc=:musl, compiler_abi=CompilerABI(cxxstring_abi=:cxx03)) + mktempdir() do bin_path + generate_compiler_wrappers!(platform; bin_path = bin_path) + gcc = read(joinpath(bin_path, "gcc"), String) + # Make sure the C++ string ABI is set as expected + @test occursin("-D_GLIBCXX_USE_CXX11_ABI=0", gcc) + # Make sure the unsafe flags check is there + @test occursin("You used one or more of the unsafe flags", gcc) + end + platform = Linux(:x86_64, libc=:musl, compiler_abi=CompilerABI(cxxstring_abi=:cxx11)) + mktempdir() do bin_path + generate_compiler_wrappers!(platform; bin_path = bin_path, allow_unsafe_flags = true) + gcc = read(joinpath(bin_path, "gcc"), String) + # Make sure the C++ string ABI is set as expected + @test occursin("-D_GLIBCXX_USE_CXX11_ABI=1", gcc) + # Make sure the unsafe flags check is not there in this case + @test !occursin("You used one or more of the unsafe flags", gcc) + end + platform = FreeBSD(:x86_64) + mktempdir() do bin_path + generate_compiler_wrappers!(platform; bin_path = bin_path, compilers = [:c, :rust, :go]) + clang = read(joinpath(bin_path, "clang"), String) + # Check link flags + @test occursin("-L/opt/$(triplet(platform))/$(triplet(platform))/lib", clang) + @test occursin("fuse-ld=$(triplet(platform))", clang) + # Other compilers + @test occursin("GOOS=\"freebsd\"", read(joinpath(bin_path, "go"), String)) + @test occursin("--target=x86_64-unknown-freebsd", read(joinpath(bin_path, "rustc"), String)) + end + platform = Linux(:x86_64, libc=:musl, compiler_abi=CompilerABI(cxxstring_abi=:cxx03)) + host_platform = Linux(:x86_64, libc=:musl, compiler_abi=CompilerABI(cxxstring_abi=:cxx11)) + mktempdir() do bin_path + @test_throws ErrorException generate_compiler_wrappers!(platform; bin_path = bin_path, host_platform = host_platform) + end + platform = Linux(:x86_64, libc=:musl) + host_platform = Linux(:x86_64, libc=:musl, compiler_abi=CompilerABI(cxxstring_abi=:cxx03)) + mktempdir() do bin_path + @test_throws ErrorException generate_compiler_wrappers!(platform; bin_path = bin_path, host_platform = host_platform) + end + end +end diff --git a/test/wizard.jl b/test/wizard.jl index 790ef433f..5d1d57ba7 100644 --- a/test/wizard.jl +++ b/test/wizard.jl @@ -2,6 +2,8 @@ using BinaryBuilder using GitHub, Test, VT100, Sockets, HTTP, SHA import Pkg +import BinaryBuilder: available_gcc_builds, available_llvm_builds, getversion + function with_wizard_output(f::Function, state, step_func::Function) # Create fake terminal to communicate with BinaryBuilder over pty = VT100.create_pty(false) @@ -116,8 +118,8 @@ end @test state.source_urls == ["http://127.0.0.1:14444/a/source.tar.gz"] @test state.source_hashes == [libfoo_tarball_hash] @test Set(state.compilers) == Set([:c, :rust, :go]) - @test state.preferred_gcc_version == BinaryBuilder.available_gcc_builds[1] - @test state.preferred_llvm_version == BinaryBuilder.available_llvm_builds[4] + @test state.preferred_gcc_version == getversion(available_gcc_builds[1]) + @test state.preferred_llvm_version == getversion(BinaryBuilder.available_llvm_builds[end]) # Test two tar.gz download state = step2_state() @@ -205,8 +207,8 @@ function step3_state() state.version = v"1.0.0" state.dependencies = typeof(Pkg.PackageSpec(name="dummy"))[] state.compilers = [:c] - state.preferred_gcc_version = BinaryBuilder.available_gcc_builds[1] - state.preferred_llvm_version = BinaryBuilder.available_llvm_builds[end] + state.preferred_gcc_version = getversion(available_gcc_builds[1]) + state.preferred_llvm_version = getversion(available_llvm_builds[end]) return state end