@@ -597,7 +597,7 @@ function choose_shards(p::AbstractPlatform;
597
597
bootstrap_list:: Vector{Symbol} = bootstrap_list,
598
598
# Because GCC has lots of compatibility issues, we always default to
599
599
# the earliest version possible.
600
- preferred_gcc_version:: VersionNumber = getversion (GCC_builds[ 1 ]) ,
600
+ preferred_gcc_version:: Union{Nothing, VersionNumber} = nothing ,
601
601
# Because LLVM doesn't have compatibility issues, we always default
602
602
# to the newest version possible.
603
603
preferred_llvm_version:: VersionNumber = getversion (LLVM_builds[end ]),
@@ -610,6 +610,17 @@ function choose_shards(p::AbstractPlatform;
610
610
preferred_ocaml_version:: VersionNumber = maximum (getversion .(OCaml_builds)),
611
611
)
612
612
613
+ # The preferred GCC version depends on the compilers we are using.
614
+ if preferred_gcc_version === nothing
615
+ preferred_gcc_version = if :ocaml in compilers
616
+ # OCaml shards have been compiled agains GCC 6
617
+ compatible_gcc_builds = filter (b -> getversion (b) >= v " 6" , GCC_builds)
618
+ getversion (compatible_gcc_builds[1 ])
619
+ else
620
+ getversion (GCC_builds[1 ])
621
+ end
622
+ end
623
+
613
624
function find_shard (name, version, archive_type; target = nothing )
614
625
# aarch64-apple-darwin is a special platform because it has a single GCCBootstrap
615
626
# with a version number different from any other platforms: match this shard with a
0 commit comments