Skip to content

Commit a6341c4

Browse files
committed
add graalvm to LD_LIBRARY_PATH
1 parent dd93ef2 commit a6341c4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

build.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def run_command(command: str, cwd: Path, env: Mapping[str, str]) -> None:
1515
def check_env() -> Mapping[str, str]:
1616
# print the path environment variable
1717
PATH: str = os.getenv("PATH", "")
18+
LD_LIBRARY_PATH: str = os.getenv("LD_LIBRARY_PATH", "")
1819
JAVA_HOME: str | None = os.getenv("JAVA_HOME")
1920
GRAALVM_HOME: str | None = os.getenv("GRAALVM_HOME")
2021
MAVEN_HOME: str | None = os.getenv("MAVEN_HOME")
@@ -47,12 +48,19 @@ def check_env() -> Mapping[str, str]:
4748
print("native-image could not be found")
4849
sys.exit(1)
4950
native_image_install_dir = Path(native_image_path).parent
51+
native_image_agent_dir = Path(GRAALVM_HOME) / "lib"
5052

5153
# get PATH and append mvn and poetry install directories
5254
NEW_PATH = f"{mvn_install_dir}:{poetry_install_dir}:{native_image_install_dir}:{PATH}"
5355

56+
if LD_LIBRARY_PATH == "":
57+
LD_LIBRARY_PATH = f"{native_image_agent_dir}"
58+
else:
59+
LD_LIBRARY_PATH = f"{native_image_agent_dir}/{LD_LIBRARY_PATH}"
60+
5461
new_env = os.environ.copy()
5562
new_env["PATH"] = NEW_PATH
63+
new_env["LD_LIBRARY_PATH"] = LD_LIBRARY_PATH
5664
if JAVA_HOME is not None:
5765
new_env["JAVA_HOME"] = JAVA_HOME
5866
if GRAALVM_HOME is not None:

0 commit comments

Comments
 (0)