From 9f0220abb52d806ec9f9433f9369c170e5e99b93 Mon Sep 17 00:00:00 2001 From: Marius Brehler Date: Fri, 20 Feb 2026 22:03:50 +0100 Subject: [PATCH 1/2] Make sure patchelf/install_name_tool is available patchelf or rather install_name_tool is not only required for `THEROCK_BUNDLE_SYSDEPS=ON` but also for building rocGDB with sysdeps disabled. --- CMakeLists.txt | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bf9102d0a00..921ec228e85 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -330,6 +330,28 @@ if(CMAKE_CXX_VISIBILITY_PRESET) list(APPEND DEFAULT_CMAKE_ARGS ${CMAKE_CXX_VISIBILITY_PRESET}) endif() +################################################################################ +# patchelf / install_name_tool +# Building with bundled sysdep or rocGDB requires patchelf on Linux and +# install_name_tool on macOS to set RPATH. +################################################################################ + +if(THEROCK_BUNDLE_SYSDEPS OR THEROCK_ENABLE_ROCGDB) + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + find_program(PATCHELF patchelf) + if(NOT PATCHELF) + message(FATAL_ERROR "Building with THEROCK_BUNDLE_SYSDEPS=ON or THEROCK_ENABLE_ROCGDB=ON on Linux requires `patchelf`") + endif() + message(FATAL_ERROR "!/!") + elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + # macOS uses install_name_tool (from Xcode) instead of patchelf + find_program(INSTALL_NAME_TOOL install_name_tool) + if(NOT INSTALL_NAME_TOOL) + message(FATAL_ERROR "Building with THEROCK_BUNDLE_SYSDEPS=ON or THEROCK_ENABLE_ROCGDB=ON on macOS requires `install_name_tool` (install Xcode Command Line Tools)") + endif() + endif() +endif() + ################################################################################ # Sysdep bundling # Each available bundled sysdep is made available with a global variable like @@ -362,10 +384,6 @@ set(THEROCK_BUNDLED_AMDMESA) if(THEROCK_BUNDLE_SYSDEPS) message(STATUS "Building with bundled system dependencies enabled") if(CMAKE_SYSTEM_NAME STREQUAL "Linux") - find_program(PATCHELF patchelf) - if(NOT PATCHELF) - message(FATAL_ERROR "Building with THEROCK_BUNDLE_SYSDEPS=ON on Linux requires `patchelf`") - endif() find_program(MESON_BUILD meson) if(NOT MESON_BUILD) message(FATAL_ERROR "Building with THEROCK_BUNDLE_SYSDEPS=ON on Linux requires (easiest: `pip install meson`)") @@ -389,11 +407,6 @@ if(THEROCK_BUNDLE_SYSDEPS) set(THEROCK_BUNDLED_AMDMESA therock-amd-mesa) endif() elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - # macOS uses install_name_tool (from Xcode) instead of patchelf - find_program(INSTALL_NAME_TOOL install_name_tool) - if(NOT INSTALL_NAME_TOOL) - message(FATAL_ERROR "Building with THEROCK_BUNDLE_SYSDEPS=ON on macOS requires `install_name_tool` (install Xcode Command Line Tools)") - endif() find_program(MESON_BUILD meson) if(NOT MESON_BUILD) message(FATAL_ERROR "Building with THEROCK_BUNDLE_SYSDEPS=ON on macOS requires `meson` (easiest: `pip install meson`)") From fd23d28607ddf0a93904adffdde419c121419f72 Mon Sep 17 00:00:00 2001 From: Marius Brehler Date: Mon, 23 Feb 2026 10:59:19 +0100 Subject: [PATCH 2/2] Remove debug log --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 921ec228e85..1814af49c1d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -342,7 +342,6 @@ if(THEROCK_BUNDLE_SYSDEPS OR THEROCK_ENABLE_ROCGDB) if(NOT PATCHELF) message(FATAL_ERROR "Building with THEROCK_BUNDLE_SYSDEPS=ON or THEROCK_ENABLE_ROCGDB=ON on Linux requires `patchelf`") endif() - message(FATAL_ERROR "!/!") elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") # macOS uses install_name_tool (from Xcode) instead of patchelf find_program(INSTALL_NAME_TOOL install_name_tool)