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-10633] SwiftPM can't find its own clang #4711

Closed
weissi opened this issue May 7, 2019 · 4 comments
Closed

[SR-10633] SwiftPM can't find its own clang #4711

weissi opened this issue May 7, 2019 · 4 comments
Labels

Comments

@weissi
Copy link
Member

weissi commented May 7, 2019

Previous ID SR-10633
Radar rdar://problem/51077480
Original Reporter @weissi
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: 8b4a3fc63dd815917cf0b5a8884152d7

Issue Description:

Here's a one-shot command to use the official ubuntu18.04 docker image, install Swift and try to compile swift-nio-ssl:

docker run -it --rm ubuntu:18.04 bash -c 'apt-get update && apt-get install -y git curl libxml2-dev && curl https://swift.org/builds/swift-5.0.1-release/ubuntu1804/swift-5.0.1-RELEASE/swift-5.0.1-RELEASE-ubuntu18.04.tar.gz | tar xz && git clone https://github.com/apple/swift-nio-ssl && cd swift-nio-ssl/ && /swift-5.0.1-RELEASE-ubuntu18.04/usr/bin/swift build'

Instead of succeeding, the build fails with

Fetching https://github.com/apple/swift-nio.git
Completed resolution in 4.08s
Cloning https://github.com/apple/swift-nio.git
Resolving https://github.com/apple/swift-nio.git at 2.0.2
error: terminated(1): which clang output:

because Swift can't its own clang that it ships. This problem can be easily resolved by doing

export PATH="$PATH:/swift-5.0.1-RELEASE-ubuntu18.04/usr/bin"

That however is bad news because that means Swift prefers the clang that is first on $PATH instead of just using its own clang. So if somebody installs clang using their system package manager, Swift will use the wrong and possibly incompatible clang, probably breaking the sanitizers and god knows what else in the process.

@weissi
Copy link
Member Author

weissi commented May 7, 2019

I'm pretty sure issue like this are related to this too.

@ankitspd
Copy link
Member

ankitspd commented May 7, 2019

SwiftPM needs to be updated to look for clang in the toolchain first.

@ankitspd
Copy link
Member

#2159

@tomerd
Copy link
Member

tomerd commented May 21, 2020

tested with 5.2.3 and seems fixed:

docker run -it --rm ubuntu:18.04 bash -c "apt-get update && apt-get install -y git curl libxml2-dev && curl https://swift.org/builds/swift-5.2.3-release/ubuntu1804/swift-5.2.3-RELEASE/swift-5.2.3-RELEASE-ubuntu18.04.tar.gz | tar xz && git clone https://github.com/apple/swift-nio-ssl && cd swift-nio-ssl/ && /swift-5.2.3-RELEASE-ubuntu18.04/usr/bin/swift build"

@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
This issue was closed.
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

3 participants