![](/img/trans.png)
[英]BUILD FAILED (OS X 10.14.6 using ruby-build 20190828) Installing Ruby via rbenv
[英]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以查看它是否有效。 但事实并非如此。
起初,在安装 OpenSSL 时 C 可执行文件存在问题。 但是后来,我从这里发现,由于安装Anaconda而出现错误。 所以我卸载了anaconda并尝试再次安装。
但现在它抛出了一个不同的错误。
➜ ~ rbenv 安装 2.4.0 正在下载 openssl-1.1.0j.tar.gz... -> https://dqw8nmjcqpjn7.cloudfront.net/31bec6c203ce1a8e93d5994f4ed304c63ccf07676118ds1076763118ds10-opens.1.1.0j.tar.gz安装...用户/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
构建失败(OS X 10.15.1 使用 ruby-build 20191124)
检查或清理工作树在/var/folders/xs/gy8wglwj22g9lbhqfv9mwp7m0000gn/T/ruby-build.20191205014031.81437.0Fmlfl结果记录到/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' 扩展___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS ) ^ 190 个警告和 2 个错误生成。make [2]: * [num2int.o] Error 1 make 1 : * [ext/-test-/num2int/all] 错误 2 制作:*** [build-ext] 错误 2
以前有人遇到过这个问题吗? 任何帮助将不胜感激。
更新
在日志文件中添加最后几行。 它们中的大多数看起来像 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
以下是详细错误的 pate bin: https : //pastebin.com/wzLGzvC5
编辑:
$ 叮当声
/usr/bin/clang
$ 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
$ 酿造医生
Your system is ready to brew.
在我删除了brew doctor
建议的文件后
几行来自
$ 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
首先,让您的日志修剪到重要部分:
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
某行时num2int.c
。 那么,这个宏是从哪里来的呢? 日志说宏是在文件/usr/local/include/secure/_stdio.h
中定义的。
此文件对应于本地安装的软件包,最有可能是通过brew
添加的(它也可能由使用软件包安装程序安装的某些应用程序安装,但这似乎不太可能)。 我还没有找到那个文件属于哪个包(我的电脑上没有它,也没有在谷歌上找到任何对它的引用),但是_stdio.h
文件相当特殊,所以我相信它可能是相关的brew
的私人 GCC。 然而, ruby-build
(当通过rb-env install
执行时)更喜欢使用 XCode 的clang
编译器,它可能不支持brew
的 GCC 支持的某些语法扩展。
简而言之,您最终会在 Apple 的clang
加载一些使用与该编译器不兼容的语法的本地包含文件。
现在做什么?
您必须确定/usr/local/include/secure/
目录是否真的有用。 也许,这与您不再使用的程序有关……我无法确切告诉您该怎么做,但这里有一些想法:
检查secure
或secure/_stdio.h
是否是符号链接(即: ls -l /usr/local/include/secure/
)。 如果它们是由brew
安装的,它们应该指向../Cellar/<package-name>
下的某个地方。 如果有,也许您可以考虑卸载该软件包......
运行brew doctor
并检查“意外的头文件”。
理想情况下,您希望最终删除该目录......如果您不确定这是一个好主意,那么您可以考虑将其暂时移出include
目录,例如通过执行以下操作:
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:
which clang
brew doctor
brew ls
ls -la /usr/local/include
如何将所有 OSX SDK 包含文件移出local/include
文件
我认为以下命令应该足以将所有指向 OSX SDK 的包含文件移出/usr/local/include
目录(我的不确定性与子目录本身是符号链接的,或者它是否是这些符号链接的子目录......我假设第一个,如果它们是第二种类型,这个oneliner脚本将错过目录)。
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
目录吗?
最重要的是,您现在可以完成原始构建吗?
我遇到了类似的问题,可以推荐以下与需要先卸载ed 的binutils相关的方法。 什么对我有用:
brew uninstall binutils
# Uninstalling /usr/local/Cellar/binutils/2.33.1... (134 files, 167.6MB)
rbenv install 2.6.5 && rbenv local 2.6.5 ;
# Downloading openssl-1.1.1d.tar.gz...
# -> https://dqw8nmjcqpjn7.cloudfront.net/1e3a91bc1f9dfce01af26026f856e064eab4c8ee0a8f457b5ae30b40b8b711f2
# Installing openssl-1.1.1d...
# Installed openssl-1.1.1d to /Users/auser/.rbenv/versions/2.6.5
# Downloading ruby-2.6.5.tar.bz2...
# -> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.5.tar.bz2
# Installing ruby-2.6.5...
# ruby-build: using readline from homebrew
# Installed ruby-2.6.5 to /Users/auser/.rbenv/versions/2.6.5
在此之前,我还在ruby-build.log 中收到了许多不同的消息 - 最后一条是:
# ld: symbol(s) not found for architecture x86_64
作为自制程序升级(卸载之前)的一部分,我采取的许多其他步骤包括:
brew install perl ruby rbenv
# // UPDATE PATHs with suggestions made by brew during install
which awk perl
# /usr/local/bin/awk
# /usr/local/bin/perl
# ^^^ IN SHORT ALL PATHs should be with /usr/local/opt OR /usr/local/bin
您可以根据需要再次重新安装 binutils,并记住使用您可能重新执行的任何未来rbenv install
版本重复卸载(自我注意)。
PS - 在 macOS Catalina 10.15.3 (19D76) 上测试成功安装 2.4.0 和 2.6.5
您可以尝试运行以下命令吗:
brew unlink gawk
brew reinstall awk
awk
在运行rbenv install 2.4.0
之前
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.