Build setting 'headerSearchPath' contains invalid component(s): $(SRCROOT)

After upgrading from Xcode 11 beta 2 to Xcode 11 beta 5, we started seeing

$ swift package generate-xcodeproj
/Users/paulbeusterien/gh5/firebase-ios-sdk: error: manifest parse error(s):
the build setting 'headerSearchPath' contains invalid component(s): $(SRCROOT)


We were using $(SRCROOT) in the headerSearchPath to work around SwiftPM missing support for private headers and missing support for header-only interface framework dependencies.

Any suggested resolutions?

The code rejecting “$(SRCROOT)” was written by @Aciid. Maybe he (or @abertelrud or @NeoNacho) can tell us how it is supposed to be done.


1 Like

Values in .headerSearchPath are relative to the target path so you can use ../ to go one level up. For example, .headerSearchPath("../GoogleUtilities/Logger/Private") should work for this case.

1 Like

Adding relative paths doesn't seem to work:

Ah. That looks like a bug in the generated Xcode project. Do you mind filing a JIRA for that? It should work if you open the package directly in Xcode.

1 Like

Thanks, but opening the package directly in Xcode fails because of
error: unexpected service error: build aborted due to an internal error: planningFailed("multiple configured targets of \'Firebase\' are being created for macOS")
that is described in detail here.

(Created [SR-11321] [SwiftPM] generate-xcodeproj does not generate relative search paths correctly · Issue #4676 · apple/swift-package-manager · GitHub for the issue with generate-xcodeproj)

In a similar vein, I'm trying to add something along the lines of

cSettings: [

and I'm getting the same invalid component error. Is there a way I'm not seeing? Or perhaps this error should be disabled if unsafeFlags is used?