Closed toadzky closed 3 years ago
@toadzky What version of CBORCoding
are you using? I know that I've had similar issues in the past but these should have been resolved.
I just did a quick smoke test building a macOS app from the command line (after adding this lib as a Swift Package using Xcode's GUI) and don't see any issues. If using the latest version doesn't resolve your issue (or if you already are using the latest) are there any specific flags that you're passing to xcodebuild
?
i was using 1.2.0. i switched it to master and it didn't help. i've also tried adding a direct dependency on half and that didn't work either. it almost seems like it's not building the dependencies in the right order. here's the output:
$ xcodebuild -verbose
Resolve Package Graph
Resolved source packages:
Half: git@github.com:SomeRandomiOSDev/Half @ master
CBORCoding: git@github.com:SomeRandomiOSDev/CBORCoding @ master
swift-log: git@github.com:apple/swift-log @ 1.2.0
CleanroomLogger: git@github.com:emaloney/CleanroomLogger.git @ master
note: Using new build system
note: Planning build
note: Constructing build description
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler (in target 'CBORCoding' from project 'CBORCoding')
cd /Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -incremental -module-name CBORCoding -O -whole-module-optimization -enforce-exclusivity=checked @/Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/build/CBORCoding.build/Release/CBORCoding.build/Objects-normal/x86_64/CBORCoding.o.SwiftFileList -DSWIFT_PACKAGE -DXcode -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -target x86_64-apple-macos10.10 -g -Xfrontend -serialize-debugging-options -swift-version 5 -I /Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/build/Release -F /Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/build/Release -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -c -num-threads 8 -output-file-map /Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/build/CBORCoding.build/Release/CBORCoding.build/Objects-normal/x86_64/CBORCoding-OutputFileMap.json -parseable-output -serialize-diagnostics -emit-dependencies -emit-module -emit-module-path /Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/build/CBORCoding.build/Release/CBORCoding.build/Objects-normal/x86_64/CBORCoding.swiftmodule -Xcc -I/Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/Half/Sources/CHalf/include -Xcc -I/Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/build/Release/include -Xcc -I/Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/build/CBORCoding.build/Release/CBORCoding.build/DerivedSources-normal/x86_64 -Xcc -I/Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/build/CBORCoding.build/Release/CBORCoding.build/DerivedSources/x86_64 -Xcc -I/Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/build/CBORCoding.build/Release/CBORCoding.build/DerivedSources -Xcc -DSWIFT_PACKAGE -working-directory /Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding
CompileSwift normal x86_64 (in target 'CBORCoding' from project 'CBORCoding')
cd /Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/Sources/CBORCoding/CBOR+Codable.swift /Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/Sources/CBORCoding/CBOR+Equatable.swift /Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/Sources/CBORCoding/CBOR.swift /Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/Sources/CBORCoding/CBORDecoder.swift /Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/Sources/CBORCoding/CBOREncoder.swift /Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/Sources/CBORCoding/CBORParser.swift /Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/Sources/CBORCoding/Containers.swift -supplementary-output-file-map /var/folders/dc/pmsq9v796hzdjyj07cgn0fhw0000gn/T/supplementaryOutputs-c28d53 -target x86_64-apple-macos10.10 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -I /Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/build/Release -F /Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/build/Release -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -g -swift-version 5 -enforce-exclusivity=checked -O -D SWIFT_PACKAGE -D Xcode -serialize-debugging-options -Xcc -working-directory -Xcc /Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding -Xcc -I/Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/Half/Sources/CHalf/include -Xcc -I/Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/build/Release/include -Xcc -I/Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/build/CBORCoding.build/Release/CBORCoding.build/DerivedSources-normal/x86_64 -Xcc -I/Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/build/CBORCoding.build/Release/CBORCoding.build/DerivedSources/x86_64 -Xcc -I/Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/build/CBORCoding.build/Release/CBORCoding.build/DerivedSources -Xcc -DSWIFT_PACKAGE -module-name CBORCoding -num-threads 8 -o /Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/build/CBORCoding.build/Release/CBORCoding.build/Objects-normal/x86_64/CBOR+Codable.o -o /Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/build/CBORCoding.build/Release/CBORCoding.build/Objects-normal/x86_64/CBOR+Equatable.o -o /Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/build/CBORCoding.build/Release/CBORCoding.build/Objects-normal/x86_64/CBOR.o -o /Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/build/CBORCoding.build/Release/CBORCoding.build/Objects-normal/x86_64/CBORDecoder.o -o /Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/build/CBORCoding.build/Release/CBORCoding.build/Objects-normal/x86_64/CBOREncoder.o -o /Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/build/CBORCoding.build/Release/CBORCoding.build/Objects-normal/x86_64/CBORParser.o -o /Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/build/CBORCoding.build/Release/CBORCoding.build/Objects-normal/x86_64/Containers.o
/Users/toadzky/Library/Developer/Xcode/DerivedData/File_Buddy_11-avyycioolgtstddodlblxuzxcrtc/SourcePackages/checkouts/CBORCoding/Sources/CBORCoding/CBORDecoder.swift:10:8: error: no such module 'Half'
import Half
^
** BUILD FAILED **
The following build commands failed:
CompileSwift normal x86_64
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(2 failures)
i was able to build a release in xcode by just using the Archive
command and it seems to work fine. it's just an issue with the command line xcodebuild
tool
unfortunately, xcode wouldn't embed the swift framework into the app, so i had to switch back to carthage and it won't build at all now.
@toadzky I've been able to repro this issue and am at a loss as to the cause of it except that there appears to be an issue with the dependency build order when building through xcodebuild
. As a temporary workaround, I was able to get this working by reverting back to version 1.0.5 (exact). This is the version prior to adding the Half
dependency so unless you have a specific need for encoding Half
values this should suit your needs.
In the mean time, I've opened an issue with Apple about this: FB7622012. Hopefully they'll be able to address the issue in a future release of Xcode.
Thanks, I shouldn't need half so I'll give 1.0.5 a try
xcodebuild
is still erroring with error: missing required module 'CHalf'
using 1.0.5. i can't find any reference to Half anywhere in the project, including in xcode's files so i have no idea why it's still trying to import it.
@toadzky There's a chance that some of the old references are still lingering around after downgrading versions. Try removing the following and trying again:
<project_dir>/build
<project_dir>/<project_name>.xcodeproj/project.xcworkspace/xcshareddata/swiftpm
~/Library/Developer/Xcode/DerivedData
I whipped up a brand new Xcode project and added 1.0.5 as a dependency. Building this though Xcode and through xcodebuild works on my machine. I've seen similar issues to this while modifying Swift Package dependencies and doing the above steps normally resolves the issue.
finally got it working. apparently there is some kind of issue with xcode copying the files correctly when based on scheme names. i wasn't explicitly specifying a scheme name to the xcodebuild
command so it couldn't find things 🤦♂ giving it a scheme explicitly makes it build. unfortunately, it doesn't seem to include the necessary binaries in the built app so it fails to run.
i switched back to carthage and pinned to version 1.0.5 and it's building and running.
@toadzky It happens to the best of us. I'll leave this open until I get something back from Apple regarding the bug that I opened about this issue.
Also, after reading this I did a quick smoke test and I found that 1.2.0 builds and runs on my machine after adding the -scheme
flag. CBORCoding
and Half
are built by SwiftPM as static libraries and were linked into my application. Perhaps you could use 1.2.0 via Swift Packages in your application while using the -scheme
flag for the build.
I'm not completely sure this is something that is the fault of this repo, but my app builds fine in Xcode itself, but my release script that automates several steps uses the
xcodebuild
command line and it fails with the following:I added it to my xcode project using xcode's gui for adding swift packages.