postmodern / ruby-install

Installs Ruby, JRuby, TruffleRuby, or mruby
MIT License
1.9k stars 252 forks source link

configure: error: cannot compute sizeof (long long) #417

Closed dhughes closed 2 years ago

dhughes commented 2 years ago

Description

I have been able to successfully use ruby-install to install Ruby 2.6.9 and Ruby 3.03. However, I am unable to use it to install Ruby 2.7.5.

When running ruby-install ruby 2.7.5 the output terminates with:

checking size of long... 0
checking size of long long... configure: error: in `/Users/doughughes/src/ruby-2.7.5':
configure: error: cannot compute sizeof (long long)
See `config.log' for more details
!!! Configuration of ruby 2.7.5 failed!

I am running ruby-install 0.8.3, which I understand to be the latest version.

Ruby 2.7.5 is a maintained version.

I am not installing on an old system. I am running on a brand new M1 Pro Mac running Monterey and the latest versions of the command line tools (upgraded today).

This does not appear to be a compilation bug, but a configuration validation bug, since it's failing in the configuration phase of the install process.

I can reproduce this problem by trying to compile Ruby manually. I realize that the issue reporting guidelines say to report this issue directly to the Ruby issue tracker. I did so.. They have asked me to report it here, so I'm doing that too.

Steps To Reproduce

Steps to reproduce the bug:

  1. Have a Mac M1 Pro running Monterey with the arm64.
  2. Run ruby-install ruby 2.7.5
  3. šŸ’„

I assume there is some dependency problem, but I am at a loss for determining what it is or how to fix it.

Expected Behavior

I would expect that the configure and build process would complete successfully, resulting in the successful installation of Ruby 2.7.5 that I can switch to with chruby.

Actual Behavior

The configuration process fails with the following messages:

checking size of long... 0
checking size of long long... configure: error: in `/Users/doughughes/src/ruby-2.7.5':
configure: error: cannot compute sizeof (long long)
See `config.log' for more details
!!! Configuration of ruby 2.7.5 failed!

Ruby 2.7.5 is not successfully built or installed for use.

The config log can be seen here.

Environment

$ ruby-install --version

ruby-install: 0.8.3

$ uname -a

Darwin dougs-mbp.lan 21.3.0 Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T6000 arm64

$ cc --version

gcc (GCC) 11.2.0

$ openssl version

OpenSSL 1.1.1l 24 Aug 2021

Note: The OpenSSL 1.1.1l is the system-provided OpenSSL. I believe ruby-install is trying to use the version from homebrew which is 1.1.1m and is not what is used when I execute openssl.

havenwood commented 2 years ago

The exit 77 suggests a possible issue with your build tools. Are you still having this issue with Ruby 2.7.6? Can you double check xcode-select --install and open XCode to confirm there aren't Command Line Tools needing an install? This does appear to be an upstream issue so I'll update the label.

eregon commented 2 years ago

Might be https://bugs.ruby-lang.org/issues/18726

havenwood commented 2 years ago

If so, this can be closed by ruby/ruby#5799.

eregon commented 2 years ago

On that redmine issue, it seems a mix of extremely new not-even-released clang + old autoconf. So updating your autoconf to 2.70+ should help if it's the same issue.

XrXr commented 2 years ago

Looking at the logs the error comes from failing to find libobjc:

ld: library not found for -lobjc
collect2: error: ld returned 1 exit status
configure:13404: $? = 1

Looks like autoconf is picking up a GCC that comes from Nix on your macOS system which could be why it can't find libobjc. Nix generally likes to isolate its closure from system libraries.

I would make sure which clang points to Apple's Clang, and run ruby-install like:

$ CC=clang ruby-install ...

That should let it find the right libraries.

dhughes commented 2 years ago

I'm quite late getting back to this, but I wanted to say that @XrXr's suggestion worked like a charm! I was able to get Ruby 2.7.5 installed successfully.