From aaf32147bd245890970b15b791e9a5b1d1f4b902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ralph=20K=C3=BCpper?= Date: Fri, 1 May 2026 01:50:11 +0200 Subject: [PATCH] fix(jolt): disable IPO so libJolt.a links on Linux/GCC (closes #44) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rust's link step routes through rust-lld on Linux, which doesn't load gcc's lto-wrapper plugin. With INTERPROCEDURAL_OPTIMIZATION=ON, libJolt.a archive members are GIMPLE bitcode and rust-lld leaves their implementations unresolved — JPH::Free, BodyManager locks, vtables, etc all come up undefined. macOS Apple Clang handles LTO archives transparently which is why macOS was unaffected. Also fix the Jolt option name typo: PROFILE_ENABLED is not a Jolt CMake option (Jolt expects PROFILER_IN_DEBUG_AND_RELEASE / PROFILER_IN_DISTRIBUTION), so the comment claiming "no profile" was a no-op and Jolt was actually being built with the profiler enabled. Same for DEBUG_RENDERER_IN_DISTRIBUTION, now explicitly forced off. --- native/third_party/bloom_jolt/CMakeLists.txt | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/native/third_party/bloom_jolt/CMakeLists.txt b/native/third_party/bloom_jolt/CMakeLists.txt index 44c18a5..92f3a4d 100644 --- a/native/third_party/bloom_jolt/CMakeLists.txt +++ b/native/third_party/bloom_jolt/CMakeLists.txt @@ -8,11 +8,18 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) # --------------------------------------------------------------------------- # JoltPhysics build options. -# Matches the "Distribution" flavour: no asserts, no profile, no debug renderer, -# interprocedural optimisation on. We keep object stream off — we don't use -# Jolt's scene serialisation (Bloom handles save/load itself). +# Matches the "Distribution" flavour: no asserts, no profile, no debug renderer. +# We keep object stream off — we don't use Jolt's scene serialisation (Bloom +# handles save/load itself). +# +# IPO is OFF because Rust's link step on Linux/GCC routes through rust-lld, +# which doesn't load gcc's lto-wrapper plugin. With IPO on, libJolt.a's archive +# members are GIMPLE bitcode and rust-lld leaves their implementations +# unresolved (undefined-symbol errors on JPH::Free, BodyManager locks, vtables, +# etc — see issue #44). Jolt is heavily inlined via its precompiled header +# already, so the perf delta from skipping LTO on the static archive is small. # --------------------------------------------------------------------------- -set(INTERPROCEDURAL_OPTIMIZATION ON CACHE BOOL "" FORCE) +set(INTERPROCEDURAL_OPTIMIZATION OFF CACHE BOOL "" FORCE) set(USE_STATIC_MSVC_RUNTIME_LIBRARY OFF CACHE BOOL "" FORCE) set(TARGET_UNIT_TESTS OFF CACHE BOOL "" FORCE) set(TARGET_HELLO_WORLD OFF CACHE BOOL "" FORCE) @@ -21,8 +28,10 @@ set(TARGET_SAMPLES OFF CACHE BOOL "" FORCE) set(TARGET_VIEWER OFF CACHE BOOL "" FORCE) set(OBJECT_LAYER_BITS 16 CACHE STRING "" FORCE) set(USE_ASSERTS OFF CACHE BOOL "" FORCE) -set(PROFILE_ENABLED OFF CACHE BOOL "" FORCE) +set(PROFILER_IN_DEBUG_AND_RELEASE OFF CACHE BOOL "" FORCE) +set(PROFILER_IN_DISTRIBUTION OFF CACHE BOOL "" FORCE) set(DEBUG_RENDERER_IN_DEBUG_AND_RELEASE OFF CACHE BOOL "" FORCE) +set(DEBUG_RENDERER_IN_DISTRIBUTION OFF CACHE BOOL "" FORCE) set(CROSS_PLATFORM_DETERMINISTIC OFF CACHE BOOL "" FORCE) set(FLOATING_POINT_EXCEPTIONS_ENABLED OFF CACHE BOOL "" FORCE) set(DOUBLE_PRECISION OFF CACHE BOOL "" FORCE)