Skip to content

Fix xilinx_xrt() root discovery on Debian multiarch installs (#9955) - #9958

Merged
stsoe merged 1 commit into
Xilinx:XRT-2.25from
stsoe:cp-9955
Aug 5, 2026
Merged

Fix xilinx_xrt() root discovery on Debian multiarch installs (#9955)#9958
stsoe merged 1 commit into
Xilinx:XRT-2.25from
stsoe:cp-9955

Conversation

@stsoe

@stsoe stsoe commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

xilinx_xrt() derived the XRT root by taking two parent_path() levels up from the libxrt_coreutil.so path reported by dladdr(). This assumes coreutil lives directly in /lib, which only holds when CMAKE_INSTALL_LIBDIR is a single path component (lib, lib64). On a Debian multiarch install CMAKE_INSTALL_LIBDIR is lib/x86_64-linux-gnu, so coreutil is one level deeper and the two-level strip returns /lib instead of . shim_path() then re-appends XRT_LIB_DIR, producing a doubled path such as
'/opt/amdgpu/lib/lib/x86_64-linux-gnu/libxrt_core.so.2' and the load fails with "No such library".

Strip exactly as many trailing components as XRT_LIB_DIR contains instead of a hardcoded two levels, so the root is recovered correctly for lib, lib64, and lib/x86_64-linux-gnu layouts alike. Single-component layouts (standard, lib64, single-arch Yocto) are unaffected. Also default XRT_LIB_DIR to "lib" so the header stays self-contained; the loop additionally tolerates an empty value.

Regression from 11169ba (SWSPLAT-24084) which switched XRT root discovery from XILINX_XRT to dladdr().

(cherry picked from commit 5403f66)

…9955)

xilinx_xrt() derived the XRT root by taking two parent_path() levels up
from the libxrt_coreutil.so path reported by dladdr(). This assumes
coreutil lives directly in <root>/lib, which only holds when
CMAKE_INSTALL_LIBDIR is a single path component (lib, lib64). On a
Debian multiarch install CMAKE_INSTALL_LIBDIR is lib/x86_64-linux-gnu,
so coreutil is one level deeper and the two-level strip returns
<root>/lib instead of <root>. shim_path() then re-appends XRT_LIB_DIR,
producing a doubled path such as
'/opt/amdgpu/lib/lib/x86_64-linux-gnu/libxrt_core.so.2' and the load
fails with "No such library".

Strip exactly as many trailing components as XRT_LIB_DIR contains
instead of a hardcoded two levels, so the root is recovered correctly
for lib, lib64, and lib/x86_64-linux-gnu layouts alike. Single-component
layouts (standard, lib64, single-arch Yocto) are unaffected. Also
default XRT_LIB_DIR to "lib" so the header stays self-contained; the
loop additionally tolerates an empty value.

Regression from 11169ba (SWSPLAT-24084) which switched XRT root
discovery from XILINX_XRT to dladdr().

Signed-off-by: Wendy Liang <wendy.liang@amd.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
(cherry picked from commit 5403f66)
@stsoe
stsoe requested a review from rbramand-xilinx as a code owner August 5, 2026 15:10
@stsoe
stsoe requested a review from maxzhen August 5, 2026 15:11
@stsoe
stsoe merged commit 3923b2b into Xilinx:XRT-2.25 Aug 5, 2026
19 checks passed
@stsoe
stsoe deleted the cp-9955 branch August 5, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants