Skip to content

Commit 4a6d7bf

Browse files
authored
Merge pull request #37654 from giordano/mg/glibcxx
[BinaryPlatforms] Look for `GLIBCXX` starting from version 30
2 parents cfbb3c7 + a43c31b commit 4a6d7bf

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

base/binaryplatforms.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -904,12 +904,13 @@ function detect_libgfortran_version()
904904
end
905905

906906
"""
907-
detect_libstdcxx_version()
907+
detect_libstdcxx_version(max_minor_version::Int=30)
908908
909909
Inspects the currently running Julia process to find out what version of libstdc++
910-
it is linked against (if any).
910+
it is linked against (if any). `max_minor_version` is the latest version in the
911+
3.4 series of GLIBCXX where the search is performed.
911912
"""
912-
function detect_libstdcxx_version()
913+
function detect_libstdcxx_version(max_minor_version::Int=30)
913914
libstdcxx_paths = filter(x -> occursin("libstdc++", x), Libdl.dllist())
914915
if isempty(libstdcxx_paths)
915916
# This can happen if we were built by clang, so we don't link against
@@ -919,7 +920,9 @@ function detect_libstdcxx_version()
919920

920921
# Brute-force our way through GLIBCXX_* symbols to discover which version we're linked against
921922
hdl = Libdl.dlopen(first(libstdcxx_paths))
922-
for minor_version in 26:-1:18
923+
# Try all GLIBCXX versions down to GCC v4.8:
924+
# https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html
925+
for minor_version in max_minor_version:-1:18
923926
if Libdl.dlsym(hdl, "GLIBCXX_3.4.$(minor_version)"; throw_error=false) !== nothing
924927
Libdl.dlclose(hdl)
925928
return VersionNumber("3.4.$(minor_version)")

0 commit comments

Comments
 (0)