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-12197] [Regression] Packages with C target headers don't behave the same with 5.2 #4595

Open
bscothern opened this issue Feb 12, 2020 · 6 comments
Assignees
Labels

Comments

@bscothern
Copy link
Contributor

Previous ID SR-12197
Radar rdar://problem/59411582
Original Reporter @bscothern
Type Bug
Status In Progress
Resolution

Attachment: Download

Environment

OS

macOS 10.15.3

Broken Toolchains:

5.2-DEVELOPMENT-SNAPSHOT-2020-02-09-a

5.2 with Xcode 11.4 beta 1 (11N111s)

Old Working Toolchain:

This builds with Swift 5.1.3 that is included with Xcode 11.3 (11C29)

Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee @abertelrud
Priority Medium

md5: 8f25a183bf0e6896dceb3d2d4aa85c27

Issue Description:

Header includes no longer behave as expected when working with C family targets.

The attached package builds a version of google's protobuf library and protoc.

The library can build just fine but when another target or product depends on the protobuf library doesn't build with the 5.2 tool chain but does with the 5.1 toolchain.

@ankitspd
Copy link
Member

@swift-ci create

@ankitspd
Copy link
Member

I am getting this error with both 5.1.3 and ToT swift-5.2-branch:

<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Users/ankit/tmp/SwiftPMProtobuf/Protobuf/source/src/google/protobuf/source_context.pb.h"
        ^
/Users/ankit/tmp/SwiftPMProtobuf/Protobuf/source/src/google/protobuf/source_context.pb.h:7:10: error: 'limits' file not found
#include <limits>
         ^
/Users/ankit/tmp/foo/Sources/foo/main.swift:1:8: error: could not build Objective-C module 'Protobuf'
import Protobuf
       ^

@bscothern
Copy link
Contributor Author

Hmmm. limits.h is a standard C++ header that I am finding in my different runtime /usr/include directories. Maybe it is being found through stuff I have installed via brew.

@bscothern
Copy link
Contributor Author

I will find a clean machine to get it building on with 5.1.3 and figure out what the dependency is to be able to build it.

@abertelrud
Copy link
Contributor

I've looked into this some more, and this definitely seems to be a consequence of the fix for SR-10707. SwiftPM expects that the headers are arranged as documented at Creating C Language Targets. But until the fix for SR-10707, SwiftPM didn't actually generate a modulemap according to the rules described in that documentation, so in practice, C modules that didn't have an umbrella header layout did not cause problems.

One way to address this is to create a `module.modulemap` file in the target — presence of a custom modulemap will prevent one from being automatically generated, and allows the package owner to customize how they want the headers in the target vended to clients.

In this case, it isn't clear to me what the vended headers should look like in order for Swift code to be able to see them. Which of the headers in the Protobuf target should be included in the module that's created for the target?

@abertelrud
Copy link
Contributor

This should be addressed by #2813

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants