Skip to content

macOS: skip Libunwind on Apple + fix DevIL include-dir lookup#3041

Open
tomjn wants to merge 1 commit into
beyond-all-reason:masterfrom
tomjn:build/macos-cmake-configure
Open

macOS: skip Libunwind on Apple + fix DevIL include-dir lookup#3041
tomjn wants to merge 1 commit into
beyond-all-reason:masterfrom
tomjn:build/macos-cmake-configure

Conversation

@tomjn

@tomjn tomjn commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

What

Configure/link fixes for building on macOS.

1. Skip Libunwind on Apple — in both places it's referenced (rts/CMakeLists.txt find+link, and rts/builds/dedicated/CMakeLists.txt link list). find_package(Libunwind REQUIRED) targets the LLVM/nongnu libunwind used on Linux/BSD; macOS has its own unwinding and the package isn't present. Both guards get NOT APPLE (OpenBSD was already excluded).

2. Fix FindDevIL at the root (reworked per review — answering "how did devil work before?")

-find_path(IL_INCLUDE_DIR il.h
-          PATH_SUFFIXES include IL
+find_path(IL_INCLUDE_DIR IL/il.h
+          PATH_SUFFIXES include

The module searched for bare il.h and set IL_INCLUDE_DIR to the directory containing it. The code does #include <IL/il.h>, which needs the parent. On Homebrew (<prefix>/include/IL/il.h) that landed on <prefix>/include/IL, so <IL/il.h> didn't resolve. On Linux the system include path (/usr/include) masked this, which is why it "worked before".

Searching for IL/il.h makes IL_INCLUDE_DIR the parent on every platform — which also matches how it's already consumed elsewhere (tools/scripts/prepare_static_spring.sh passes the parent include dir as IL_INCLUDE_DIR). This replaces the earlier downstream workaround in rts/CMakeLists.txt with a root-cause fix in the Find module.

Verified: Found DevIL: /opt/homebrew/lib/libIL.dylib and <IL/il.h> resolves on macOS; find_path(IL/il.h) returns /opt/homebrew/include vs the old /opt/homebrew/include/IL.

Safety

Configure/link-only. libunwind guards add NOT APPLE (Linux/BSD unchanged). The FindDevIL change returns the parent dir on all platforms, matching existing IL_INCLUDE_DIR usage.

Surfaced building unitsync / spring-dedicated on macOS with Homebrew GCC.


Assisted by Claude Code; verified by configuring on macOS.

@tomjn tomjn changed the title macOS: make the top-level CMake configure succeed on Apple macOS: skip Libunwind on Apple + fix DevIL include dir Jun 20, 2026
@tomjn tomjn force-pushed the build/macos-cmake-configure branch from 5aba184 to 60526b5 Compare June 20, 2026 12:49
@sprunk

sprunk commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

How did devil work before?

Configure/link fixes needed to build on macOS:

- Skip Libunwind on Apple, in both places it is referenced: rts/CMakeLists.txt
  (the find_package + engineCommonLibraries link) and
  rts/builds/dedicated/CMakeLists.txt (the engine-dedicated link list).
  find_package(Libunwind REQUIRED) targets the LLVM/nongnu libunwind used on
  Linux/BSD; macOS provides its own unwinding and the package isn't present, so
  configure failed and engine-dedicated linked a missing libunwind::libunwind
  target. Guard both with NOT APPLE (OpenBSD was already excluded).

- FindDevIL: search for IL/il.h instead of bare il.h, so IL_INCLUDE_DIR is the
  directory that makes the code's #include <IL/il.h> resolve. Searching for
  il.h returned the IL/ subdirectory itself on layouts like Homebrew's
  <prefix>/include/IL, so <IL/il.h> did not resolve and configure failed on
  macOS. This matches how IL_INCLUDE_DIR is already used elsewhere (e.g.
  tools/scripts/prepare_static_spring.sh passes the parent include dir). On
  Linux the system include path masked the old behavior.

No effect on the Linux/Windows build paths.

Assisted by Claude Code; verified by configuring on macOS.
@tomjn tomjn changed the title macOS: skip Libunwind on Apple + fix DevIL include dir macOS: skip Libunwind on Apple + fix DevIL include-dir lookup Jun 20, 2026
@tomjn

tomjn commented Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

@sprunk updated the PR, the cmake find IL macro would set the include prefix wrong on MacOS to the IL folder so it'd need changing to <il.h> without that fix, but PR's updated to fix the macro instead

@tomjn tomjn force-pushed the build/macos-cmake-configure branch from 60526b5 to 1f4225d Compare June 20, 2026 15:30
@sprunk sprunk added big mac Part of the big push to support Mac. area: devops/gitops CI/CD pipelines, Docker builds, CMake build system, and repository infrastructure labels Jun 22, 2026

@sprunk sprunk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, would be nice to verify this doesn't break some other setup though.

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

Labels

area: devops/gitops CI/CD pipelines, Docker builds, CMake build system, and repository infrastructure big mac Part of the big push to support Mac.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants