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-9359] SwiftPM should have better diagnostics if tests depend on executable target #4744

Closed
weissi opened this issue Nov 27, 2018 · 2 comments
Labels

Comments

@weissi
Copy link
Member

weissi commented Nov 27, 2018

Previous ID SR-9359
Radar None
Original Reporter @weissi
Type Bug
Status Resolved
Resolution Duplicate

Attachment: Download

Additional Detail from JIRA
Votes 1
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: bb75b95fd5eaaee71c7abb7965b3548b

duplicates:

  • SR-1393 [SwiftPM] Enforce Swift module import dependencies

relates to:

  • SR-5027 typo in the tests directory name leads to linker errors in SwiftPM

Issue Description:

description

SwiftPM doesn't allow tests to depend on executable targets. The error message if one does that is really bad though (linker error):

$ swift test
Compile Swift Module 'FooTests' (1 sources)
Linking ./.build/x86_64-apple-macosx/debug/TestAppPackageTests.xctest/Contents/MacOS/TestAppPackageTests
Undefined symbols for architecture x86_64:
  "_$S7TestApp2hiSSvau", referenced from:
      _globalinit_33_E4BF4F8DDFDD4AEA07DD665BB9913489_func0 in module.swift.o
ld: symbol(s) not found for architecture x86_64

<unknown>:0: error: link command failed with exit code 1 (use -v to see invocation)

repro

tar xf repro.tar.gz # attached
cd repro
swift test

expected

proper human readable error message or it works

actual

$ swift test
Compile Swift Module 'FooTests' (1 sources)
Linking ./.build/x86_64-apple-macosx/debug/TestAppPackageTests.xctest/Contents/MacOS/TestAppPackageTests
Undefined symbols for architecture x86_64:
  "_$S7TestApp2hiSSvau", referenced from:
      _globalinit_33_E4BF4F8DDFDD4AEA07DD665BB9913489_func0 in module.swift.o
ld: symbol(s) not found for architecture x86_64

<unknown>:0: error: link command failed with exit code 1 (use -v to see invocation)
@fabianfett
Copy link
Member

I just ran into this issue and there is no way a "normal" swift developer can solve this linker error by themselves (given that the developer doesn't know that tests can not depend on executables). So glad @weissi pointed me towards this. Huge +1 for this issue.

@ktoso
Copy link
Member

ktoso commented Mar 30, 2020

This ticket seems closed as duplicate, may want to comment on https://bugs.swift.org/browse/SR-1393 instead?

@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

3 participants