Skip to content

Commit 5b52c47

Browse files
jgmelbergithub-actions[bot]Copilot
authored
Explicitly add xrt libs to LD_LIBRARY_PATH for lit (#2802)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <[email protected]>
1 parent 60ba7fa commit 5b52c47

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

python/aie_lit_utils/lit_config_helpers.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,14 @@ def detect_xrt(
218218
config.found = True
219219
config.flags = f"-I{xrt_include_dir} -L{xrt_lib_dir} -luuid -lxrt_coreutil"
220220
config.substitutions["%xrt_flags"] = config.flags
221+
# Add XRT library directory to LD_LIBRARY_PATH for runtime linking,
222+
# preserving any existing entries from the parent environment.
223+
existing_ld_library_path = os.environ.get("LD_LIBRARY_PATH")
224+
if existing_ld_library_path:
225+
new_ld_library_path = existing_ld_library_path + os.pathsep + xrt_lib_dir
226+
else:
227+
new_ld_library_path = xrt_lib_dir
228+
config.environment["LD_LIBRARY_PATH"] = new_ld_library_path
221229

222230
# Detect NPU hardware
223231
try:

0 commit comments

Comments
 (0)