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_sysdepsprefix. - 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 withAMDROCM_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 alib{originalname}.soas a dev symlink. - Any PackageConfig descriptors are altered to be location independent.
- PackageConfig and CMake
find_packageconfig 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_BZIP2THEROCK_BUNDLED_ELFUTILSTHEROCK_BUNDLED_LIBCAPTHEROCK_BUNDLED_LIBDRMTHEROCK_BUNDLED_LIBLZMATHEROCK_BUNDLED_NUMACTLTHEROCK_BUNDLED_SQLITE3THEROCK_BUNDLED_ZLIBTHEROCK_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).
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:
- 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)
- Canonical method:
find_package(gmp) - Import library:
gmp::gmp
Supported sub-libraries: libelf, libdw.
- Canonical method:
find_package(LibElf) - Import library:
elf::elf - Alternatives:
pkg_check_modules(ELF libelf)
- Canonical method:
find_package(libdw) - Import library:
libdw::libdw - Alternatives:
pkg_check_modules(DW libdw)
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)
Supported sub-libraries: libdrm, libdrm_amdgpu
- Canonical method:
pkg_check_modules(DRM REQUIRED IMPORTED_TARGET libdrm) - Import library:
PkgConfig::DRM - Vars:
DRM_INCLUDE_DIRS
- Canonical method:
pkg_check_modules(DRM_AMDGPU REQUIRED IMPORTED_TARGET libdrm_amdgpu) - Import library:
PkgConfig::DRM_AMDGPU - Vars:
DRM_AMDGPU_INCLUDE_DIRS
- Canonical method:
find_package(LibLZMA) - Import library:
LibLZMA::LibLZMA - Alternatives:
pkg_check_modules(LZMA liblzma)
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 onnuma::numa, which seems to vary across systems) - Alternatives:
pkg_check_modules(NUMA numa)
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.)
- Canonical method:
find_package(SQLite3) - Import library:
SQLite::SQLite3 - Alternatives: none
- Canonical method:
find_package(ZLIB) - Import library:
ZLIB::ZLIB - Alternatives:
pkg_check_modules(ZLIB zlib)
- Canonical method:
find_package(zstd) - Import library:
zstd::libzstd_shared - Alternatives:
pkg_check_modules(ZSTD libzstd)