Skip to content

build(frontend): pass the Qt prefix as a system include on Xcode (#2950) - #2978

Closed
zackees wants to merge 1 commit into
masterfrom
infra/2950-qt-system-includes
Closed

zackees wants to merge 1 commit into
masterfrom
infra/2950-qt-system-includes

Conversation

@zackees

@zackees zackees commented Oct 30, 2026

Copy link
Copy Markdown
Member

Refs #2950

The macOS lanes stop inside Qt's own inline code, not in this repo:

<QtCore/qversiontagging.h>:80        int -> quintptr
<QtCore/qnamespace.h>:1926,1930      'Int' <-> 'int'   (QKeyCombination)
<QtCore/qnamespace.h>:1935           const int -> unsigned int

Those are third-party headers, and the Ninja lanes stay quiet on them because an
imported target's INTERFACE_INCLUDE_DIRECTORIES arrive as system includes. The
Xcode generator has no -isystem: Modules/Platform/Darwin.cmake clears
CMAKE_INCLUDE_SYSTEM_FLAG_C and _CXX under XCODE ("Xcode does not support
-isystem yet"). So the Qt prefix reaches the app's TUs as plain -I and the
-Wsign-conversion the target opts into (#2625) applies to Qt's headers too.

This passes the Qt include directories to clang as -isystem for obs-studio
on macOS, so the #2625 ratchet keeps applying to obs code while third-party
headers stay quiet — the treatment Linux already gets. No source conversion, no
flag pin: the target's opt-in line is untouched, and
ci/test_frontend_conversion_optins.py still holds it to that shape.

A header is a system header when any -isystem path finds it, even when -I
lists the same directory (checked with clang 19 on 2026-10-29: -I dir -isystem dir suppresses the warning, -I dir alone does not), so CMake's own -I copy
is harmless.

RED: scheduled.yaml run 40983897736, Build 🧱 / macOS 🍏 (arm64) job 123830620422 — the five diagnostics above, after Compiling frontend.sparkle+.hpp.cpp.

GREEN: the same scheduled.yaml dispatch on this branch (macOS arm64 lane past frontend.sparkle+.hpp.cpp, x86_64 and the release gate to be rechecked if arm64 is clean).

Tiers that do not apply: no Rust unit, C test, protocol or runtime behaviour
change — a build-configuration fix, and the touched line is behind OS_MACOS.

The macOS lanes stop in Qt's own headers with -Wsign-conversion:

  <QtCore/qversiontagging.h>:80   int -> quintptr
  <QtCore/qnamespace.h>:1926,1930 Int <-> int (QKeyCombination)
  <QtCore/qnamespace.h>:1935      const int -> unsigned int

They are third-party code, and the Ninja lanes never report them: an imported
target's INTERFACE_INCLUDE_DIRECTORIES arrive as system includes. The Xcode
generator has no -isystem -- Modules/Platform/Darwin.cmake clears
CMAKE_INCLUDE_SYSTEM_FLAG_C and _CXX when XCODE is set -- so there the same
directories arrive as plain -I and the ratchet's group flag applies to them.

obs_frontend_platform_qt() now passes the Qt include directories to clang as
-isystem for the app target. A header counts as a system header when any
-isystem path finds it, even when -I lists the directory too, so CMake's own -I
is harmless. The shared ui-qt.cmake keeps no host branch (ci/
test_frontend_cmake_facade.py).

RED: scheduled.yaml run 40983897736, Build macOS (arm64) job 123830620422.
GREEN: the same dispatch on this branch.
@zackees
zackees force-pushed the infra/2950-qt-system-includes branch from 7788381 to 67e03fe Compare October 30, 2026 02:39
@zackees

zackees commented Oct 30, 2026

Copy link
Copy Markdown
Member Author

Closed: the -isystem route did not clear the macOS lane (run 40992591865, job 123858373923 still reports the Qt diagnostics). Evidence and the two remaining options are on #2950. 2026-10-30

@zackees

zackees commented Oct 30, 2026

Copy link
Copy Markdown
Member Author

Third GREEN attempt still reports the same six diagnostics, and the cause is now measured rather than assumed.

What the three dispatches showed

Run Change Result
40992591865 -isystem via target_compile_options same 6 diagnostics (jobs 123858373923 / 123858373971)
40993841404 + XCODE_ATTRIBUTE_OTHER_CFLAGS same 6 diagnostics
40995262377 + -iframework from the bundles, configure-time print configure printed the collected dirs; the run died at error: no such file or directory: '$<1:-iframework...' — a generator expression in the build setting reaches clang as a literal input file
40996358276 plain-string flags only, -iframework derived from the bundle root configure: obs-frontend: Qt system flags ' -iframework.../obs-deps-qt6-2026-10-25-universal/lib ...'; the same 6 diagnostics again (job 123870511034)

So the flags do reach the compiler: -iframework <prefix>/lib is on the app target's command line and the Qt dep is a framework build (.deps/obs-deps-qt6-.../lib/QtCore.framework/Headers/qnamespace.h), which is why -isystem on a Headers directory could never have worked — <QtCore/qnamespace.h> is resolved by framework lookup, not -I.

Why the system flag still loses

Reproduced with clang 21 on a synthetic bundle:

clang++ -F lib            -Wsign-conversion -c t.cpp   # warning: header is a user framework header
clang++ -iframework lib   -Wsign-conversion -c t.cpp   # clean: system framework search
clang++ -F lib -iframework lib -Wsign-conversion -c t.cpp  # warning again

Framework lookup is first-match, unlike -I/-isystem where a directory present in both lists is treated as system. Xcode emits the target's FRAMEWORK_SEARCH_PATHS (-F) before OTHER_CFLAGS (-iframework), so the earlier user entry wins and Qt stays a user framework. Nothing appended through a compile option or a build setting can be ordered ahead of it, and CMake owns the -F entry (Chromium-free INTERFACE_LINK_LIBRARIES of the imported Qt targets), so this route is a dead end rather than a near miss.

Decision needed

The app target opts into -Wsign-conversion for CXX,AppleClang,Clang,GNU in frontend/CMakeLists.txt, and the global pins live in cmake/linux/compilerconfig.cmake only. That combination is buildable on Ninja (imported includes arrive as system includes) and not buildable under Xcode, where a third-party framework cannot be made system from CMake. Two honest end states, my recommendation first:

  1. Scope the group to the toolchains that can express it — name Clang,GNU (not AppleClang) in that one opt-in line and record in the ratchet ledger that the AppleClang app target does not enforce -Wsign-conversion while Qt is a framework dependency, with the macOS-visible conversions that follow left to the release lane's own diagnostics. Keeps every Linux lane ratcheted, unblocks the release and macOS lanes today, and the gap is documented rather than hidden.
  2. Keep the flag on AppleClang and pay the build-side cost: convert the app target's Qt-touching TUs first (they are the ones whose #include <Q…> pulls the inline code) and drop the group from obs-studio until the frontend is Qt-light enough — much larger, and the same Qt headers are still included by converted files.

Tell me which, and if it is (1) I will push the one-line scope change plus the ledger note and re-run this dispatch.

Refs #2950, Refs #2625.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant