[llvm] [AIX] use LIBPATH on AIX instead of LD_LIBRARY_PATH (PR #94602)
Chen Zheng via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 6 03:53:36 PDT 2024
https://github.com/chenzheng1030 created https://github.com/llvm/llvm-project/pull/94602
LD_LIBRARY_PATH will becomes invalid when LIBPATH is also set on AIX.
See below example on AIX:
```
$ldd a.out
a.out needs:
/usr/lib/libc.a(shr.o)
Cannot find libtest.a
/unix
/usr/lib/libcrypt.a(shr.o)
$./a.out
Could not load program ./a.out:
Dependent module libtest.a could not be loaded.
Could not load module libtest.a.
System error: No such file or directory
$export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp
$./a.out ; echo $?
10
$export LIBPATH=./
$./a.out ; echo $? >>>>>> Now LD_LIBRARY_PATH is not used bu system loader
Could not load program ./a.out:
Dependent module libtest.a could not be loaded.
Could not load module libtest.a.
System error: No such file or directory
```
This breaks many AIX LIT cases on our downstream buildbots which sets LIBPATH.
>From 97355f58cc094864213ac6e16acfa9e1b41f2281 Mon Sep 17 00:00:00 2001
From: Chen Zheng <czhengsz at cn.ibm.com>
Date: Thu, 6 Jun 2024 04:31:14 -0400
Subject: [PATCH] use LIBPATH on AIX instead of LD_LIBRARY_PATH
---
llvm/utils/lit/lit/llvm/config.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/llvm/utils/lit/lit/llvm/config.py b/llvm/utils/lit/lit/llvm/config.py
index 1d4babc99984b..8d5da6b4f9dc0 100644
--- a/llvm/utils/lit/lit/llvm/config.py
+++ b/llvm/utils/lit/lit/llvm/config.py
@@ -588,7 +588,10 @@ def use_clang(
if getattr(self.config, pp, None)
]
- self.with_environment("LD_LIBRARY_PATH", lib_paths, append_path=True)
+ if sys.platform.startswith("aix"):
+ self.with_environment("LIBPATH", lib_paths, append_path=True)
+ else:
+ self.with_environment("LD_LIBRARY_PATH", lib_paths, append_path=True)
shl = getattr(self.config, "llvm_shlib_dir", None)
pext = getattr(self.config, "llvm_plugin_ext", None)
More information about the llvm-commits
mailing list