Open bscothern opened 4 years ago
@swift-ci create
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
^
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.
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.
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?
This should be addressed by https://github.com/apple/swift-package-manager/pull/2813.
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: 8f25a183bf0e6896dceb3d2d4aa85c27Issue 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.