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-11680] error: symbol is in generated IR file, but not in TBD file #54089

Open
egorzhdan opened this issue Oct 29, 2019 · 3 comments
Open
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@egorzhdan
Copy link
Collaborator

egorzhdan commented Oct 29, 2019

Previous ID SR-11680
Radar None
Original Reporter @egorzhdan
Type Bug

Attachment: Download

Environment

macOS 10.14.6

Xcode 11.0

swift-5.1-RELEASE

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

md5: b9f318224d89976c3449a2be2e087a8a

Issue Description:

The project has a C target and a Swift target which imports the C target.

Building with `/Library/Developer/Toolchains/swift-5.1-RELEASE.xctoolchain/usr/bin/swift build --product SwiftBugRepro` causes the error:

<unknown>:0: error: symbol 'foo' (foo) is in generated IR file, but not in TBD file
<unknown>:0: error: please file a radar or open a bug on bugs.swift.org with this code, and add -Xfrontend -validate-tbd-against-ir=none to squash the errors

{{ }}

When I build with the suggested arguments the issue disappears.

Please see the attached project.

@belkadan
Copy link
Contributor

belkadan commented Oct 30, 2019

You shouldn't have "Supports Text-Based InstallAPI" on in your project at all; it doesn't work for Swift yet. But thanks for the test case!

cc @harlanhaskins, @nkcsgexi

@harlanhaskins
Copy link
Collaborator

harlanhaskins commented Oct 30, 2019

Oh, interesting. This is a Swift package, so 'Supports Text-Based InstallAPI' is not enabled. This happens because we set `-validate-tbd-against-ir=missing` in assertions-enabled builds. Can you switch from the swift-5.1-RELEASE toolchain to using Xcode 11 proper instead? That won't have this verifier enabled.

This happens because foo() is defined in the header, and is not a `static` function, which gives it external linkage and also embeds its definition inside this module. If you put the definition of `foo` in the .c file instead, this no longer errors.

@belkadan, should we be considering functions defined in a header as part of our module? I didn't even realize we compile those.

@egorzhdan
Copy link
Collaborator Author

egorzhdan commented Oct 30, 2019

Adding static helped, thanks!

Using Xcode's toolchain resolves the issue for me as well.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
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. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

3 participants