Add Quick to SPM Package.swift as a dependency and try to run tests.
Test target would compile and run.
Test target failed to compile. Got the following error:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_XCTestCase", referenced from:
_OBJC_CLASS_$__QuickSpecBase in QuickSpecBase.o
"_OBJC_METACLASS_$_XCTestCase", referenced from:
_OBJC_METACLASS_$__QuickSpecBase in QuickSpecBase.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
List the software versions you're using:
Please also mention which package manager you used and its version. Delete the
other package managers in this list:
Just ran swift package init
and added Quick as a dependency to the package and test target.
// swift-tools-version:5.2
import PackageDescription
let package = Package(
name: "DemoSPM",
products: [
.library(name: "DemoSPM", targets: ["DemoSPM"]),
],
dependencies: [
.package(url: "https://github.com/Quick/Quick", from: "3.0.0"),
],
targets: [
.target(name: "DemoSPM", dependencies: []),
.testTarget(name: "DemoSPMTests", dependencies: [
.target(name: "DemoSPM"),
.product(name: "Quick", package: "Quick"),
]),
]
)
Same on Xcode 12 Beta 5 and macOS Big Sur 11 Beta 5.
I have a script to fix that issue. If someone knows how to fix that with the help of SPM – please let me know.
swift package generate-xcodeproj && ruby fix_quick_objc_runtime.rb
https://gist.github.com/chipp/c54ca014ba681f3a2ae20d22cfd0b508
Having the same issue, thanks for the CLANG_ENABLE_MODULES
note @chipp!
And same on Xcode 11.6, by the way
Just ran
swift package init
and added Quick as a dependency to the package and test target.
I tried that using Xcode 11.7 but couldn't reproduce, swift test
ran successfully. 🤔
I tried that using Xcode 11.7 but couldn't reproduce,
swift test
ran successfully. 🤔
you need to generate Xcode project first swift package generate-xcodeproj
and then run tests in Xcode
https://github.com/Quick/Quick/issues/997#issuecomment-678449200
@chipp Hmm so are the issue you are hitting and the originally reported issue different? The original description in https://github.com/Quick/Quick/issues/997#issue-661020910 doesn't say anything about swift package generate-xcodeproj
. I'm confused 😕
Xcode 11.0 or later can directly open a Swift package (Package.swift
) so I think you normally don't need to generate an xcodeproj by swift package generate-xcodeproj
.
https://developer.apple.com/documentation/xcode-release-notes/xcode-11-release-notes
Xcode now supports creating and working with Swift packages, as well as adding, removing, and managing package dependencies. The package management support in Xcode is built on top of the open source Swift Package Manager project. (22427200)
The automatically synthesized project is usually not too useful for people who have custom build settings etc. so many people would generate the project and add it to their VCS.
There are also people who have mixed projects (SPM & other dependency managers) due to some of SPM's constraints.
ref #984
Could you try #1023?
Just tested this using
.package(name: "Quick", url: "https://github.com/Quick/Quick.git", .branch("quickobjcruntime-umbrella-header"))
I can confirm that this solves the issue.
Most helpful comment
I have a script to fix that issue. If someone knows how to fix that with the help of SPM – please let me know.
swift package generate-xcodeproj && ruby fix_quick_objc_runtime.rb
https://gist.github.com/chipp/c54ca014ba681f3a2ae20d22cfd0b508