Skip to content

Fix macOS superbuild for Apple Silicon toolchains - #12

Closed
chraibi wants to merge 1 commit into
sir306:mainfrom
PedestrianDynamics:macos-superbuild-fixes
Closed

Fix macOS superbuild for Apple Silicon toolchains#12
chraibi wants to merge 1 commit into
sir306:mainfrom
PedestrianDynamics:macos-superbuild-fixes

Conversation

@chraibi

@chraibi chraibi commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Three failures prevented cmake --build _superbuild from completing on macOS (Apple Silicon, Xcode 26 / AppleClang 21). All changes are inside the existing elseif(APPLE) branches of UnrealFolder/ProjectMobius/CMakeLists.txt — Windows and Linux paths are untouched.

1. Assimp -Werror vs a newer compiler

SceneCombiner.cpp:997:14: error: first argument in call to 'memcpy' is a pointer to
  non-trivially copyable type 'aiFace' [-Werror,-Wnontrivial-memcall]

Assimp 5.4.3 predates AppleClang's -Wnontrivial-memcall, and its own ASSIMP_WARNINGS_AS_ERRORS (default ON) turns the new diagnostic into a build failure. Vendored third-party source is left untouched; the option is disabled from the superbuild instead.

2. minizip architecture mismatch

ld: warning: ignoring file '/usr/local/Cellar/minizip/1.3.1/lib/libminizip.dylib':
  found architecture 'x86_64', required architecture 'arm64'
Undefined symbols for architecture arm64: _unzClose, _unzGetCurrentFileInfo, ...

Assimp runs use_pkgconfig(UNZIP minizip), which on a machine with an Intel Homebrew prefix at /usr/local resolves to an x86_64 library — unlinkable against the arm64 build this branch pins. ASSIMP_BUILD_MINIZIP=ON skips the lookup and compiles the bundled contrib/unzip.

3. Staging produced a nested directory

if(EXISTS "${ASSIMP_INST}/lib/Mac") is evaluated at configure time, before Assimp has been built or installed. On a clean tree the directory does not exist yet, so it fell back to lib/ and copy_directory staged Plugins/UE4_Assimp/Binaries/Mac/Mac/ — one level too deep. The same branch already forces CMAKE_INSTALL_LIBDIR=lib/Mac, so the layout is known and the check was removable.

This one is latent rather than fatal: UE_AssimpLibrary.Build.cs reads from assimp/lib/Mac, not Binaries/Mac, so the editor build succeeds either way. It would surface at packaging time.

Verification

  • Full superbuild completes, exit 0. Assimp and HDF5 both produced as arm64 (lipo -archs), staged flat into Plugins/UE4_Assimp/Binaries/Mac/.
  • ProjectMobiusEditor Mac Development builds against UE 5.5.4 — 191/191 actions, exit 0 — and links the resulting Assimp dylib.
  • The editor then launches and loads an HDF5 simulation successfully.

Not tested on Windows or Linux; those code paths are unmodified.

Note for macOS builders

Two further things are needed on a current macOS, deliberately not included here since they are environment rather than repo concerns:

  • UE 5.5 caps Xcode at 16.9.0 in Engine/Config/Apple/Apple_SDK.json. With Xcode 26 installed, UBT reports Platform Mac is not a valid platform to build.
  • Xcode 26 ships the Metal shader compiler as a separate component: xcodebuild -downloadComponent MetalToolchain.

Three failures prevented the Assimp superbuild step from completing on
macOS. All fixes are scoped to the elseif(APPLE) branch; Windows and
Linux behaviour is unchanged.

- Assimp 5.4.3 predates AppleClang's -Wnontrivial-memcall, which its own
  -Werror escalates to a hard failure in SceneCombiner.cpp. Disable
  ASSIMP_WARNINGS_AS_ERRORS.
- pkg-config resolved minizip to an x86_64 Homebrew prefix, which cannot
  link against the arm64 build. Use the bundled contrib/unzip instead.
- The staging step chose its source directory with a configure-time
  EXISTS check against a path Assimp only creates during install, so a
  clean tree always fell back to lib/ and staged a nested Mac/ folder.
  CMAKE_INSTALL_LIBDIR is already forced to lib/Mac, so the check was
  redundant.

Verified by a full superbuild plus a successful ProjectMobiusEditor Mac
Development build against UE 5.5.4.
Copilot AI lite review requested due to automatic review settings August 11, 2026 09:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the macOS (Apple Silicon) superbuild configuration to ensure cmake --build _superbuild completes successfully with newer Apple toolchains, by adjusting how Assimp is configured and staged in the existing elseif(APPLE) branches.

Changes:

  • Disable Assimp’s ASSIMP_WARNINGS_AS_ERRORS on macOS to avoid new AppleClang warnings becoming hard failures.
  • Force Assimp to build its bundled unzip/minizip path (ASSIMP_BUILD_MINIZIP=ON) to avoid linking against an x86_64 Homebrew minizip.
  • Remove the configure-time EXISTS check for Assimp’s lib layout and stage from the known lib/Mac install directory to prevent nested Mac/Mac staging.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@chraibi

chraibi commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator Author

Additional verification on a pristine clone (the case the staging bug actually hits):

$ git clone <fork> && cd UnrealFolder/ProjectMobius
$ cmake -S . -B _superbuild -G Ninja -DCMAKE_BUILD_TYPE=Release && cmake --build _superbuild --parallel
exit=0, no errors

$ lipo -archs Plugins/UE4_Assimp/Binaries/Mac/libassimp.5.4.3.dylib   -> arm64
$ lipo -archs Plugins/Hdf5DataPlugin/.../install/lib/libhdf5.a        -> arm64
$ ls Plugins/UE4_Assimp/Binaries/Mac/
cmake  libassimp.5.4.3.dylib  libassimp.5.dylib  libassimp.dylib  pkgconfig

Staging is flat. On a fresh checkout there is no pre-existing lib/Mac for the configure-time EXISTS check to find, so the old code took the else branch and produced Binaries/Mac/Mac/ — this run confirms the third fix on exactly that path, rather than on a tree that happened to have been built before.

@chraibi

chraibi commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #22: the Assimp fixes here are re-applied there against the rewritten superbuild on the dev branch, the staging fix is already absorbed into that branch, and #22 additionally forces arm64 for the rewritten HDF5 step. Closing to keep the queue clean ahead of the dev→main merge.

@chraibi chraibi closed this Aug 12, 2026
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