From 63cc3de03fec50845ede7b22adf8e76d1b71313e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A5=BF=E9=A3=8E=E9=80=8D=E9=81=A5=E6=B8=B8?= Date: Sun, 23 Aug 2026 11:53:49 +0800 Subject: [PATCH] fix(macosx): make packaged games find the bundled lib/ (RPATH + bootstrap) The SDK eve carries INSTALL_RPATH @loader_path/../lib for the bin/+lib/ SDK layout, but 'eve package' places the copied lib/ tree at /lib next to the eve binary, so dyld failed with '@rpath/libz.1.dylib' not loaded. Add @loader_path/lib to the RPATH and make bootstrapBundledVulkan check exeDir/lib (package layout) in addition to ../lib (SDK) and ../Frameworks (.app bundle). --- cmake/install_sdk.cmake | 5 ++++- platform/macosx/macosx.mm | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cmake/install_sdk.cmake b/cmake/install_sdk.cmake index a705fe81..23d6c995 100644 --- a/cmake/install_sdk.cmake +++ b/cmake/install_sdk.cmake @@ -67,7 +67,10 @@ if(BUILD_PLATFORM STREQUAL "macosx") ") install(SCRIPT "${CMAKE_SOURCE_DIR}/cmake/macosx_bundle_vulkan.cmake") set_target_properties(${EVENGINE_NATIVE_TARGET} PROPERTIES - INSTALL_RPATH "@loader_path/../lib;@loader_path" + # SDK layout is bin/eve + lib/ (-> ../lib). `eve package` copies the + # lib/ tree next to eve as /lib (-> @loader_path/lib). Keep both + # so the same binary runs from the SDK and from a packaged game. + INSTALL_RPATH "@loader_path/../lib;@loader_path/lib;@loader_path" ) endif() diff --git a/platform/macosx/macosx.mm b/platform/macosx/macosx.mm index e6191593..ea1f0b6d 100644 --- a/platform/macosx/macosx.mm +++ b/platform/macosx/macosx.mm @@ -72,10 +72,11 @@ std::string bootstrapBundledVulkan() { const std::string exeDir = exe.substr(0, slash); // Packaged EVEngine distributions ship the loader + MoltenVK next to the - // executable: ../lib in the flat SDK layout (dist/eve-sdk/macosx), or + // executable: ../lib in the flat SDK layout (dist/eve-sdk/macosx), lib in + // a packaged game (eve package copies the SDK lib/ tree to /lib), or // ../Frameworks inside an .app bundle. const std::string dir = [&]() -> std::string { - for (const char *rel : {"../lib", "../Frameworks"}) { + for (const char *rel : {"../lib", "lib", "../Frameworks"}) { const std::string candidate = exeDir + "/" + rel; if (::access((candidate + "/libvulkan.1.dylib").c_str(), R_OK) == 0) return candidate;