macOS: Initial Apple Silicon and x86_64 build support#14059
Conversation
…MakeLists.txt files Fixes by cmake-format
…nstream> Replace __has_include with __cpp_lib_stacktrace / __cpp_lib_spanstream from <version>. A header may exist on the include path without a usable implementation, which fools __has_include; the feature-test macros are only defined when the library actually provides the feature.
|
I am getting the following error locally: Making the |
A `static const int` class member requires an out-of-class definition when ODR-used. The Linux toolchain happened to optimise the load away, but AppleClang on arm64 emitted a reference and failed to link RifStimPlanModelGeologicalFrkExporter::MAX_STIMPLAN_LAYERS. `constexpr` implies inline for static data members, so the definition is no longer required.
Fixed |
|
I guess we should improve the GitHub runners for Mac. Please advise two runners that you think are the most relevant. |
|
Compiling and running the program works locally fine for me now. However, installing the bundle fails due to missing Github actions: Local version: |
I would not explicitly support intel x86 as Apple shifted from them like 5 years ago. Since you ship bundles that link to the system standard library, I would try to compile with the oldest possible mac, to the extent possible of course. This way, you have a bigger range of supported macOS versions. |
|
Oh, regarding the github bundle above, sorry, it actually ships everything, you just need to get the bundle out of the quarantine: This allows you macOS run programs built in other machines. For releases, the program should probably be authenticated or certified, I do not know. I have very little experience with that. |
… workaround The macOS artifact is unsigned/unnotarised, so Gatekeeper quarantines ResInsight.app on download and refuses to launch it. Drop a short README-macOS.txt next to the bundle with the `xattr -d com.apple.quarantine` command so users see the workaround without having to hunt through PR comments. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…14.0 Replace macos-latest (moving alias) with explicit macos-14 to avoid silent runner rolls. Set CMAKE_OSX_DEPLOYMENT_TARGET=14.0 so the produced binary runs on macOS 14+, decoupling end-user reach from whichever runner image GitHub provides. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…gure failure macos-14 ships Xcode 15 / AppleClang 15, below the CMakeLists.txt floor of AppleClang 17 (Xcode 16), which broke the configure step. macos-15 ships Xcode 16 / AppleClang 17 and clears the floor. Bump CMAKE_OSX_DEPLOYMENT_TARGET to 15.0 to match. Also drop `if: always()` from the README-macOS.txt step: the cmakebuild install dir does not exist if configure fails, so the cat redirect errored out and turned a configure failure into a second red step. The workaround note is only useful when the bundle actually built. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Added in a text file as part of the Mac install package, the user needs to execute this command before launching ResInsight. |
Adds initial macOS build support for Apple Silicon (arm64) and Intel (x86_64), addressing the work outlined in #13971. Tracked under #14045.
Build system
New vcpkg overlay triplets
arm64-osxandx64-osxdetect the macOS SDK viaxcrun --show-sdk-path(vcpkg otherwise emits a literal empty-isysrootwhen CMake fails to populateCMAKE_OSX_SYSROOT) and injectCMAKE_POLICY_VERSION_MINIMUM=3.5for ports still on legacy CMake minimums. The top-levelCMakeLists.txtadds an AppleClang 17 / Xcode 16 floor alongside the existing Clang 19 gate, prepends Homebrew llvm's libc++ to the link search and rpath so C++23 symbols resolve correctly, defaultsRESINSIGHT_ENABLE_OPENVDSto OFF on Apple (Bluware ships no macOS binaries), andvcpkg.jsonexcludesgrpcon osx.grpc
grpc is excluded from vcpkg and build configuration. Can be introduced at a later stage, not investigated in order to keep the baseline as small as possible.
openzgy
macOS does not ship libomp by default, and the vendored openzgy unconditionally includes
<omp.h>and uses the glibcstrerror_rsignature. A local patch atThirdParty/openzgy-patches/macos-disable-openmp.patchstubsomp_get_*, rewrites thestrerror_rfallback, and disables a small number of OpenMP-driven error paths. CMake auto-applies the patch on Apple viagit applywith a--reverse --checkidempotency probe, so the submodule pointer does not need to move.This is a temporary workaround until a compile flag for ZGY is introduced in #13979
Other
C++23 fallbacks:
<stacktrace>(RiaMainTools, RiaOpenTelemetryManager, RiuMainWindow) and<spanstream>(RifVtkImportUtil) are guarded behind__has_includeso libc++ builds without these C++23 headers still compile. When<stacktrace>is unavailable the crash path logs the signal and falls back gracefully. The signal-context program-counter capture inmanageSegFailureSAis skipped on Apple because the ucontext layout differs from Linux and<ucontext.h>is deprecated there.Bundling:
qt_add_executableis givenMACOSX_BUNDLEacross the affected executables so the resulting.appbundles are produced correctly.CI
New
.github/workflows/ResInsightMac.ymlruns nightly and on push/PR tomac-prototypewhile the macOS port stabilises. It builds buildcache from upstream source (the CeetronSolutions action has no macOS support), installs Homebrew bison (vcpkg's thrift port requires bison > 2.5 and macOS ships 2.3), and re-downloads Qt 6.7 each run.Closes #14045
Closes #13971
Closes #14044