Skip to content

Commit 105fc32

Browse files
committed
[GR-43614] Append sulong to LD_LIBRARY_PATH in the launcher
PullRequest: graalpython/2608
2 parents 44b2f42 + c8e6f74 commit 105fc32

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

graalpython/com.oracle.graal.python.shell/src/com/oracle/graal/python/shell/GraalPythonMain.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2022, Oracle and/or its affiliates.
2+
* Copyright (c) 2017, 2023, Oracle and/or its affiliates.
33
* Copyright (c) 2013, Regents of the University of California
44
*
55
* All rights reserved.
@@ -687,6 +687,14 @@ protected void launch(Builder contextBuilder) {
687687
evalInternal(context, "__graalpython__.startup_wall_clock_ts = " + startupWallClockTime + "; __graalpython__.startup_nano = " + startupNanoTime);
688688
}
689689

690+
// Set LD_LIBRARY_PATH so that binaries built with sulong toolchain can find libc++.so
691+
evalInternal(context, """
692+
import os
693+
path = os.environ.get('LD_LIBRARY_PATH', '')
694+
sulong_path = os.pathsep.join(__graalpython__.get_toolchain_paths('LD_LIBRARY_PATH'))
695+
os.environ['LD_LIBRARY_PATH'] = path + os.pathsep + sulong_path if path else sulong_path
696+
""");
697+
690698
if (!quietFlag && (verboseFlag || (commandString == null && inputFile == null && stdinIsInteractive))) {
691699
print("Python " + evalInternal(context, "import sys; sys.version + ' on ' + sys.platform").asString());
692700
if (!noSite) {

graalpython/lib-python/3/test/test_subprocess.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,7 @@ def is_env_var_to_ignore(n):
788788
n == 'LD_PRELOAD' or n.startswith('SANDBOX') or # Gentoo
789789
n == 'PWD' or n == 'SHLVL' or # Graalpython bash launcher
790790
n.startswith('JAVA_MAIN_CLASS') or # JVM on MacOS
791+
n == 'LD_LIBRARY_PATH' or # Added by graalpy launcher
791792
n == 'LC_CTYPE') # Locale coercion triggered
792793

793794
with subprocess.Popen([sys.executable, "-c",

0 commit comments

Comments
 (0)