Warnings as errors in sub packages (original) (raw)
Hello,
We're having some problems with using warnings-as-errors in new Xcode versions. I've searched online and no-one is talking about this issue so here goes...
Our project is split up into multiple sub packages and at the top we have an Xcode workspace which contains the iOS application Xcode project.
We use warnings-as-errors
in ALL of our modules, in every sub package, via .unsafeFlags(["-warnings-as-errors"])
SwiftSetting defined on each module. Treat warnings as errors is also enabled in the app Xcode project.
Day to day workflow for engineers is to work directly inside a sub package rather than in the workspace, for obvious reasons. Sub packages themselves can depend on other, lower level, sub packages. So something like:
Core
- no dependenciesFeature A
- depends on Core
sub packageApp
- depends on both Core
and Feature A
sub packages
Starting in Xcode 15.2, when working in Feature A we started seeing "ghost" errors produces by Xcode saying `Conflicting options '-warnings-as-errors' and '-suppress-warnings' (in target 'X' from project 'Core'). By ghost errors I mean they were reported as errors but did not produce a nonzero exit code, so the build passed. That changed in Xcode 15.3 where these now do fail the build.
Inspecting the Xcode build log the -suppress-warnings
is indeed added automatically. Strangely this is NOT an issue when working in the main workspace - there Xcode does not add -suppress-warnings
automatically - but only when working in a package directly in Xcode.
Is there a way to prevent Xcode from adding -suppress-warnings
automatically when building local sub package modules? A bit surprised noone is having these issues, is using warnings-as-errors
not a common practice?
Thanks for any help in advance
We have the exact same problem after updating to Xcode 15.3. Fixes or workarounds would be warmly welcomed!
ifabijanovic (Ivan Fabijanović) April 5, 2024, 7:08pm 3
Just a short update - I submitted this problem to Apple Feedback Assistant, haven't heard back yet but will post here if/when I do.
mathaeus (Mathaeus) April 9, 2024, 11:29am 4
For me, in Xcode 15.3 the build fails in the main project as well unfortunately.
In other words, the error from a local Swift Package makes the whole build fail and therefore blocks me from updating to Xcode 15.3
I was on Xcode 15.1 before and there it resulted in the "ghost errors" as well without failing the build.
Jon_Shier (Jon Shier) April 9, 2024, 7:27pm 5
Ghost errors are still a problem in Xcode 15.3, if by "ghost error" you mean previous errors that Xcode doesn't clear from the UI but which don't fail the build.
mathaeus (Mathaeus) April 10, 2024, 12:20pm 6
@Jon_Shier I'm referring to ghost errors in the way the author of this topic did in his initial post.
kovpas (Pavel 'Pasha' Mazurin) April 26, 2024, 1:09pm 7
Still happening in Xcode 15.4 Beta
mathaeus (Mathaeus) May 22, 2024, 9:34am 8
And also still happening in the official release of Xcode 15.4
koliyo (Nils Hjelte) August 15, 2024, 8:50am 9
Same problem here in xcode 15.4
Even after removing the -warnings-as-errors
settinging in the subproject. I am unable to trace where this is cached/sourced. And same problem after a Clean Build Folder
kovpas (Pavel 'Pasha' Mazurin) August 15, 2024, 9:39am 10
Not fixed in Xcode 16 beta either...
mtzaquia (Mauricio Tremea Zaquia) August 20, 2024, 9:29am 11
I'm facing the same issue. None of the workarounds I've tried have had any effect on suppressing this.
mtzaquia (Mauricio Tremea Zaquia) January 29, 2025, 12:37pm 12
Perhaps unsurprisingly, this is still an issue in Xcode 16.2.
AlexisQapa (Alexis Schultz) January 29, 2025, 1:59pm 13
I recently discovered that disabling « show lives issues » in Xcode settings fixes the gosts issues while still showing issues normally.
kovpas (Pavel 'Pasha' Mazurin)
January 30, 2025, 12:38pm 14
Sadly, I still get conflicting options error even with "Show live issues" turned off
AlexisQapa (Alexis Schultz) January 30, 2025, 12:41pm 15
Sorry for the ambiguous wording, I only meant that it suppresses the "ghost" issues, not the cause of the thread.
hagi-cgn (Sebastian Hagedorn) May 27, 2025, 10:21am 16
We're using a different workflow, but with the same root problem:
- we have an app with some internal and some external packages
- we don't treat warnings as errors locally to be lenient during development/debugging, but we want to treat warnings as errors in CI (for builds and tests)
We orchestrate CI via fastlane so an easy solution seemed to just set up an extra xcconfig file and pass that to all fastlane actions, setting SWIFT_TREAT_WARNINGS_AS_ERRORS
to YES
. But as described above, apparently Xcode/SPM adds a -suppress-warnings
flag to all (external) packages, which leads to a conflict and build error