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-14788] Linker error when code coverage is turned on for Swift Package with Objective-C code #57137

Open
sjavora opened this issue Jun 17, 2021 · 8 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@sjavora
Copy link
Contributor

sjavora commented Jun 17, 2021

Previous ID SR-14788
Radar rdar://problem/79456451
Original Reporter @sjavora
Type Bug

Attachment: Download

Environment

MacBook Pro (16-inch, 2019)

macOS 11.4 (20F71)

Xcode 12.5 (12E262)

Also tested on Xcode 13 beta (13A5154h) - same behavior

Additional Detail from JIRA
Votes 4
Component/s
Labels Bug
Assignee None
Priority Medium

md5: 8237f6f0bb4f6617b02c4b4189baff4e

Issue Description:

Setup:

  • Orbit - a package with Swift code

  • SharedUIObjC - a package with Objective-C code that depends on Orbit

Open the package file for SharedUIObjC in Xcode, build for iOS simulator.

When code coverage is turned off, build for testing works.

When it is turned on, linking fails with

Undefined symbols for architecture x86_64:
  "___llvm_profile_runtime", referenced from:
      ___llvm_profile_runtime_user in SharedUIObjC.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
@typesanitizer
Copy link

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@ThrownToys
Copy link

Well this doesn't looking promising... do most people not use coverage or is there another solution for this?

@sjavora
Copy link
Contributor Author

sjavora commented May 26, 2022

Our "solution" was to rewrite the Objective-C parts in Swift, which we were planning to do anyway. I haven't found an actual solution.

@ThrownToys
Copy link

That's disappointing. Unfortunately in my case the swift package is a 3rd party library written in objective c... I don't really want to re-write that myself 😆 Thanks for replying all the same 👍

@cookieappskr
Copy link

cookieappskr commented May 30, 2022

Hey. I'm not sure if it's the same situcation but I think It can be help for someone who are in the same situation with me.

  • Problem : Installed Firebase library with package manager -> Add 2 Test target (UI Test, Unit Test) -> Add Link Binary with libraries each test target -> Enable Code Coverage -> "Undefined symbol: ___llvm_profile_runtime" error occured
  • What I did : removed Link Binary Libraries from Unit Test Tagret (I kept the code coverage chekced on)

now My tests are running successfully.

@ThrownToys
Copy link

Strangely enough, I believe this issue has actually been fixed in the Xcode 14 beta 🤯🥳

@wolfspy
Copy link

wolfspy commented Jun 13, 2022

We confirmed with Apple there was a fix applied in Xcode 14 beta. It was mentioned you need to gather coverage for a specific target to get it to work.

@myeyesareblind
Copy link

works for iOS,
but still fails for MacCatalyst 😢 with the same error.
Here is same project with macCatalyst target added:
Archive.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Projects
None yet
Development

No branches or pull requests

6 participants