Skip to content

Commit 9df9774

Browse files
authored
Work around QTBUG-145239 with a local patch (#1506)
This commit implements a quick workaround for QTBUG-145239 [1], which causes build failure when building Qt 6.9.1 with XCode 26.4. Ideally we should switch to Qt 6.11.1 or lather that has the fix for QTBUG-145239 [2], but doing so requires us to bump the minimum supported OS version to macOS 13 (#1458), which is also a non-trivial change. At the same time, macos-26 image in the GitHub Actions Runners GitHub is going to switch to XCode 26.4.1 in the week of May 11, 2026 [3]. We need some stopgap solution here. Let's patch the code in question locally in build_qt.py. Closes #1455. [1]: https://qt-project.atlassian.net/browse/QTBUG-145239 [2]: https://codereview.qt-project.org/c/qt/qtbase/+/724619 [3]: actions/runner-images#14001 PiperOrigin-RevId: 913012428
1 parent e88f784 commit 9df9774

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

src/build_tools/build_qt.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,36 @@ def extract_qt_src(args: argparse.Namespace) -> None:
840840
f.extractall(path=qt_src_dir, filter=filter)
841841
else:
842842
f.extractall(path=qt_src_dir, members=qt_extract_filter(f))
843+
# TODO: https://github.com/google/mozc/issues/1457 - Remove this.
844+
apply_patch_to_qt_src(qt_src_dir, args.dryrun)
845+
846+
847+
def apply_patch_to_qt_src(
848+
qt_src_dir: pathlib.Path,
849+
dryrun: bool = False,
850+
) -> None:
851+
"""Apply local patches to the extracted Qt source.
852+
853+
Args:
854+
qt_src_dir: The root directory of the extracted Qt source.
855+
dryrun: True to skip actual file modifications.
856+
"""
857+
# Workaround for QTBUG-145239: qyieldcpu.h fails to compile with
858+
# macOS 26.4 SDK on Apple Silicon.
859+
# https://qt-project.atlassian.net/browse/QTBUG-145239
860+
# https://codereview.qt-project.org/c/qt/qtbase/+/724619
861+
qyieldcpu_h = qt_src_dir.joinpath('src', 'corelib', 'thread', 'qyieldcpu.h')
862+
if dryrun:
863+
print(f'dryrun: patching {qyieldcpu_h} for QTBUG-145239')
864+
return
865+
content = qyieldcpu_h.read_text(encoding='utf-8')
866+
content = content.replace(
867+
'#if __has_builtin(__yield)\n',
868+
'#if __has_builtin(__builtin_arm_yield)\n'
869+
' __builtin_arm_yield();\n'
870+
'#elif __has_builtin(__yield)\n',
871+
)
872+
qyieldcpu_h.write_text(content, encoding='utf-8')
843873

844874

845875
def main():

0 commit comments

Comments
 (0)