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-7206] ld: symbol(s) not found for classes defined in Swift marked as @objc #49754
Comments
Comment by Ben A (JIRA) The odd thing here is that all of the symbols that can't be found do seem to show up in the appropriate |
Hm. These are classes declared with explicit |
Comment by Ben A (JIRA) That's correct! Some are |
Comment by Ben A (JIRA) Anonymized declarations from all of the Swift classes in question: // These classes are in the app, which is failing to link
@objc(PGModel1)
public class _ObjCModel1: OtherClassDeclaredInObjC
final class SomeViewController: UIViewController
@objc
final class Info: NSObject
// These classes are in a library module linked by the app
public final class PGModel2: NSObject, PGProtocol1
@objc(PGModel3)
public final class _ObjCModel3: NSObject, PGProtocol2
@objc(PGModel4)
public final class _ObjCModel4: NSObject
@objc
public final class OtherInfo: NSObject
@objc
public final class Helper After compiling these, I realized I was missing |
@swift-ci create |
FWIW, |
Comment by Ben A (JIRA) Thanks for the tip! Some of those may be there from a previous run of some version of the Xcode Swift migrator. |
Comment by Ben A (JIRA) I binary searched the last 2 weeks of snapshots, and I found that |
Comment by Ben A (JIRA) Using |
This might be a dup of SR-7221. It should be fixed in later master snapshots since @slavapestov reverted the change that caused it. Do the affected classes have Foundation value types (like URL or Data) in them? |
Comment by Ben A (JIRA) They did yes! I'm trying on the 3/26 snapshot now, and I'm hitting a compiler crash. So, not making it all the way to linking. Will try to file this one and update here once I can fully verify. |
Comment by Ben A (JIRA) Okay I was able to get passed the crasher. Still working on a small repro there. Unfortunately as of the 3/26 snapshot (org.swift.3020180326a), I'm still getting the same issue. Going to reopen |
Comment by Ben A (JIRA) Happy to try again and close, if you all think that change is coming to a snapshot after the 3/26 one? |
Comment by Ben A (JIRA) Figured out a short repro for that crasher and filed it here: SR-7282! |
Thanks! To be clear, you're saying you're still getting the "symbol not found" errors? Do you have a reproducing project for that problem as well? @slavapestov would the 3/26 snapshot have picked up the fix for SR-7221? |
Comment by Ben A (JIRA) That's correct. It's the original symbol not found errors. I have some time later in the week that I can spend trying to get a small repro for this. If that doesn't work, I'll see if I can source drop the files containing the failing files via a radar. |
Comment by Ben A (JIRA) BTW, if local engineers were willing to meet for coffee to show/review these if it came down to it, I'd be willing 🙂 |
Comment by Ben A (JIRA) I'm currently blocked from trying any master snapshots after the March 26 one due to SR-7341. I'm still working on figuring out a more useful repro to add here. Sorry for the delay! |
Comment by Ben A (JIRA) I've attached this sample project which minimally reproduces at least one of the linker failures SwiftObjCLinkerIssue.zip. I've confirmed that this is still an issue in the April 2nd master snapshot, and it's fixed if I go back to the March 8 master snapshot. There are other linker failures that all look like this (in terms of their error output), but the situations are all just a little bit different (e.g. this sample project's error involves an Obj-C category but others in the actual project don't). I'm hoping that reproducing one will be enough to point at a root cause/regression. |
Comment by Ben A (JIRA) Thanks! Will give this another go once a snapshot is available with the fix |
A snapshot with a fix is available. I cannot reproduce with the sample project anymore. |
Comment by Ben A (JIRA) Verified that this is fixed. Thanks everyone! |
Attachment: Download
Environment
macOS 10.13.3
Xcode 9.3b4 (9Q127n)
Old build system
Toolchain: org.swift.3020180314a
Debug confguration; no WMO nor new batch mode
Additional Detail from JIRA
md5: 7e969f0d54359216d33b4c3aad721898
blocks:
Issue Description:
In the recent master snapshot with toolchain id org.swift.3020180314a, we get symbol not found errors during linking due to Obj-C files not being able to find Objc-class-refs defined in Swift.
The errors all look something like this:
I ran into this trying to help test the new batch mode that was announced here, however this was not using the new batch mode.
The text was updated successfully, but these errors were encountered: