RVM install Ruby 2.1.2: configure: error: cannot compute sizeof (long long)

RVM install Ruby 2.1.2: configure: error: cannot compute sizeof (long long)

安装 ruby 时:

rvm install 2.1.2

我遇到了这个错误。

我也尝试过从源代码构建 ruby 2.1.2 和其他版本,但是在 运行:

时我遇到了同样的错误

./configure


OSX 版本:10.14.2 (18C54)
RVM 版本:1.29.4

我升级到 OSX Mojave 后开始出现此错误。


日志:

ruby-2.1.2 - #removing src/ruby-2.1.2 - please wait
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.14/x86_64/ruby-2.1.2.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates bundle '/usr/local/etc/openssl/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/shubhams/.rvm/rubies/ruby-2.1.2, this may take a while depending on your cpu(s)...
ruby-2.1.2 - #downloading ruby-2.1.2, this may take a while depending on your connection...
ruby-2.1.2 - #extracting ruby-2.1.2 to /Users/shubhams/.rvm/src/ruby-2.1.2 - please wait
ruby-2.1.2 - #applying patch
/Users/shubhams/.rvm/patches/ruby/2.1.2/openssl3.patch - please wait ruby-2.1.2 - #configuring - please wait
Error running './configure --prefix=/Users/shubhams/.rvm/rubies/ruby-2.1.2 --with-opt-dir=/usr/local/opt/libyaml:/usr/local/opt/readline:/usr/local/opt/libksba:/usr/local/opt/openssl --disable-install-doc --enable-shared',
please read /Users/shubhams/.rvm/log/1544095614_ruby-2.1.2/configure.log
There has been an error while running configure. Halting the installation.


登录 "/Users/shubhams/.rvm/log/1544095614_ruby-2.1.2/configure.log":

....
checking for long long... yes
checking for off_t... yes
checking char bit... 8
checking size of int... 0
checking size of short... 0
checking size of long... 0
checking size of long long... configure: error: in
/Users/shubhams/.rvm/src/ruby-2.1.2': configure: error: cannot compute sizeof (long long) Seeconfig.log' for more details

谢谢。

如评论中所述,重命名 /usr/local/include 目录 确实 解决了这个特定问题。这是有效的,因为安装程序脚本无法再找到导致问题的文件,该文件以前位于以前称为 /usr/local/include 的文件夹中。

虽然这可行,但您以后可能会遇到自制公式的问题(已经通过自制软件安装在您的机器上的东西)。

解法:

虽然情况可能并非总是如此,但我只需要删除 /usr/local/include/stdint.h