Skip to content

Commit 3679185

Browse files
author
Christopher Doris
committed
ensure conda uses a version of libstdc++ compatible with that already linked in julia
1 parent 50331f5 commit 3679185

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/cpython/context.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,25 @@ function init_context()
5252
# Find Python executable
5353
exe_path = get(ENV, "JULIA_PYTHONCALL_EXE", "")
5454
if exe_path == "" || exe_path == "@CondaPkg"
55+
if Sys.islinux()
56+
# Ensure libstdc++ in the Conda environment is compatible with the one
57+
# linked in Julia. This is platform/version dependent, so needs to occur at
58+
# runtime.
59+
#
60+
# To figure out cxx_version for a given Julia version, run
61+
# strings /path/to/julia/lib/julia/libstdc++.so.6 | grep GLIBCXX
62+
# then look at
63+
# https://gcc.gnu.org/onlinedocs/gcc-12.1.0/libstdc++/manual/manual/abi.html
64+
# for the highest GCC version compatible with the highest GLIBCXX version.
65+
if Base.VERSION <= v"1.6.2"
66+
# GLIBCXX_3.4.26
67+
cxx_version = ">=3.4,<9.2"
68+
else
69+
# GLIBCXX_3.4.29
70+
cxx_version = ">=3.4,<11.4"
71+
end
72+
CondaPkg.add("libstdcxx-ng", version=cxx_version, channel="conda-forge", temp=true, file=joinpath(@__DIR__, "..", "..", "CondaPkg.toml"), resolve=false)
73+
end
5574
# By default, we use Python installed by CondaPkg.
5675
exe_path = Sys.iswindows() ? joinpath(CondaPkg.envdir(), "python.exe") : joinpath(CondaPkg.envdir(), "bin", "python")
5776
# It's not sufficient to only activate the env while Python is initialising,

0 commit comments

Comments
 (0)