在OSX Catalina中使用rbenv安装ruby-2.4.0时,构建失败(使用ruby-build 20191124的OS X 10.15.1)(10.15.1) [英] BUILD FAILED (OS X 10.15.1 using ruby-build 20191124) when installing ruby-2.4.0 with rbenv in OSX catalina(10.15.1)
问题描述
我在在线论坛上尝试了很多东西.但是从来没有奏效.安装了Xcode以查看它是否有效.但事实并非如此.
I tried a lot of things from online forums. But never worked. Installed Xcode to see if it works. But it doesn't.
首先,在安装OpenSSL时C可执行文件存在问题.但是后来,我从
At first, there was an issue with the C executables at the time of the OpenSSL installation. But later, I found from here, the error occurred because of Anaconda installation. So I uninstalled anaconda and tried to install again.
但是现在它引发了另一个错误.
But now it is throwing a different error.
➜〜rbenv install 2.4.0正在下载openssl-1.1.0j.tar.gz ... -> https://dqw8nmjcqpjn4edcc4b3c4e4b3c4e4ad3c6e4a3d3d1e7d7a4e7d3a3e7d7a7e7d7a4e7d7a3e76d3a7e6e7a3e76d3a7e3d7a4e3d7a1e6e6e6e7b3e6e7b7e7b6e6b7e6b7e6b7e7b6e6b7e7b6e7b8b6b8b6b8b6b0b人职位 正在安装openssl-1.1.0j ...已将openssl-1.1.0j安装到 /Users/akashpinnaka/.rbenv/versions/2.4.0
➜ ~ rbenv install 2.4.0 Downloading openssl-1.1.0j.tar.gz... -> https://dqw8nmjcqpjn7.cloudfront.net/31bec6c203ce1a8e93d5994f4ed304c63ccf07676118b6634edded12ad1b3246 Installing openssl-1.1.0j... Installed openssl-1.1.0j to /Users/akashpinnaka/.rbenv/versions/2.4.0
正在下载ruby-2.4.0.tar.bz2 ... -> https://cache.ruby- lang.org/pub/ruby/2.4/ruby-2.4.0.tar.bz2 安装ruby-2.4.0 ... ruby-build:使用自制软件中的readline
Downloading ruby-2.4.0.tar.bz2... -> https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.0.tar.bz2 Installing ruby-2.4.0... ruby-build: using readline from homebrew
构建失败(使用ruby-build 20191124的OS X 10.15.1)
BUILD FAILED (OS X 10.15.1 using ruby-build 20191124)
在以下位置检查或清理工作树 /var/folders/xs/gy8wglwj22g9lbhqfv9mwp7m0000gn/T/ruby-build.20191205014031.81437.0Fmlfl 结果记录到 /var/folders/xs/gy8wglwj22g9lbhqfv9mwp7m0000gn/T/ruby-build.20191205014031.81437.log
Inspect or clean up the working tree at /var/folders/xs/gy8wglwj22g9lbhqfv9mwp7m0000gn/T/ruby-build.20191205014031.81437.0Fmlfl Results logged to /var/folders/xs/gy8wglwj22g9lbhqfv9mwp7m0000gn/T/ruby-build.20191205014031.81437.log
最近10条日志行:num2int.c:64:5:注意:匹配此'(' sprintf(buf,%" PRI_LL_PREFIX"u",NUM2ULL(num)); ^/usr/local/include/secure/_stdio.h:47:27:注意:从宏'sprintf' builtin ___ sprintf_chk(str,0,__darwin_obsz(str), __VA_ARGS ) ^产生190个警告和2个错误. make [2]: * [num2int.o]错误1 make
Last 10 log lines: num2int.c:64:5: note: to match this '(' sprintf(buf, "%"PRI_LL_PREFIX"u", NUM2ULL(num)); ^ /usr/local/include/secure/_stdio.h:47:27: note: expanded from macro 'sprintf' builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS) ^ 190 warnings and 2 errors generated. make[2]: * [num2int.o] Error 1 make1: * [ext/-test-/num2int/all] Error 2 make: *** [build-ext] Error 2
有人以前遇到过这个问题吗?任何帮助将不胜感激.
Did anyone face this problem before? Any help would be greatly appreciated.
更新
在日志文件中添加最后几行.它们大多数看起来像是C lang中的错误
Adding the last few lines in the logfile. Most of them look like errors in C lang
/usr/local/include/stdlib.h:354:36: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
strtouq(const char *__str, char **__endptr, int __base);
^
/usr/local/include/stdlib.h:354:36: note: insert '_Nullable' if the pointer may be null
strtouq(const char *__str, char **__endptr, int __base);
^
_Nullable
/usr/local/include/stdlib.h:354:36: note: insert '_Nonnull' if the pointer should never be null
strtouq(const char *__str, char **__endptr, int __base);
^
_Nonnull
/usr/local/include/stdlib.h:356:13: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
extern char *suboptarg; /* getsubopt(3) external variable */
^
/usr/local/include/stdlib.h:356:13: note: insert '_Nullable' if the pointer may be null
extern char *suboptarg; /* getsubopt(3) external variable */
^
_Nullable
/usr/local/include/stdlib.h:356:13: note: insert '_Nonnull' if the pointer should never be null
extern char *suboptarg; /* getsubopt(3) external variable */
^
_Nonnull
num2int.c:56:21: error: expected ')'
sprintf(buf, "%"PRI_LL_PREFIX"d", NUM2LL(num));
^
num2int.c:56:5: note: to match this '('
sprintf(buf, "%"PRI_LL_PREFIX"d", NUM2LL(num));
^
/usr/local/include/secure/_stdio.h:47:27: note: expanded from macro 'sprintf'
__builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
^
num2int.c:64:21: error: expected ')'
sprintf(buf, "%"PRI_LL_PREFIX"u", NUM2ULL(num));
^
num2int.c:64:5: note: to match this '('
sprintf(buf, "%"PRI_LL_PREFIX"u", NUM2ULL(num));
^
/usr/local/include/secure/_stdio.h:47:27: note: expanded from macro 'sprintf'
__builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
^
190 warnings and 2 errors generated.
make[2]: *** [num2int.o] Error 1
make[1]: *** [ext/-test-/num2int/all] Error 2
make: *** [build-ext] Error 2
这是详细错误的记录箱: https://pastebin.com/wzLGzvC5
Here is the pate bin for the detailed errors: https://pastebin.com/wzLGzvC5
$叮当声
$ which clang
/usr/bin/clang
$ brew ls
$ brew ls
adns gnutls libksba openssl ruby
autoconf icu4c libtasn1 openssl@1.1 ruby-build
automake libassuan libtool p11-kit sqlite
awk libevent libunistring pinentry unbound
coreutils libffi libusb pkg-config zlib
gettext libgcrypt libyaml postgresql
gmp libgpg-error nettle rbenv
gnupg libidn2 npth readline
$酿造医生
$ brew doctor
Your system is ready to brew.
删除brew doctor
几行来自
$ ls -la/usr/local/include
$ ls -la /usr/local/include
total 0
drwxrwxr-x 270 akashpinnaka admin 8640 Dec 24 11:30 .
drwxr-xr-x 18 root wheel 576 Dec 5 11:15 ..
-rw-r--r-- 1 akashpinnaka admin 0 Dec 5 10:11 .keepme
lrwxr-xr-x 1 root admin 85 Dec 5 11:21 AppleTextureEncoder.h -> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/AppleTextureEncoder.h
lrwxr-xr-x 1 root admin 78 Dec 5 11:21 AssertMacros.h -> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/AssertMacros.h
lrwxr-xr-x 1 root admin 78 Dec 5 11:21 Availability.h -> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/Availability.h
lrwxr-xr-x 1 root admin 86 Dec 5 11:21 AvailabilityInternal.h -> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/AvailabilityInternal.h
lrwxr-xr-x 1 root admin 84 Dec 5 11:21 AvailabilityMacros.h -> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/AvailabilityMacros.h
lrwxr-xr-x 1 root admin 86 Dec 5 11:21 AvailabilityVersions.h -> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/AvailabilityVersions.h
推荐答案
首先,将日志修剪到重要部分:
First, let trim your log to the significant part:
num2int.c:56:21: error: expected ')'
sprintf(buf, "%"PRI_LL_PREFIX"d", NUM2LL(num));
^
num2int.c:56:5: note: to match this '('
sprintf(buf, "%"PRI_LL_PREFIX"d", NUM2LL(num));
^
/usr/local/include/secure/_stdio.h:47:27: note: expanded from macro 'sprintf'
__builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
基本上,这表示将宏扩展到文件num2int.c
中的某些行时出错.那么,该宏从何而来?日志显示该宏已在文件/usr/local/include/secure/_stdio.h
中定义.
Basically, this says that there was an error while expanding a macro to some line in file num2int.c
. So, where is does that macro come from? The log says that the macro was defined in file /usr/local/include/secure/_stdio.h
.
此文件对应于本地安装的程序包,很可能是通过brew
添加的(它也可能已经由某些安装了程序包安装程序的应用程序安装了,但是可能性较小).我尚未找到该文件所属的软件包(在我的计算机上没有该文件,并且在Google上没有找到对该文件的任何引用),但是_stdio.h
文件相当异常,因此我相信它可能与到brew
的私人GCC.但是,ruby-build
(尽管通过rb-env install
执行)更喜欢使用XCode的clang
编译器,该编译器可能不支持brew
的GCC支持的某些语法扩展.
This file correspond to a locally installed package, most probably added through brew
(it could also have been installed by some application installed with a package installer, but this appears less probable). I have not found yet to which package that file belongs (don't have it on my computer and havn't found any reference to it on Google), but _stdio.h
files are rather exceptionnal, so I believe that it might be related to brew
's private GCC. Yet, ruby-build
(when executed though rb-env install
) prefer to use XCode's clang
compiler, which might not support some syntax extension supported by brew
's GCC.
简而言之,您最终会在Apple的clang
中加载某些使用某些语法的本地包含文件,该文件与该编译器不兼容.
In short, you end up loading in Apple's clang
some local include file that use some syntax thaat is not compatible with that compiler.
现在该怎么办?
您必须确定/usr/local/include/secure/
目录是否真正有用.也许,这与您不再使用的程序有关……我无法确切告诉您该怎么做,但是这里有一些想法:
You must determine if the /usr/local/include/secure/
directory is actually useful. Maybe, this is related to a program that you no longer use… I can't tell you exactly what to do about this, but here are some ideas:
-
检查
secure
或secure/_stdio.h
是符号链接(即:ls -l /usr/local/include/secure/
).如果它们已由brew
安装,则它们应指向../Cellar/<package-name>
下的某个位置.如果有,也许您可以考虑卸载该软件包…
Check if either
secure
orsecure/_stdio.h
is a symlink (i.e.:ls -l /usr/local/include/secure/
). If they have been installed bybrew
, they should point to somewhere under../Cellar/<package-name>
. If there are, maybe you could consider uninstalling that package…
运行brew doctor
并检查意外的头文件".
Run brew doctor
and check for "Unexpected header files".
理想情况下,您最终希望删除该目录...如果不确定这是一个好主意,则可以考虑将其临时移出include
目录,例如,执行以下操作:>
Ideally, you want to end up deleting that directory… If you are not certain either it is a good idea, then you may consider moving it temporarilly out of the include
directory, for example by doing the following:
mkdir /usr/local/include.disabled
mv /usr/local/include/secure /usr/local/include.disabled/secure
# Compile ruby
mv /usr/local/include.disabled/secure /usr/local/include/secure
rm -rf /usr/local/include.disabled
如果这些都不起作用,请将以下命令的输出发布到pastebin:
If none of this works, please post the output of the following commands to a pastebin:
which clang
brew doctor
brew ls
ls -la /usr/local/include
如何将所有OSX SDK包含文件移出local/include
How to move all OSX SDK include files out of local/include
我认为以下命令应该足以将指向OSX SDK的所有包含文件移出/usr/local/include
目录(我的不确定性与子目录本身是符号链接有关,还是与之相关.这些是symlinke的子目录……我假设是第一个,如果这个目录是第二类,则oneliner脚本将丢失目录.
I think the following command should be enough to move all include files pointing to the OSX SDK out of the /usr/local/include
directory (my uncertainty here is related to either sub-directories were themselves symlinked, or if it is the content of these subdirectories that is symlinke… I assumed the first, and this oneliner script will miss directories if they are of the second type).
mkdir -p /usr/local/include.disabled/
find /usr/local/include/ -depth 1 -lname '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/*' -exec mv '{}' /usr/local/include.disabled/ ';'
运行这些命令,然后再次执行ls -la /usr/local/include
…其中的内容应该少得多.那里还有secure
目录吗?
Run these commands, then execute ls -la /usr/local/include
again… There should be much less content in it. Do you still have a secure
directory there?
最重要的是,您现在可以完成原始构建吗?
And most importanly, can you now get through your original build?
这篇关于在OSX Catalina中使用rbenv安装ruby-2.4.0时,构建失败(使用ruby-build 20191124的OS X 10.15.1)(10.15.1)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!