Skip to content

Top-level CMakeLists.txt builds xdna unconditionally, breaking -DXRT_EDGE=ON #9831

@talhaHavadar

Description

@talhaHavadar

Summary

The top-level CMakeLists.txt shipped in the source tarball asset of release
2.21.75 (2.21.75.tar.gz)
unconditionally adds the xdna/ subdirectory, which builds the AMD XDNA SHIM
(libxrt_driver_xdna.so) — a PCIe / NPU client component. On -DXRT_EDGE=ON
builds the PCIe support in xrt_core is intentionally not built, so linking
the XDNA shim fails. This breaks edge (Zynq / arm64) consumers of the release
tarball.

Reproduction

From the release tarball:

$ wget https://github.com/Xilinx/XRT/releases/download/2.21.75/2.21.75.tar.gz
$ tar xf 2.21.75.tar.gz && cd <extracted>
$ cmake -S . -B build -DXRT_EDGE=ON -DXRT_AIE_BUILD=ON
$ cmake --build build
...
[ 92%] Linking CXX shared library libxrt_driver_xdna.so
/usr/bin/ld: ...: undefined reference to `xrt_core::pci::register_driver(std::shared_ptr<xrt_core::pci::drv>)'
/usr/bin/ld: ...: undefined reference to `vtable for xrt_core::device_pcie'
/usr/bin/ld: ...: undefined reference to `xrt_core::pci::dev::~dev()'
/usr/bin/ld: ...: undefined reference to `xrt_core::pci::get_dev(unsigned int, bool)'
... (many more)
collect2: error: ld returned 1 exit status
make[3]: *** [xdna/xdna-driver/src/shim/CMakeFiles/xrt_driver_xdna.dir/build.make:426: ...] Error 1

Root cause

The XRT-UPSTREAM wrapper at the root of the release tarball adds xdna/
without checking the build mode:

  • CMakeLists.txt:11: add_subdirectory(xdna)

xdna/xdna-driver/CMake/upstream.cmake then unconditionally adds
src/shim/, which links against the xrt_core::pci::* symbols (e.g.
xrt_core::pci::register_driver, xrt_core::pci::dev,
xrt_core::device_pcie). Those are PCIe-only and are not built when
XRT_EDGE is set — see the if (NOT XRT_EDGE) guards in
xrt/XRT/src/runtime_src/CMakeLists.txt. Result: the XDNA shim is
compiled on an edge build but cannot link.

Impact

  • Build (link) failure for anyone consuming the release tarball with
    -DXRT_EDGE=ON (i.e. embedded / Zynq / arm64 targets).
  • Hits Debian/Ubuntu packaging that ships an edge build alongside the
    native amd64 build from the same source tree.
  • amd64 builds are unaffected because xrt_core::pci::* is present
    there.

Suggested fix

Skip the xdna subdirectory on edge builds — the XDNA SHIM targets
AMD client NPU PCIe devices and has no meaning on Zynq edge platforms:

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,4 +8,9 @@ set(XRT_UPSTREAM_DEBIAN 1)
 set(XRT_UPSTREAM 1)

 add_subdirectory(xrt)
-add_subdirectory(xdna)
+# The xdna subdirectory builds the AMD XDNA SHIM, which is a PCIe
+# (Ryzen-AI NPU) component and depends on xrt_core PCIe symbols that
+# are not built on edge / Zynq targets.
+if (NOT XRT_EDGE)
+  add_subdirectory(xdna)
+endif()

Alternatively, the same guard could live in xdna-driver/CMake/upstream.cmake
so the xdna subproject self-guards.

Environment

  • Distro: Ubuntu 26.04 LTS (arm64)
  • cmake: 4.2.3-2ubuntu2
  • g++: 15.2.0-5ubuntu1
  • XRT release tarball: 2.21.75 (2.21.75.tar.gz); also reproduces against
    the xrt/ contents replaced with the 202610.2.23.0_Canonical tag.

Reported while packaging XRT for Ubuntu (source package xrt).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions