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

SPM build fails with undefined symbol "___llvm_profile_runtime" #906

Closed
TizianoCoroneo opened this issue Jun 19, 2020 · 10 comments
Closed

Comments

@TizianoCoroneo
Copy link

iOS Builds using the 4.0.1 prerelease fail with the following error:

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

This SO question seems relevant: looks like if you have code coverage enabled in your project SPM will inject this flag. I'm not sure if it is something that we could report to Apple, could you give a look?
https://stackoverflow.com/questions/58127940/undefined-symbols-llvm-profile-runtime

@bsneed
Copy link
Contributor

bsneed commented Jun 20, 2020

cc @migs647

@migs647
Copy link
Contributor

migs647 commented Jun 23, 2020

@TizianoCoroneo I may need some more information on your build configuration.

  1. How are you adding the Segment Swift Package?
  2. Which version of the iOS SDK are you targeting?

If you could put together a demo project that I could use to replicate that would be helpful. I think I'm going down a happy path and not seeing this.

@TizianoCoroneo
Copy link
Author

segment-spm-bug.zip

Small project that reproduces the issue. I just turned on Gather code coverage in the scheme settings.

@migs647
Copy link
Contributor

migs647 commented Jun 23, 2020

@TizianoCoroneo Thanks so much, diving into it.

@migs647
Copy link
Contributor

migs647 commented Jun 24, 2020

@TizianoCoroneo We have come to the same conclusion this is a bug with Apple. We suggest disabling the code coverage for now unless you can get the -fprofile-instr-generate trick to work (we couldn't). We will keep looking into this including with the new Xcode in hopes this gets resolved by Apple.

@migs647 migs647 mentioned this issue Jun 25, 2020
@migs647
Copy link
Contributor

migs647 commented Jun 25, 2020

@TizianoCoroneo Is it possible you can try our current master branch? We changed up our Package.swift to allow swift package to determine to build as dynamic or static. We will put out 4.0.2 soon, but in the mean time you can try that.

@TizianoCoroneo
Copy link
Author

It works now, thank you!

@txm5586
Copy link

txm5586 commented Nov 19, 2021

I recently stumbled with this issue using SPM, 4.1.6 version of Segment. I've try stuff like adding the -fprofile-instr-generate flag, but nothing works.
I have my main App Target, and a test target "All Tests" that contains all test targets with coverage enabled for my main target. Just saying this in case it's relevant.

  "___llvm_profile_runtime", referenced from:
      ___llvm_profile_runtime_user in Segment.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@migs647 Was 4.0.2 supposed to solve this issue? Not sure what to do. I don't really want to disable coverage.

@txm5586
Copy link

txm5586 commented Nov 19, 2021

@TizianoCoroneo do you remember doing anything on your side to make this work?

@TizianoCoroneo
Copy link
Author

No, updating the package was enough. Code coverage works correctly for me now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants