From 022ccc3947ddba0f61ad8023a9a7dc6021b40d30 Mon Sep 17 00:00:00 2001 From: Simon Let Date: Tue, 19 May 2026 23:22:27 +0200 Subject: [PATCH] fix macos rpath: use @executable_path instead of literal $executable_path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Apple branch was setting CMAKE_BUILD_RPATH/CMAKE_INSTALL_RPATH to "\$executable_path" — a literal directory name that dyld cannot resolve. macOS dyld uses @-prefixed tokens (@executable_path, @loader_path, @rpath), not $-prefixed ones like ELF's $ORIGIN. Symptom: helper executables that depend on @rpath/libcage-core.dylib (or any other neighboring dylib via the configured rpath) crash at launch with `Library not loaded: @rpath/libcage-core.dylib ... tried: '$executable_path/libcage-core.dylib' (no such file)`. Co-Authored-By: Claude Opus 4.7 (1M context) --- cmake/cage_build_configuration.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/cage_build_configuration.cmake b/cmake/cage_build_configuration.cmake index 75ab6d96..010ebe27 100644 --- a/cmake/cage_build_configuration.cmake +++ b/cmake/cage_build_configuration.cmake @@ -28,8 +28,8 @@ macro(cage_build_configuration) set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) if(APPLE) - set(CMAKE_BUILD_RPATH "\$executable_path") - set(CMAKE_INSTALL_RPATH "\$executable_path") + set(CMAKE_BUILD_RPATH "@executable_path") + set(CMAKE_INSTALL_RPATH "@executable_path") else() set(CMAKE_BUILD_RPATH "\$ORIGIN") set(CMAKE_INSTALL_RPATH "\$ORIGIN")