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-3129] SwiftPM Header Search Bug #5180
Comments
Comment by Jeffrey Bergier (JIRA) The compiler crash output is attached above. |
Comment by Eric Knibbe (JIRA) The issue here is that SwiftPM's pkg-config reader suggests header search paths that are already part of the compiler's default search path list, causing them to be searched in the wrong order and so exposing a compiler bug. The pkg-config tool itself avoids this by suppressing output of system search paths, and SwiftPM should be doing the same. For example, |
Comment by Gregor Milos (Grzegorz Miłoś) (JIRA) The failure also shows up when working with purely C packages. The issue isn't a compiler crash, but a compilation error due to module redefinition. Minimum example is published here: When swift build is invoked you get errors as follows[1]. IMPORTANT: the prerequisite is to have #810 merged (otherwise the zlib.pc isn't even used). [1] Cloning git@github.com:gmilos/CLibZ.git
HEAD is now at 77ed2dd Readme update.
Resolved version: 0.0.5
Compile TestZ main.c
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/module.modulemap:1:8: error: redefinition of module 'AppleTextureEncoder'
module AppleTextureEncoder [system] [extern_c] {
^
/usr/include/module.modulemap:1:8: note: previously defined here
module AppleTextureEncoder [system] [extern_c] {
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/module.modulemap:7:8: error: redefinition of module 'Compression'
module Compression [system] [extern_c] {
^
/usr/include/module.modulemap:7:8: note: previously defined here
module Compression [system] [extern_c] {
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/module.modulemap:13:8: error: redefinition of module 'Darwin'
module Darwin [system] [extern_c] {
^
/usr/include/module.modulemap:13:8: note: previously defined here
module Darwin [system] [extern_c] {
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/module.modulemap:1621:8: error: redefinition of module 'asl'
module asl [system] [extern_c] {
^
/usr/include/module.modulemap:1621:8: note: previously defined here
module asl [system] [extern_c] {
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/module.modulemap:1626:8: error: redefinition of module 'dnssd'
module dnssd [system] [extern_c] {
^
/usr/include/module.modulemap:1626:8: note: previously defined here
module dnssd [system] [extern_c] {
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/module.modulemap:1631:8: error: redefinition of module 'launch'
module launch {
^
/usr/include/module.modulemap:1631:8: note: previously defined here
module launch {
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/module.modulemap:1636:8: error: redefinition of module 'os'
module os [system] [extern_c] {
^
/usr/include/module.modulemap:1636:8: note: previously defined here
module os [system] [extern_c] {
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/module.modulemap:1657:8: error: redefinition of module 'os_object'
module os_object [system] [extern_c] {
^
/usr/include/module.modulemap:1657:8: note: previously defined here
module os_object [system] [extern_c] {
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/module.modulemap:1662:8: error: redefinition of module 'libkern'
module libkern [system] [extern_c] {
^
/usr/include/module.modulemap:1662:8: note: previously defined here
module libkern [system] [extern_c] {
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/module.modulemap:1690:8: error: redefinition of module 'ldap'
module ldap [system] [extern_c] {
^
/usr/include/module.modulemap:1690:8: note: previously defined here
module ldap [system] [extern_c] {
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/module.modulemap:1723:8: error: redefinition of module 'krb5'
module krb5 [system] [extern_c] {
^
/usr/include/module.modulemap:1723:8: note: previously defined here
module krb5 [system] [extern_c] {
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/dispatch/module.modulemap:1:8: error: redefinition of module 'Dispatch'
module Dispatch [system] [extern_c] {
^
/usr/include/dispatch/module.modulemap:1:8: note: previously defined here
module Dispatch [system] [extern_c] {
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/dispatch/module.modulemap:7:8: error: redefinition of module 'DispatchIntrospection'
module DispatchIntrospection [system] [extern_c] {
^
/usr/include/dispatch/module.modulemap:7:8: note: previously defined here
module DispatchIntrospection [system] [extern_c] {
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/mach-o/module.map:1:8: error: redefinition of module 'MachO'
module MachO [system] [extern_c] {
^
/usr/include/mach-o/module.map:1:8: note: previously defined here
module MachO [system] [extern_c] {
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/objc/module.map:1:8: error: redefinition of module 'ObjectiveC'
module ObjectiveC [system] [extern_c] {
^
/usr/include/objc/module.map:1:8: note: previously defined here
module ObjectiveC [system] [extern_c] {
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/simd/module.modulemap:1:8: error: redefinition of module 'simd'
module simd [system] {
^
/usr/include/simd/module.modulemap:1:8: note: previously defined here
module simd [system] {
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/xpc/module.modulemap:1:8: error: redefinition of module 'XPC'
module XPC [system] [extern_c] {
^
/usr/include/xpc/module.modulemap:1:8: note: previously defined here
module XPC [system] [extern_c] {
^
17 errors generated.
<unknown>:0: error: build had 1 command failures
�[31merror:�[0m exit(1): /Library/Developer/Toolchains/swift-3.0.1-RELEASE.xctoolchain/usr/bin/swift-build-tool -f /private/tmp/tmp2/TestZ/.build/debug.yaml
Program ended with exit code: 1 |
Looks like this happens only when you have CLT installed |
Comment by Partho Biswas (JIRA) I am still having this issue. I am using latest swift and Xcode version till date. How can i solve that ? |
Please file a new bug ParthoBiswas007 (JIRA User) https://github.com/apple/swift-package-manager/blob/master/Documentation/Resources.md#reporting-a-good-swiftpm-bug |
Comment by Eric Knibbe (JIRA) ParthoBiswas007 (JIRA User) You need to download and install the newest Swift 3.1 toolchain and activate it in Xcode. Note that this doesn't activate it on the command line - to do that, you need to set the TOOLCHAINS environment variable, e.g. `export TOOLCHAINS=org.swift.3120170131a`. https://github.com/apple/swift-package-manager#managing-swift-environments |
Attachment: Download
Additional Detail from JIRA
md5: 6772e3b0fef3a68f9afbc7e1333bc9f0
Issue Description:
When compiling Perfect-CURL or other lightweight wrappers around system dependencies, a compiler crash occurs when:
1) Xcode Command Line Tools installed (xcode-select --install)
2) Pkg-Config installed via home-brew
If both of those things are installed then it fails to compile. If only 1 of the 2 is installed then it works.
1) Install Sierra fresh
2) Install Xcode but do not install command line tools
3) Install HomeBrew
4) brew install pkg-config
5) git clone https://github.com/PerfectlySoft/Perfect-CURL.git
6) cd PerfectCurl, swift build
This should compile fine
7) swift build --clean=dist to clear everything
8) xcode-select --install to install CLT
9) swift build
Now the compiler will crash
10) brew uninstall pkg-config
11) swift build
Now it will compile again.
In ticket SR-1567 @aciidb0mb3r asked me to show some command output before and after CLT were installed.
Before Command Line Tools Installed
After Command Line Tools Installed
The text was updated successfully, but these errors were encountered: