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-10707] Issues importing Obj-C module in Obj-C Target #4710
Comments
I'm not sure if this is a quick fix or not, but if nobody is going to look at it for a while I can take an attempt at fixing this with some guidance on where to start 🙂 |
Comment by Matt Thomas (JIRA) So, I sort of got your sample project working with the Xcode11/Swift5.1 toolchain (specifically building with Xcode11 and xcodebuild).
* xcodebuild -scheme spm-module-repro -sdk iphonesimulator13.0 -destination 'platform=iOS Simulator,name=iPhone Xs' |
Ah. It looks like we're missing `-fmodule-map-file=/private/tmp/SPM-Module-Repro/.build/x86_64-apple-macosx/debug/ObjCFoo.build/module.modulemap` argument when compiling RWBar.m. The fix would involve adding the modulemap argument when constructing plan for C targets. This is all in BuildPlan.swift if you want to take a stab at it. |
Thanks codecaffeine (JIRA User) - updated in the GitHub Repo. Thanks Ankit - I'll take a look this week and see if I can get it working, I appreciate the direction! |
Environment
Apple Swift Package Manager - Swift 5.0.0 (swiftpm-14490.62.2)
macOS Mojave 10.14.5
Xcode Version 10.2.1 (10E1001)
Additional Detail from JIRA
md5: 117d0287ac49e91ba50cd47da0c45e30
Issue Description:
(First reported on the forums)
With two C based targets where one has a dependency on the other, I would expect to be able to use `@import <ModuleNameFromTarget>;` to import the generated module in the C (Objective-C in this case) code. I'm able to successfully import modules from both targets in a Swift based target, but not in a C based target. The only way to successfully import headers from the other target is to use the header name directly as a file import.
There are two errors that occur:
Running
swift build
orswift run
will result in afatal error: module 'Foo' not found.
If you generate an Xcode project, C based modules are disabled in the generated project so it fails right away.
I created a simple repro project on GitHub to demonstrate this with annotations on the problematic lines.
The text was updated successfully, but these errors were encountered: