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-11757] SwiftPM fails to build (bootstrap) if CC is set and isn't an absolute, real path #4653

Open
swift-ci opened this issue Nov 10, 2019 · 1 comment
Labels

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-11757
Radar None
Original Reporter Bo98 (JIRA User)
Type Bug
Environment

macOS 10.14.6 (18G1012)

Xcode 11.1

swift-5.1.2-RELEASE (source build)

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

md5: 5e2cf6afa79e6152ee20a28a0df6da8b

Issue Description:

When attempting to build SwiftPM (swift-5.1.2-RELEASE) and the CC environment variable is set to an non-absolute path (e.g. CC=clang), SwiftPM fails to build:

/private/tmp/swift-20191110-3051-1whhk6y/build/clang [...options snipped for brevity]
unable to spawn process (No such file or directory)

Such build environment broke after the fix to SR-10633 (#2159) due to the use of os.path.realpath (https://github.com/apple/swift-package-manager/blob/swift-5.1.2-RELEASE/Utilities/bootstrap#L740), which fails to take $PATH into account. In the example above, the bootstrap script is taking clang to be relative to the working directory, which is not correct.

Additionally, the resolving of symlinks (which os.path.realpath does) is also problematic. In some cases where shims are used (e.g. Homebrew), even passing in an absolute path will fail (e.g. CC=/usr/local/Homebrew/Library/Homebrew/shims/mac/super/cc). This particular example would be resolved by the bootstrap script to /usr/local/Homebrew/Library/Homebrew/shims/super/cc which breaks relative lookups in /usr/local/Homebrew/Library/Homebrew/shims/mac/super:

$ /usr/local/Homebrew/Library/Homebrew/shims/super/cc
Traceback (most recent call last):
    1: from /usr/local/Homebrew/Library/Homebrew/shims/super/cc:443:in `<main>'
/usr/local/Homebrew/Library/Homebrew/shims/super/cc:443:in `exec': No such file or directory - /usr/local/Homebrew/Library/Homebrew/shims/super/xcrun (Errno::ENOENT)
@beccadax
Copy link
Contributor

@aciidb0mb3r

@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

3 participants