Skip to content

PM-227 Fixed MacOS builds for intel using Rosetta2 - #8

Merged
MostafaNanticock merged 21 commits into
mainfrom
PM-227-Fix-Failing-CI-CD-intel-MacOS-pipeline
Apr 18, 2026
Merged

MostafaNanticock merged 21 commits into
mainfrom
PM-227-Fix-Failing-CI-CD-intel-MacOS-pipeline

Conversation

@MostafaNanticock

Copy link
Copy Markdown
Contributor

No description provided.

Prefix CMake, build and test commands with an ARCH_PREFIX env var and set that var on macOS to force x86_64 execution. The macOS workflow now installs Rosetta (ignoring the non-zero exit when already installed) and writes "ARCH_PREFIX=arch -x86_64" to GITHUB_ENV so Qt6's CMake config sees the expected host architecture and avoids ARM64/x86_64 mismatches. Build steps remain no-op when ARCH_PREFIX is unset.
Clarify Rosetta install and adjust how x86_64 Qt is used on ARM runners. Remove the previous ARCH_PREFIX approach and instead set CMAKE_ARCH_FLAGS in the environment to force CMAKE_OSX_ARCHITECTURES=x86_64 and disable Qt's architecture check (QT_NO_FORCE_ARCHITECTURE_CHECK=TRUE). This lets cmake run natively on ARM64 while producing x86_64 outputs and allowing Qt tools/tests to run under Rosetta.
Introduce a new workflow input cmake_extra_flags (string, default empty) in .github/workflows/_build-shared.yml and pass it through to the cmake configure command. Update .github/workflows/macos.yml to set cmake_extra_flags to add -weak_framework AGL for executable and shared linker flags so builds using Qt6 prebuilt binaries won't fail when AGL.framework is missing on newer macOS versions.
Replace the previous weak-link workaround with a scripted Qt install using aqtinstall in the macOS CI workflow. The job now creates a venv, installs aqtinstall, resolves the best matching Qt release for the requested version, installs Qt into $HOME/Qt, and exports QT paths to the environment. For Qt 6, it also patches installed CMake files to remove embedded "-framework AGL" references (AGL was removed from macOS 10.15 and is absent on newer runners) so builds do not link against a missing framework. This keeps Qt5 behavior unchanged and avoids linker-time weak-linking hacks.
Replace the broken qt_install_script conditional approach with the
proven qt_arch:clang_64 approach using jurplel/install-qt-action@v4.

The qt_install_script == '' condition in GitHub Actions reusable
workflows incorrectly evaluates to false for unset optional inputs,
causing Install Qt (custom) to run instead of Install Qt for all
build-macos-intel jobs.

The working approach:
- Use macos-latest (ARM64) for all Intel builds
- Pass qt_arch: clang_64 to install x86_64 Qt via jurplel
- Install Rosetta 2 on ARM64 runners to execute x86_64 test binaries
- Set CMAKE_OSX_ARCHITECTURES=x86_64 via osx_arch_flag step output
- Remove build-macos-intel-qt6-rosetta (no longer needed)
- Remove macos-26-intel runner dependency
Expose a qt_arch input and add a new optional setup_env_script input to the reusable workflow so callers can run an environment setup script after Qt install and before CMake configure. Remove the previous osx_arch_flag logic and the built-in Rosetta install; instead the workflow runs setup_env_script only when provided. Update the macOS workflow to set qt_arch to clang_64 and supply a setup_env_script that installs Rosetta and sets CMAKE_OSX_ARCHITECTURES via GITHUB_ENV for Intel cross-compilation on ARM runners.
@MostafaNanticock
MostafaNanticock merged commit e37f878 into main Apr 18, 2026
51 checks passed
@MostafaNanticock
MostafaNanticock deleted the PM-227-Fix-Failing-CI-CD-intel-MacOS-pipeline branch April 18, 2026 15:35
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.

1 participant