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. |
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