Skip to content

fix(build): make Jolt IPO follow ENABLE_LTO, disable LTO for macOS CI - #493

Merged
Krilliac merged 1 commit into
Workingfrom
claude/fix-build-failures-JlRLr
Apr 18, 2026
Merged

fix(build): make Jolt IPO follow ENABLE_LTO, disable LTO for macOS CI#493
Krilliac merged 1 commit into
Workingfrom
claude/fix-build-failures-JlRLr

Conversation

@Krilliac

Copy link
Copy Markdown
Owner

Root cause of the linux-clang-Release / macos-{Debug,Release} linker failures on PR #491 was NOT a stale CI cache — a fresh local build reproduced it. Extracting any member of build/lib/libJolt.a showed LLVM IR bitcode, not ELF. GNU ld / ld64 then rejects the archive with:

libJolt.a: error adding symbols: file format not recognized
clang++: error: linker command failed with exit code 1

Jolt's CMake wrapper was forcing INTERPROCEDURAL_OPTIMIZATION=ON whenever CMAKE_BUILD_TYPE was Release/MinSizeRel/RelWithDebInfo, regardless of the top-level ENABLE_LTO option. The linux-clang CI passes -DENABLE_LTO=OFF expecting native objects everywhere, but Jolt still produced bitcode — a classic ABI/format mismatch that only the thin-LTO-aware lld or llvm-ar can resolve.

Fix:

  • CMakeLists.txt: gate Jolt's IPO on ENABLE_LTO AND <release config> so the engine and Jolt stay in the same object format.
  • build.yml: add -DENABLE_LTO=OFF to the macOS job. The job already unconditionally purges lib*.a as a workaround — removing the underlying mismatch lets that step become a no-op.

Verified locally: after the fix, ar x libJolt.a AABBTreeBuilder.cpp.o yields ELF relocatable instead of LLVM IR bitcode.

Root cause of the linux-clang-Release / macos-{Debug,Release} linker
failures on PR #491 was NOT a stale CI cache — a fresh local build
reproduced it. Extracting any member of build/lib/libJolt.a showed
LLVM IR bitcode, not ELF. GNU ld / ld64 then rejects the archive with:

    libJolt.a: error adding symbols: file format not recognized
    clang++: error: linker command failed with exit code 1

Jolt's CMake wrapper was forcing `INTERPROCEDURAL_OPTIMIZATION=ON`
whenever CMAKE_BUILD_TYPE was Release/MinSizeRel/RelWithDebInfo,
regardless of the top-level `ENABLE_LTO` option. The linux-clang CI
passes `-DENABLE_LTO=OFF` expecting native objects everywhere, but
Jolt still produced bitcode — a classic ABI/format mismatch that only
the thin-LTO-aware lld or llvm-ar can resolve.

Fix:
- CMakeLists.txt: gate Jolt's IPO on `ENABLE_LTO AND <release config>`
  so the engine and Jolt stay in the same object format.
- build.yml: add `-DENABLE_LTO=OFF` to the macOS job. The job already
  unconditionally purges `lib*.a` as a workaround — removing the
  underlying mismatch lets that step become a no-op.

Verified locally: after the fix, `ar x libJolt.a AABBTreeBuilder.cpp.o`
yields ELF relocatable instead of LLVM IR bitcode.
@Krilliac
Krilliac merged commit 6ec26c6 into Working Apr 18, 2026
39 of 41 checks passed
@Krilliac
Krilliac deleted the claude/fix-build-failures-JlRLr branch April 18, 2026 06:53
@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage (GCC + lcov)

Utils/Result.h                                 | 100%    29| 0.0%  28|    -    0
Utils/RingBuffer.h                             | 142%    59| 0.0%  84|    -    0
Utils/ScheduledCallback.h                      |    -     0|    -   0|    -    0
Utils/ScopeGuard.h                             | 142%    36| 0.0%  51|    -    0
Utils/ScopedTimer.h                            |25.0%    12| 0.0%   3|    -    0
Utils/Serializer.h                             |86.2%    58| 0.0%  44|    -    0
Utils/ShaderServiceClient.cpp                  |12.2%    41| 0.0%   4|    -    0
Utils/ShaderServiceClient.h                    | 100%     1| 0.0%   1|    -    0
Utils/ShaderServiceProtocol.h                  |11.8%    68| 0.0%   8|    -    0
Utils/SparkConsole.cpp                         |27.2%   151| 0.0%  18|    -    0
Utils/SparkConsole.h                           | 100%     2| 0.0%   2|    -    0
Utils/SparkError.h                             |10.9%    55| 0.0%   6|    -    0
Utils/SplineMath.cpp                           |20.5%    39| 0.0%   5|    -    0
Utils/SplinePath.h                             |    -     0|    -   0|    -    0
Utils/StackTrace.h                             |10.8%    74| 0.0%   8|    -    0
Utils/StateMachine.h                           |85.9%    64| 0.0%  49|    -    0
Utils/StringUtils.h                            |18.1%   116| 0.0%  21|    -    0
Utils/Telemetry.h                              |20.6%   136| 0.0%  23|    -    0
Utils/ThreadDebugger.h                         |11.6%   199| 0.0%  23|    -    0
Utils/ThreadSafeQueue.h                        |27.5%    40| 0.0%  11|    -    0
Utils/Timer.cpp                                |19.4%    36| 0.0%   7|    -    0
Utils/Timer.h                                  | 100%     2| 0.0%   2|    -    0
Utils/TimerManager.h                           |18.6%   102| 0.0%  19|    -    0
Utils/Tween.h                                  |26.3%    38| 0.0%   6|    -    0
Utils/UUID.h                                   |43.2%    37| 0.0%  16|    -    0
Utils/Validate.h                               |    -     0|    -   0|    -    0
Utils/WineDetection.cpp                        |23.1%    39| 0.0%   9|    -    0

[/home/runner/work/SparkEngine/SparkEngine/SparkSDK/Include/Spark/]
IEngineContext.h                               |7300%     1| 0.0%   1|    -    0
ServiceInterfaces.h                            | 200%     3| 0.0%   3|    -    0
Version.h                                      |    -     0|    -   0|    -    0
================================================================================
                                         Total:|30.7% 34593| 0.0%  6k|    -    0

Per-Subsystem Coverage

Subsystem Lines Hit Coverage Threshold Status
AI 3716 942 25.3% 35%
Animation 905 277 30.6% 35%
Audio 0 0 0% 30%
Camera 0 0 0% 40%
Core 4885 2918 59.7% 40%
ECS 426 213 50% 40%
Editor 7411 3046 41.1% 25%
GameModules 6621 3229 48.8% 30%
Graphics 17335 8601 49.6% 30%
Networking 3554 2344 66% 35%
Physics 0 0 0% 35%
Scripting 283 80 28.3% 30%
Utils 9778 6050 61.9% 60%

Total: 50.4% (27700/54914 lines)

@github-actions

Copy link
Copy Markdown
Contributor

❌ CI Error Report

Failed jobs: clang-tidy, macos-Debug, macos-Release
Errors: 1 | Test failures: 0 | Compiler warnings: 0

Build Errors

Other errors (1)
clang++: error: linker command failed with exit code 1 (u e -v to  ee invocation) [macos-Debug, macos-Release]

Updated: 2026-04-18T07:56:51Z — this comment is updated in-place, not duplicated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants