swift-driver: SwiftDriver compilation error: com.apple.xcode.tools.swift.compiler is not absolute

Describe the bug I have c library swift wrapper project and I am starting to see errors for all of the c header files included in my project. This didn’t happen in Xcode 12 and Xcode 13 but starting to see them after upgraded to Xcode 14.

error: Dependency for P1:target-SwiftSMB-c5b2ccc17d5f0c8fd1175d05f13f3d0683a44e681aeb1f425a9cef51a7a8aacb-:Debug:SwiftDriver Compilation Requirements SwiftSMB normal x86_64 com.apple.xcode.tools.swift.compiler is not absolute (libsmb2/include/smb2/smb2.h). (in target 'SwiftSMB' from project 'SwiftSMB') ... Showing All Messages Command SwiftDriver Compilation Requirements emitted errors but did not return a nonzero exit code to indicate failure

The error doesn’t seem to stop build from completing successfully.

Command line: SwiftDriver\ Compilation\ Requirements SwiftSMB normal x86_64 com.apple.xcode.tools.swift.compiler (in target 'SwiftSMB' from project 'SwiftSMB') cd /Users/alex/Projects/SwiftSMB builtin-Swift-Compilation-Requirements -- /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -module-name SwiftSMB -Onone -enforce-exclusivity\=checked @/Users/alex/Library/Developer/Xcode/DerivedData/PhotoBackup2-bnxhcxnjkjxzzbdqwrgkurniflbr/Build/Intermediates.noindex/SwiftSMB.build/Debug-iphonesimulator/SwiftSMB.build/Objects-normal/x86_64/SwiftSMB.SwiftFileList -DDEBUG -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk -target x86_64-apple-ios16.0-simulator -enable-bare-slash-regex -g -module-cache-path /Users/alex/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -Xfrontend -serialize-debugging-options -enable-testing -index-store-path /Users/alex/Library/Developer/Xcode/DerivedData/PhotoBackup2-bnxhcxnjkjxzzbdqwrgkurniflbr/Index.noindex/DataStore -enable-library-evolution -swift-version 5 -I /Users/alex/Library/Developer/Xcode/DerivedData/PhotoBackup2-bnxhcxnjkjxzzbdqwrgkurniflbr/Build/Products/Debug-iphonesimulator -I libsmb2 -I libsmb2/include -I libsmb2/lib -I libsmb2/include/smb2 -F /Users/alex/Library/Developer/Xcode/DerivedData/PhotoBackup2-bnxhcxnjkjxzzbdqwrgkurniflbr/Build/Products/Debug-iphonesimulator -emit-localized-strings -emit-localized-strings-path /Users/alex/Library/Developer/Xcode/DerivedData/PhotoBackup2-bnxhcxnjkjxzzbdqwrgkurniflbr/Build/Intermediates.noindex/SwiftSMB.build/Debug-iphonesimulator/SwiftSMB.build/Objects-normal/x86_64 -c -j8 -enable-batch-mode -incremental -output-file-map /Users/alex/Library/Developer/Xcode/DerivedData/PhotoBackup2-bnxhcxnjkjxzzbdqwrgkurniflbr/Build/Intermediates.noindex/SwiftSMB.build/Debug-iphonesimulator/SwiftSMB.build/Objects-normal/x86_64/SwiftSMB-OutputFileMap.json -use-frontend-parseable-output -save-temps -no-color-diagnostics -serialize-diagnostics -emit-dependencies -emit-module -emit-module-path /Users/alex/Library/Developer/Xcode/DerivedData/PhotoBackup2-bnxhcxnjkjxzzbdqwrgkurniflbr/Build/Intermediates.noindex/SwiftSMB.build/Debug-iphonesimulator/SwiftSMB.build/Objects-normal/x86_64/SwiftSMB.swiftmodule -emit-module-interface-path /Users/alex/Library/Developer/Xcode/DerivedData/PhotoBackup2-bnxhcxnjkjxzzbdqwrgkurniflbr/Build/Intermediates.noindex/SwiftSMB.build/Debug-iphonesimulator/SwiftSMB.build/Objects-normal/x86_64/SwiftSMB.swiftinterface -emit-private-module-interface-path /Users/alex/Library/Developer/Xcode/DerivedData/PhotoBackup2-bnxhcxnjkjxzzbdqwrgkurniflbr/Build/Intermediates.noindex/SwiftSMB.build/Debug-iphonesimulator/SwiftSMB.build/Objects-normal/x86_64/SwiftSMB.private.swiftinterface -Xcc -I/Users/alex/Library/Developer/Xcode/DerivedData/PhotoBackup2-bnxhcxnjkjxzzbdqwrgkurniflbr/Build/Intermediates.noindex/SwiftSMB.build/Debug-iphonesimulator/SwiftSMB.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/alex/Library/Developer/Xcode/DerivedData/PhotoBackup2-bnxhcxnjkjxzzbdqwrgkurniflbr/Build/Intermediates.noindex/SwiftSMB.build/Debug-iphonesimulator/SwiftSMB.build/SwiftSMB-generated-files.hmap -Xcc -I/Users/alex/Library/Developer/Xcode/DerivedData/PhotoBackup2-bnxhcxnjkjxzzbdqwrgkurniflbr/Build/Intermediates.noindex/SwiftSMB.build/Debug-iphonesimulator/SwiftSMB.build/SwiftSMB-own-target-headers.hmap -Xcc -I/Users/alex/Library/Developer/Xcode/DerivedData/PhotoBackup2-bnxhcxnjkjxzzbdqwrgkurniflbr/Build/Intermediates.noindex/SwiftSMB.build/Debug-iphonesimulator/SwiftSMB.build/SwiftSMB-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/alex/Library/Developer/Xcode/DerivedData/PhotoBackup2-bnxhcxnjkjxzzbdqwrgkurniflbr/Build/Intermediates.noindex/SwiftSMB.build/Debug-iphonesimulator/SwiftSMB.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/alex/Library/Developer/Xcode/DerivedData/PhotoBackup2-bnxhcxnjkjxzzbdqwrgkurniflbr/Build/Intermediates.noindex/SwiftSMB.build/Debug-iphonesimulator/SwiftSMB.build/SwiftSMB-project-headers.hmap -Xcc -I/Users/alex/Library/Developer/Xcode/DerivedData/PhotoBackup2-bnxhcxnjkjxzzbdqwrgkurniflbr/Build/Products/Debug-iphonesimulator/include -Xcc -isystem -Xcc libsmb2/include -Xcc -isystem -Xcc libsmb2/include/smb2 -Xcc -I/Users/alex/Library/Developer/Xcode/DerivedData/PhotoBackup2-bnxhcxnjkjxzzbdqwrgkurniflbr/Build/Intermediates.noindex/SwiftSMB.build/Debug-iphonesimulator/SwiftSMB.build/DerivedSources-normal/x86_64 -Xcc -I/Users/alex/Library/Developer/Xcode/DerivedData/PhotoBackup2-bnxhcxnjkjxzzbdqwrgkurniflbr/Build/Intermediates.noindex/SwiftSMB.build/Debug-iphonesimulator/SwiftSMB.build/DerivedSources/x86_64 -Xcc -I/Users/alex/Library/Developer/Xcode/DerivedData/PhotoBackup2-bnxhcxnjkjxzzbdqwrgkurniflbr/Build/Intermediates.noindex/SwiftSMB.build/Debug-iphonesimulator/SwiftSMB.build/DerivedSources -Xcc -DDEBUG\=1 -emit-objc-header -emit-objc-header-path /Users/alex/Library/Developer/Xcode/DerivedData/PhotoBackup2-bnxhcxnjkjxzzbdqwrgkurniflbr/Build/Intermediates.noindex/SwiftSMB.build/Debug-iphonesimulator/SwiftSMB.build/Objects-normal/x86_64/SwiftSMB-Swift.h -import-underlying-module -Xcc -ivfsoverlay -Xcc /Users/alex/Library/Developer/Xcode/DerivedData/PhotoBackup2-bnxhcxnjkjxzzbdqwrgkurniflbr/Build/Intermediates.noindex/SwiftSMB.build/Debug-iphonesimulator/SwiftSMB.build/unextended-module-overlay.yaml -working-directory /Users/alex/Projects/SwiftSMB -experimental-emit-module-separately

Environment (please fill out the following information)

  • OS: macOS 12.6
  • Xcode 14
  • swift-driver version: 1.62.8 Apple Swift version 5.7 (swiftlang-5.7.0.127.4 clang-1400.0.29.50)

Additional context I have tried cleaning up build folder and rebuild project using Xcode 14 but none of them work.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 26
  • Comments: 23

Most upvoted comments

Thanks @ixsander your solution works for me too.

For others: In your .framework file, look for module.modulemap in Modules folder.

I had module declared like framework module ABC {}

after changing that to framework module ABC [system] {} I got rid of the errors.

The error messages are disappeared by changing modulemap file from “extern_c” to “system” module ABC [system] { ... }

We had the same problem with GoogleMaps on Xcode 14. The problem was that we had “User Header Search Paths” set to “${PROJECT_DIR}/Pods”, after deleting that the problem disappeared. This problem can also be resolved by using xcframework version of the GoogleMaps library (still in beta).

Note that these “errors” show as errors but build and archive succeeds if done from Xcode. The problem was happening when we used xcodebuild, it just stopped at “Touch xxx.app” without any error (probably because of non-zero return code).

I Started Getting This On One Of Our Team’s Working Branches, The Description Wasn’t That Helpful, I Even Downgraded Xcode To See If That Was The Problem But That Wasn’t It, Although There Was An Improve On The Error Message, Which Wasn’t Either The Cause.

I Tried Previous Builds To Determine Which Was The Latest To Work Fine, And To Validate That It Was Still Building Properly. I Found The Latest Passing Build And Retried It(It Passed So It Wasn’t The Recently Upgrade To Xcode 14). I Reviewed The Commit On The First Failing Build And There Was Something Weird There, A Renamed File Was Showing “⧵t⧵t⧵” Substring On The File’s Path, The Following Commits Were Showing The File Being Re Added But While Pulling The Code, The File Wasn’t There.

The Fix On My Case Was To Return To The Last Working Code, Branch From There, And Manually Adding The Missing Code.

Hope This Helps Someone.

Thanks @saqib-saud and @ixsander

that fixed the error for firebase core, but as you know this is a 3rd library, is there a way to make CocoaPods or xcode consider it as [system] without modifying source code of that library ?

You can do something like this in post install step:

post_install do |pi|
   pathToTTTAttributedLabelModulemap = pi.config.project_pods_root + 'Target Support Files/TTTAttributedLabel/TTTAttributedLabel.modulemap'
   if File.exists?(pathToTTTAttributedLabelModulemap)
      text = File.read(pathToTTTAttributedLabelModulemap)
      modifiedText = text.gsub('module TTTAttributedLabel {', 'module TTTAttributedLabel [system] {')
      File.open(pathToTTTAttributedLabelModulemap, "w") {|file| file.puts modifiedText }
      puts "Editing TTTAttributedLabel.modulemap"
   end
end

I also looked for many solutions, Here’s I’m looking solution: Build Setting -> Build Options -> Build Libraries for Distribution or BUILD_LIBRARY_FOR_DISTRIBUTION = NO; setup NO

Thanks @saqib-saud and @ixsander

that fixed the error for firebase core, but as you know this is a 3rd party library, is there a way to make CocoaPods or xcode consider it as [system] without modifying source code of that library ?

Thanks @ixsander your solution works for me too.

For others: In your .framework file, look for module.modulemap in Modules folder.

I had module declared like framework module ABC {}

after changing that to framework module ABC [system] {} I got rid of the errors.

This fixed it for me, thanks a lot! I have an old project that uses pods with these kind of frameworks. I added a build script right after “check pods manifest” that finds and adds the [system] to each framework. Building with BitRise now works again.

Script:

sed -i "" "s/module Firebase {/module Firebase [system] {/g" ./Pods/Firebase/CoreOnly/Sources/module.modulemap sed -i "" 's/module JWPlayer_iOS_SDK {/module JWPlayer_iOS_SDK [system] {/g' ./Pods/JWPlayer-SDK/JWPlayer_iOS_SDK.framework/Modules/module.modulemap

Thanks @ixsander your solution works for me too.

For others: In your .framework file, look for module.modulemap in Modules folder.

I had module declared like framework module ABC {}

after changing that to framework module ABC [system] {} I got rid of the errors.

You saved my day, ty🥹

We had the same problem with GoogleMaps on Xcode 14. The problem was that we had “User Header Search Paths” set to “${PROJECT_DIR}/Pods”, after deleting that the problem disappeared. This problem can also be resolved by using xcframework version of the GoogleMaps library (still in beta).

Note that these “errors” show as errors but build and archive succeeds if done from Xcode. The problem was happening when we used xcodebuild, it just stopped at “Touch xxx.app” without any error (probably because of non-zero return code).

this fix my problem

https://github.com/apple/swift-driver/issues/1271#issuecomment-1495707445 if you already use some of firebase libraries, you can fix this issue like this

I have the same problem,have you resolved it?