Files
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

243 lines
8.1 KiB
Markdown

# Dependencies
TheRock manages two categories of third-party dependencies, distinguished by
their packaging behavior (see [`BUILD_TOPOLOGY.toml`](/BUILD_TOPOLOGY.toml) for
the build topology):
1. **Sysdeps** ([`third-party/sysdeps/`](/third-party/sysdeps/)) — libraries (zlib,
elfutils, libdrm, numactl, etc.) built from source with SONAME rewriting and
symbol versioning so that ROCm can ship private copies without conflicting with
system-installed versions. This is the mechanism that enables portable
distribution.
1. **Other third-party libraries** ([`third-party/`](/third-party/)) — libraries
used as build dependencies that are not exposed externally and/or are not
typically available as system packages (fmt, spdlog, flatbuffers,
googletest, etc.). These are not given special packaging treatment. Most are
`CORE` dependencies required by some subproject unconditionally while the
`HOST_MATH` libraries (host-blas, SuiteSparse, fftw3) are optional.
The rest of this document covers the sysdeps in detail.
## Sysdeps
The ROCm projects have a number of dependencies. Typically those that escape
any specific library and are generally available as part of an OS distribution
are the concern of TheRock. In these cases, TheRock prefers to build them
all from source in such that:
- They are installed into the `lib/rocm_sysdeps` prefix.
- All ROCm libraries can find them by adding an appropriate relative RPATH.
- For symbol-versioned libraries, all symbols will be prefixed with
`AMDROCM_SYSDEPS_1.0_`; whereas for non-versioned libraries, they will be
built to version all symbols with `AMDROCM_SYSDEPS_1.0`.
- SONAMEs and semantic version symlink redirects are altered so that a single
SONAME shared library with a prefix of `rocm_sysdeps_` is available to
link against, using a `lib{originalname}.so` as a dev symlink.
- Any PackageConfig descriptors are altered to be location independent.
- PackageConfig and CMake `find_package` config files are advertised (being
created as necessary) so that package resolution happens the same as if
they were OS installed.
In order for this setup to work, a number of conventions need to be followed
project wide:
- Sub-projects should declare their use of a sysdep by including one or more of
the global variables in their `RUNTIME_DEPS` (these will be empty if
bundling is not enabled or supported for the target OS):
- `THEROCK_BUNDLED_BZIP2`
- `THEROCK_BUNDLED_ELFUTILS`
- `THEROCK_BUNDLED_HWLOC`
- `THEROCK_BUNDLED_LIBCAP`
- `THEROCK_BUNDLED_LIBDRM`
- `THEROCK_BUNDLED_LIBLZMA`
- `THEROCK_BUNDLED_LIBMNL`
- `THEROCK_BUNDLED_LIBNL`
- `THEROCK_BUNDLED_NUMACTL`
- `THEROCK_BUNDLED_SQLITE3`
- `THEROCK_BUNDLED_UTIL_LINUX`
- `THEROCK_BUNDLED_ZLIB`
- `THEROCK_BUNDLED_ZSTD`
- Sub-projects must arrange for any libraries that depend on these to add the
RPATH `lib/rocm_sysdeps/lib`.
- All projects should use the same package resolution technique (see below).
## Canonical Way to Depend
Per usual with CMake and the proliferation of operating systems, there is no
one true way to depend on a library. In general, if common distributions make
a library available via `find_package(foo CONFIG)`, we prefer that mechanism
be used consistently.
Implementation notes for each library is below:
## BZip2
- Canonical method: `find_package(BZip2)`
- Import library: `BZip2::BZip2`
- Alternatives: None (some OS vendors will provide alternatives but the source
distribution of bzip2 has no opinion)
## Expat
- Canonical method: `find_package(expat)`
- Import library: `expat::expat`
## GMP
- Canonical method: `find_package(gmp)`
- Import library: `gmp::gmp`
## hwloc
- Canonical method: `find_package(hwloc CONFIG)`
- Import library: `hwloc::hwloc`
## ELFUTILS
Supported sub-libraries: `libelf`, `libdw`.
### libelf
- Canonical method: `find_package(LibElf)`
- Import library: `elf::elf`
- Alternatives: `pkg_check_modules(ELF libelf)`
### libdw
- Canonical method: `find_package(libdw)`
- Import library: `libdw::libdw`
- Alternatives: `pkg_check_modules(DW libdw)`
## libcap
Provides Linux capabilities for privileged operations (used by RDC).
- Canonical method: `find_package(Libcap)`
- Import library: `Libcap::Libcap`
- Alternatives: `pkg_check_modules(LIBCAP libcap)` or direct linking (used by RDC)
## libdrm
Supported sub-libraries: `libdrm`, `libdrm_amdgpu`
### libdrm
- Canonical method: `pkg_check_modules(DRM REQUIRED IMPORTED_TARGET libdrm)`
- Import library: `PkgConfig::DRM`
- Vars: `DRM_INCLUDE_DIRS`
### libdrm_amdgpu
- Canonical method: `pkg_check_modules(DRM_AMDGPU REQUIRED IMPORTED_TARGET libdrm_amdgpu)`
- Import library: `PkgConfig::DRM_AMDGPU`
- Vars: `DRM_AMDGPU_INCLUDE_DIRS`
## liblzma
- Canonical method: `find_package(LibLZMA)`
- Import library: `LibLZMA::LibLZMA`
- Alternatives: `pkg_check_modules(LZMA liblzma)`
## libmnl
Minimal netlink library for low-level netlink socket operations (used by amdsmi).
- Canonical method: `find_package(libmnl CONFIG)`
- Import library: `libmnl::libmnl`
- Alternatives: `pkg_check_modules(LIBMNL REQUIRED IMPORTED_TARGET libmnl)`
- Note: Provides minimalist netlink socket interface, typically used as a dependency for libnl
## libnl
Netlink protocol library suite providing high-level interfaces for Linux kernel netlink sockets (used by amdsmi).
Supported sub-libraries: `libnl` (core), `libnl-genl` (generic netlink)
### Core libnl
- Canonical method: `find_package(libnl CONFIG)`
- Import library: `libnl::libnl`
- Alternatives: `pkg_check_modules(LIBNL3 REQUIRED IMPORTED_TARGET libnl-3.0)`
### Generic netlink (libnl-genl)
- Canonical method: `find_package(libnl CONFIG)` (provides `libnl::genl`)
- Import library: `libnl::genl`
- Alternatives: `pkg_check_modules(LIBNL3_GENL REQUIRED IMPORTED_TARGET libnl-genl-3.0)`
- Dependencies: Automatically links `libnl::libnl`
## MPFR
- Canonical method: `find_package(mpfr)`
- Import library: `mpfr::mpfr`
## NCurses
- Canonical method: `find_package(ncurses)`
- Import library: `ncurses::ncurses`
### numactl
Provides the `libnuma` library. Tools are not included in bundled sysdeps.
- Canonical method: `find_package(NUMA)`
- Import library: `numa::numa`
- Vars: `NUMA_INCLUDE_DIRS`, `NUMA_INCLUDE_LIBRARIES` (can be used to avoid
a hard-coded dep on `numa::numa`, which seems to vary across systems)
- Alternatives: `pkg_check_modules(NUMA numa)`
## simde
SIMDe (SIMD Everywhere) is a header-only portability library for SIMD intrinsics.
- Canonical method: `pkg_check_modules(simde REQUIRED IMPORTED_TARGET simde)`
- Import library: `PkgConfig::simde`
- Vars: `simde_INCLUDE_DIRS`
- Alternatives: none
- Note: Header-only library, provides portable SIMD intrinsics (SSE, AVX, NEON, etc.)
## sqlite3
- Canonical method: `find_package(SQLite3)`
- Import library: `SQLite::SQLite3`
- Alternatives: none
## util-linux
Provides the `libmount` (mount table parsing/manipulation) and `libblkid`
(block device identification) shared libraries. The full util-linux project
ships many more utilities and libraries, but TheRock only builds these two.
Note: `libmount` links `libblkid` transitively, so consumers that only use
`libmount` typically do not need to depend on `libblkid` directly.
### libmount
- Canonical method: `pkg_check_modules(LIBMOUNT REQUIRED IMPORTED_TARGET mount)`
- Import library: `PkgConfig::LIBMOUNT`
- Alternatives: none
### libblkid
- Canonical method: `pkg_check_modules(LIBBLKID REQUIRED IMPORTED_TARGET blkid)`
- Import library: `PkgConfig::LIBBLKID`
- Alternatives: none
## zlib
- Canonical method: `find_package(ZLIB)`
- Import library: `ZLIB::ZLIB`
- Alternatives: `pkg_check_modules(ZLIB zlib)`
## zstd
- Canonical method: `find_package(zstd)`
- Import library: `zstd::libzstd` (preferred - INTERFACE target that wraps the concrete library)
- Alternatives:
- `zstd::libzstd_shared` - explicit shared library target
- `pkg_check_modules(ZSTD libzstd)`
- Note: Upstream zstd's CMake install generates both `zstd::libzstd` (INTERFACE) and
`zstd::libzstd_shared` (SHARED IMPORTED). The INTERFACE target forwards to the
appropriate concrete target, abstracting static vs shared selection. Prefer
`zstd::libzstd` for new code.