Repository navigation
Suggest resetting the developer directory when a macOS build fails - #2648
Open
StevenLi-phoenix wants to merge 1 commit into
Open
StevenLi-phoenix wants to merge 1 commit into
StevenLi-phoenix wants to merge 1 commit into
Conversation
Some Ruby builds fail with compiler or linker errors when a non-default Xcode is the active developer directory, and they succeed again after `sudo xcode-select --reset`. When a build fails on macOS and `xcode-select -p` reports something other than the Command Line Tools or /Applications/Xcode.app, print the selected directory and how to restore the default. If DEVELOPER_DIR is set, suggest unsetting it instead, since `xcode-select --reset` has no effect while it is set. Fixes rbenv#2287
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Created by Claude Opus-5-5: the code, tests and this description were written entirely by Claude Opus-5-5.
Fixes #2287
Problem
On macOS, a Ruby build can fail with unclear compiler or linker errors when a non-default Xcode is the active developer directory, for example
/Applications/Xcode-15.0.1.app/Contents/Developeror/Applications/Xcode 16.app/.... Reported symptoms includeffi.hwarnings followed bymake: *** [build-ext] Error 2, andUndefined symbols ... "_coroutine_transfer". The same build succeeds aftersudo xcode-select --reset(or after selecting the Command Line Tools). Nothing in theBUILD FAILEDreport points to this, so affected users have to find the fix on their own. This also came up in discussion #2305.Change
As suggested in #2287 (comment),
build_failednow checksxcode-select -pon macOS. If the active developer directory is neither/Library/Developer/CommandLineToolsnor/Applications/Xcode.app/Contents/Developer, the report names the selected directory and shows how to restore the default. Those are the standard locations thatxcode-select --resetfalls back to.Output from a failing build with
xcode-select -pstubbed to print a non-default Xcode (temporary paths shortened):DEVELOPER_DIRoverrides the system-wide selection, soxcode-select --resetdoes nothing while it is set. In that case the hint suggestsunset DEVELOPER_DIRinstead.Nothing changes on other platforms, or on macOS when the default developer directory is active or
xcode-select -pfails or prints nothing.Testing
Three new tests in
test/build.batsstubunameas Darwin, stubxcode-select -p, and makemakefail. They cover a non-default Xcode, a setDEVELOPER_DIR, and the two default locations, where no hint is printed. All three fail onmasterand pass with this change.script/testpasses on macOS with bats-core v1.10.0, with and withoutDEVELOPER_DIRexported. I haven't run the suite on Linux, but the new tests rely only on stubs.