Building requires Xcode Command Line Tools to be selected
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Domain
- build-system, cli, operating-systems
Research direction
Start by reproducing the ruby-build 3.2.2 command with Xcode.app and with /Library/Developer/CommandLineTools selected, then compare the attached failing and successful logs. Trace the ruby-build build invocation and determine what causes the Xcode-selected build to fail; done means Ruby builds successfully in both developer-directory configurations.
Written by the indexing model from the issue text.
Description
Ever since updating to macOS Sonoma, I've been unable to build Ruby using ruby-build as normal. After much troubleshooting, I determined that I needed to explicitly select the Xcode Command Line Tools as the active developer directory prior to running the command, it doesn't seem to work if a copy of Xcode is selected.
(I also have to explicitly point to the homebrew-installed version of openssl, but I believe this is likely a separate issue.)
Here are some various permutations I've tested with the same or similar results:
- macOS: versions 14.0 and 14.1
- Xcode.app: versions 14.3.1, 15.0, and 15.0.1
- ruby-build: versions 20230919, 20231012, 20231014, 20231025 (every version since macOS Sonoma's release on September 26)
Steps to reproduce the behavior
- Select a version of Xcode as the active developer directory using
xcode-selectsudo xcode-select -s /Applications/Xcode-15.0.1.app/Contents/Developer/ - Attempt to install Ruby as normal
RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@3)" ruby-build 3.2.2 ~/local/ruby-3.2.2 - Note the build failed (see logs below for more details)
- Now select the Xcode Command Line Tools as the active developer directory
sudo xcode-select -s /Library/Developer/CommandLineTools - Attempt to install Ruby once again using the same command as in step #2.
- Note the build succeeds (see logs below for more details)
Expected vs. actual behavior
- Expected: I am able to successfully install Ruby on my computer running macOS Sonoma, regardless of if Xcode or the Xcode Command Line Tools are selected as the active developer directory.
- Actual: I am unable to successfully install Ruby on my computer running macOS Sonoma if a copy of Xcode.app is selected as the active developer directory. I must explicitly select the Xcode Command Line Tools as the active developer directory in order to successfully install Ruby.
Logs
I got an error when I tried to include the verbose logs pasted here into this Issue, so I'll attach them here as txt files instead:
- Failing build, with Xcode.app set as the active developer directory: ruby-build-log-xcode-app.txt
- Successful build, with Xcode Command Line Tools set as the active developer directory: ruby-build-log-xcode-command-line-tools.txt
Failing Build
These are the logs from a failing build, after selecting /Applications/Xcode-15.0.1.app/Contents/Developer/ as the active developer directory:
❯ RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@3)" ruby-build 3.2.2 ~/local/ruby-3.2.2
To follow progress, use 'tail -f /var/folders/vk/39v82gb50yjbxxj_j5gtzkknf8d7d0/T/ruby-build.20231027132223.49795.log' or pass --verbose
Downloading ruby-3.2.2.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.2.tar.gz
Installing ruby-3.2.2...
ruby-build: using readline from homebrew
ruby-build: using libyaml from homebrew
ruby-build: using gmp from homebrew
BUILD FAILED (macOS 14.1 using ruby-build 20231025)
Inspect or clean up the working tree at /var/folders/vk/39v82gb50yjbxxj_j5gtzkknf8d7d0/T/ruby-build.20231027132223.49795.6lJmlP
Results logged to /var/folders/vk/39v82gb50yjbxxj_j5gtzkknf8d7d0/T/ruby-build.20231027132223.49795.log
Last 10 log lines:
In file included from ./fiddle.h:46:
/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/ffi/ffi.h:483:5: warning: 'FFI_GO_CLOSURES' is not defined, evaluates to 0 [-Wundef]
#if FFI_GO_CLOSURES
^
ld: warning: ignoring duplicate libraries: '-lruby.3.2'
installing default fiddle libraries
1 warning generated.
linking shared-object fiddle.bundle
ld: warning: ignoring duplicate libraries: '-lffi', '-lruby.3.2'
make: *** [build-ext] Error 2
Successful Build
These are the logs from a successful build, after selecting /Library/Developer/CommandLineTools as the active developer directory:
❯ RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@3)" ruby-build 3.2.2 ~/local/ruby-3.2.2
To follow progress, use 'tail -f /var/folders/vk/39v82gb50yjbxxj_j5gtzkknf8d7d0/T/ruby-build.20231027131830.14178.log' or pass --verbose
Downloading ruby-3.2.2.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.2.tar.gz
Installing ruby-3.2.2...
ruby-build: using readline from homebrew
ruby-build: using libyaml from homebrew
ruby-build: using gmp from homebrew
Installed ruby-3.2.2 to /Users/ihalvorson/local/ruby-3.2.2
- Dominant language
- Shell
- Stars
- 4k
- Forks
- 807
- Avg merge
- 14h 22m
- Merged PRs (30d)
- 4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rbenv/ruby-build
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
rbenv/ruby-build#2644 ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 30/100
rbenv/ruby-build#2515 · 2 comments ·
All issues in rbenv/ruby-build
Similar issues
-
Update Vish to 1.1.5 Openpackage-update
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
oSoWoSo/vOid_Community_repOsitory#144 · 1 comment ·
-
help wanted new command
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
tldr-pages/tldr#24151 ·
-
PacReq: Rune IDE Openpackage request
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
pacstall/pacstall-programs#9402 ·
-
[BUG] ci: the first prefetch-images.sh call runs before shard.txt exists, so it is always a no-op Openbug github-actions
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
update-request
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
msys2/MINGW-packages#31768 ·