简体   繁体   English

rbenv安装给我一个Build Failed

[英]rbenv install giving me a Build Failed

I am having issues getting ruby-build to work through rbenv. 我有问题让ruby-build通过rbenv工作。 When I run rbenv install 2.2.2 (or any other version) I get the following output: 当我运行rbenv install 2.2.2(或任何其他版本)时,我得到以下输出:

Downloading ruby-2.2.4.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.4.tar.bz2 Installing ruby-2.2.4...

BUILD FAILED (Ubuntu 16.04 using ruby-build 20170201-7-g5d62e84)

Inspect or clean up the working tree at /tmp/ruby-build.20170227230105.17714 Results logged to /tmp/ruby-build.20170227230105.17714.log

Last 10 log lines: 
removed 'conf17793.dir/conf17793.file' 
removed 'conf17793.file' 
config.guess already exists 
config.sub already exists 
checking build system type... config.sub: too many arguments 
Try `config.sub --help' for more information. 
configure: error: /bin/bash tool/config.sub x86_64-pc-linux-gnu 
removed '/tmp/cg1RYI8Z/dummy.c' removed '/tmp/cg1RYI8Z/dummy.o' failed 
removed 'confdefs.h' removed directory '/opt/rbenv/versions/2.2.4/lib' 
removed directory '/opt/rbenv/versions/2.2.4'

The full logs are not much longer but I will post them here just in case they are relevant: 完整的日志不会太长,但我会在这里发布它们,以防万一它们是相关的:

/tmp/ruby-build.20170227230105.17714 /opt/rbenv
removed 'ruby-2.2.4.tar.bz2'
/tmp/ruby-build.20170227230105.17714/ruby-2.2.4 /tmp/ruby-build.20170227230105.17714 /opt/rbenv
removed 'conf17793'
removed 'conf17793.dir/conf17793.file'
removed 'conf17793.file'
config.guess already exists
config.sub already exists
checking build system type... config.sub: too many arguments
Try `config.sub --help' for more information.
configure: error: /bin/bash tool/config.sub x86_64-pc-linux-gnu
removed '/tmp/cg1RYI8Z/dummy.c'
removed '/tmp/cg1RYI8Z/dummy.o' failed
removed 'confdefs.h'

I searched online and haven't seen anyone else getting this error in relation to ruby-build or rbenv . 我在网上搜索并没有看到任何其他人在ruby-buildrbenv遇到此错误。

I will also explain my setup and how I installed rbenv just to give as much info as possible. 我还将解释我的设置以及我如何安装rbenv以尽可能多地提供信息。

I am running Ubuntu 16.04 and cloned the rbenv repo to my /opt directory. 我正在运行Ubuntu 16.04并将rbenv repo克隆到我的/opt目录。 sudo git clone https://github.com/rbenv/rbenv.git /opt . sudo git clone https://github.com/rbenv/rbenv.git /opt I added the rbenv set up lines to my .proflie file. 我将rbenv设置行添加到我的.proflie文件中。

export RBENV_ROOT="/opt/rbenv/"
if [ -d "${RBENV_ROOT}" ]; then
    export PATH="${RBENV_ROOT}/bin:${PATH}"
    eval "$(rbenv init -)"
fi

I then cloned the ruby-build repo git clone https://github.com/rbenv/ruby-build.git /opt/rbenv/plugins/ruby-build 然后我克隆了ruby-build repo git clone https://github.com/rbenv/ruby-build.git /opt/rbenv/plugins/ruby-build

I then created a new group called ruby (that my user is in.) and recursively set it as the group for all of /opt/rbenv so now it's owned by root:ruby . 然后我创建了一个名为ruby的新组(我的用户在。)并递归地将其设置为所有/opt/rbenv的组,所以现在它由root:ruby拥有。

After all that rbenv appears to be working, I can run commands like rbenv versions (It shows system and 1.9.3-p0 which I installed manually) and rbenv local 1.9.3-p0 . 毕竟rbenv似乎正在工作,我可以运行像rbenv versions命令(它显示我手动安装的system1.9.3-p0 )和rbenv local 1.9.3-p0 With no problem. 没问题。 I can also run rbenv install -l and get a full list with no problem so they both appeared to be installed properly. 我也可以运行rbenv install -l并获得一个没有问题的完整列表,因此它们似乎都安装正确。

If anyone can give me any ideas of what might be going wrong when I try to install a ruby version I would greatly appreciate it. 如果有人能够在我尝试安装ruby版本时给我任何可能出错的想法,我将非常感激。

I found the problem. 我发现了这个问题。 rbenv install downloads the ruby versions specfied then run the ./configure --prefix=/path/to/rbenv/versions/2.2.2 . rbenv install下载指定的ruby版本,然后运行./configure --prefix=/path/to/rbenv/versions/2.2.2 This is the command that was failing. 这是失败的命令。 After looking into one of the versions I downloaded that failed installing and going through it's configure script it was using a script called config.guess to determine the system type. 在查看我下载的其中一个安装失败的版本并通过它的配置脚本之后,它使用了一个名为config.guess的脚本来确定系统类型。 This script creates some temporary files and deletes them. 此脚本会创建一些临时文件并将其删除。 This would normally be fine but I have a custom rm command in my path, it does a few things but one of those things is to add the verbose flag. 这通常会很好但我在我的路径中有一个自定义rm命令,它做了一些事情,但其中一个是添加详细标志。 This was muddying the output of the config.guess script and breaking things later in the .configure script that were dependent on the output of this script. 这会使config.guess脚本的输出变得混乱,并且稍后会在.configure脚本中破坏依赖于此脚本输出的内容。 I fixed this by removing the verbose flag from my custom rm command and just placing it in a an alias. 我通过从我的自定义rm命令中删除详细标志并将其放在别名中来修复此问题。

Short answer (TLDR): I had a custom rm command in my path that was breaking stuff. 简短回答(TLDR):我的路径中有一个自定义的rm命令,它正在破坏东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM