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

[SR-5697] Xcode 9 beta 5, Swift Package Manager: unexpected linker error with swift test #4965

Closed
groue opened this issue Aug 16, 2017 · 3 comments
Labels

Comments

@groue
Copy link

groue commented Aug 16, 2017

Previous ID SR-5697
Radar None
Original Reporter @groue
Type Bug
Status Resolved
Resolution Invalid
Environment

MacOS 10.12.5

Xcode 9 Beta 5 (9M202q)

$ /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift --version
Apple Swift version 4.0 (swiftlang-900.0.59 clang-900.0.34.2)
Target: x86_64-apple-macosx10.9
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug, 4.0Regression
Assignee None
Priority Medium

md5: 6c58e4d3e7d1b9972092ecc30ffc56a8

Issue Description:

Hello,

The toolchain that ships with Xcode 9 beta 5 creates an unexpected linker error with the `swift test` command. The same tests can run without any error within Xcode itself.

To reproduce:

$ git clone https://github.com/bfad/GRDB.swift.git
$ cd GRDB.swift/
$ git checkout Swift4
$ make test_SPM
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift package clean
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift build
Fetching https://github.com/groue/CSQLite.git
Cloning https://github.com/groue/CSQLite.git
Resolving https://github.com/groue/CSQLite.git at 0.2.0
Compile Swift Module 'GRDB' (83 sources)
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift build -c release
Compile Swift Module 'GRDB' (83 sources)
set -o pipefail && /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift test | xcpretty -c

⚠️ /private/tmp/GRDB.swift/Tests/GRDBTests/TableMappingTests.swift:25:41: 'primaryKeyRowComparator' is deprecated

let comparator = try Person.primaryKeyRowComparator(db)
^



⚠️ /private/tmp/GRDB.swift/Tests/GRDBTests/TableMappingTests.swift:25:41: 'primaryKeyRowComparator' is deprecated

let comparator = try Person.primaryKeyRowComparator(db)
^



⚠️ /private/tmp/GRDB.swift/Tests/GRDBTests/TableMappingTests.swift:49:41: 'primaryKeyRowComparator' is deprecated

let comparator = try Person.primaryKeyRowComparator(db)
^



⚠️ /private/tmp/GRDB.swift/Tests/GRDBTests/TableMappingTests.swift:49:41: 'primaryKeyRowComparator' is deprecated

let comparator = try Person.primaryKeyRowComparator(db)
^



❌ Undefined symbols for architecture x86_64
> Symbol: __T010Foundation3URLV4GRDB24DatabaseValueConvertibleADWP
> Referenced from: __T09GRDBTests38DatabaseValueConvertibleEncodableTestsC15testURLPropertyyyF in DatabaseValueConvertibleEncodableTests.swift.o


error: terminated(1): /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /private/tmp/GRDB.swift/.build/debug.yaml testld: symbol(s) not found for architecture x86_64


make: *** [test_SPM] Error 1
@ankitspd
Copy link
Member

You need to declare dependency from test target to the main target. This patch works:

diff --git a/Package.swift b/Package.swift
index 837163e3..af21e70d 100644
--- a/Package.swift
+++ b/Package.swift
@@ -15,6 +15,7 @@ let package = Package(
.target(name: "GRDB", path: "GRDB"),
.testTarget(
name: "GRDBTests",
+ dependencies: ["GRDB"],
path: "Tests",
exclude: [
"Carthage",

@groue
Copy link
Author

groue commented Aug 16, 2017

Thank you for your time, Ankit. - I don't know how I missed it. Phew!

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants