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-9024] dependency issues with SwiftPM generated Xcode projects that contain C modues #4754
Comments
@aciidb0mb3r/@neonichu this is probably related to SR-7531 but it still doesn't work... Clang modules seem to be enabled but it doesn't work:
I did try to generate the xcodeproj with
but didn't work still. |
@swift-ci create |
This will only work if the C module has an umbrella header. In your repro, rename SomePackage/Sources/CSomeModuleInSomePackage/include/c_some_module_in_some_package.h to SomePackage/Sources/CSomeModuleInSomePackage/include/CSomeModuleInSomePackage.h |
Wow, that's awesome, thank you so much! Fixed NIO in apple/swift-nio#636 . |
I am not sure if we can detect the intent with just SwiftPM. It is perfectly valid to not have an umbrella header. What kind of diagnostic do you have in mind? |
@aciidb0mb3r when would I want a C module in a SwiftPM project that doesn't have an umbrella header? And if that's what I want, why doesn't the generated Xcode project then work? |
@aciidb0mb3r When I give an umbrella header to the C library, but do NOT remove a potential modulemap for this module, the same error is still there. This makes sense when looking at the code path I guess, but can this be considered a bug? swift-package-manager/Sources/Xcodeproj/pbxproj().swift Lines 590 to 599 in 2473343
|
Attachment: Download
Additional Detail from JIRA
md5: 4a4238ddf60ba176a1f622c3560fd804
Issue Description:
description
Let's assume we have the following setup:
1. TestApp - a regular Xcode project which contains say a macOS app
2. SomePackage - a SwiftPM project which is a library TestApp wants to use
A typical way to set that up would be:
1. create a regular Xcode project "TestApp"
2. next to "TestApp", clone/create a SwiftPM project and
3. drag the
SomePackage.xcodeproj
into the TestApp xcode project so that the whole thing looks like this in XcodeThe whole thing works really well if the setup of
SomePackage
isWhich makes the dependency tree
assuming all the modules are Swift modules. However adding a C module (called
SomeModuleInSomePackage
) into SomePackage making the graphor as Package.swift
always raises the following compilation error in Xcode:
repro
1. Download the attached
repro.tar.gz
2.
tar xf repro.tar.gz
3.
cd repro/SomePackage/
4.
swift package generate-xcodeproj
5.
cd ../TestApp
6.
xed .
7. make sure the "TestApp" scheme is selected in Xcode
8. build the Xcode project (Cmd+B)
expected
builds the whole thing
actual
environment
The text was updated successfully, but these errors were encountered: