Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SwiftDriver compilation error: com.apple.xcode.tools.swift.compiler is not absolute #1271

Open
ixsander opened this issue Sep 14, 2022 · 23 comments
Labels
bug Something isn't working

Comments

@ixsander
Copy link

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.

@ixsander ixsander added the bug Something isn't working label Sep 14, 2022
@jb522185660
Copy link

I have the same problem,have you resolved it?

@dawilliams-gpsw
Copy link

dawilliams-gpsw commented Sep 15, 2022

+1. We are also seeing this in our app.

edit: I was given a .xcframework to replace the regular .framework that was causing these 'warning errors', and the 'warning errors' went away.

Important to note, xcodebuild archive commands were failing when these 'warning errors' were present, even though Xcode.app was succeeding. Swapping over to the .xcframework (which subsequently removed the 'warning errors') allows xcodebuild's archive to succeed.

@macatingraoallan
Copy link

+1. We are also seeing this in our app.

edit: I was given a .xcframework to replace the regular .framework that was causing these 'warning errors', and the 'warning errors' went away.

Important to note, xcodebuild archive commands were failing when these 'warning errors' were present, even though Xcode.app was succeeding. Swapping over to the .xcframework (which subsequently removed the 'warning errors') allows xcodebuild's archive to succeed.

How can I do this, `swapping over the .xcframewor'?

Thank you.

@nandhavadivel
Copy link

nandhavadivel commented Sep 26, 2022

Having same issue with 3rd party library. And those are not supporting xcframework.

@davidbilly
Copy link

Facing same issue. But my swift project import with 3rd party vendor Objective-C framework.

@dawilliams-gpsw
Copy link

dawilliams-gpsw commented Sep 27, 2022

How can I do this, `swapping over the .xcframewor'?

You could use ar and/or lipo -thin to extract the library files from the .framework file and re-create it as an xcframework using xcodebuild. You may even be able to create an .xcframework from the .framework without extracting the files, if you're only supporting one architecture, although unsure if that will fix the issue.

@DanijelHuis
Copy link

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).

@ixsander
Copy link
Author

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 don't have "User Header Search Paths" set but am still getting the error. The root cause maybe different but thanks for letting us know!

@nethergrim
Copy link

error build: Dependency for P0:target-Bro-107552fdf92bce9653f083569aa48d2a9bf3e5f097b5222968822ee5f4f5794a-:Debug:SwiftDriver Compilation Bro normal x86_64 com.apple.xcode.tools.swift.compiler is not absolute (Pods/GooglePlaces/Frameworks/GooglePlaces.framework/Headers/GMSPlacePhotoMetadata.h).

@ionutivan
Copy link

Something similar appears also in my app since switching to Xcode 14.0.0:

error: Dependency for P1:target---:Development:SwiftDriver Compilation Requirements normal x86_64 com.apple.xcode.tools.swift.compiler is not absolute (Pods/Firebase/CoreOnly/Sources/Firebase.h).

error: Dependency for P1:target---:Development:SwiftDriver Compilation Requirements normal x86_64 com.apple.xcode.tools.swift.compiler is not absolute (Pods/Firebase/CoreOnly/Sources/module.modulemap).

@DreamLordOneiros
Copy link

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.

@ixsander
Copy link
Author

ixsander commented Oct 7, 2022

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

@saqib-saud
Copy link

saqib-saud commented Oct 9, 2022

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.

@TsnumiDC
Copy link

it also can solve my waring[error]
so whats the principle of the [system] ?
dose it make some other error?

@EnjoyWT
Copy link

EnjoyWT commented Nov 17, 2022

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

@jiafans
Copy link

jiafans commented Nov 24, 2022

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🥹

@AnthonyLatsis
Copy link

This seems like a swift-driver issue, if it is one to begin with. @hborla Should we transfer it?

@AndyActionItem
Copy link

I am seeing the same thing as ionutivan above.
After upgrade to Xcode 14 (14.2).
Previously command-line build was working, now this causes it to fail.
Xcode build succeeds (it shows the error info but that doesn't get in the way of it succeeding).

@hborla hborla transferred this issue from apple/swift Jan 25, 2023
@JanNilsScheele
Copy link

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

@karamqubsi
Copy link

karamqubsi commented Feb 2, 2023

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 ?

@arn8tas
Copy link

arn8tas commented Feb 28, 2023

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

@RomanticEncounter
Copy link

RomanticEncounter commented Apr 4, 2023

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

@tranquockhanh0506
Copy link

#1271 (comment)
if you already use some of firebase libraries, you can fix this issue like this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests