2

我正在使用带有 RVM 的 ubuntu 12.04 LTS、ruby 2.0

在安装过程中。发生此错误。

checking for alloca.h... *** /home/pastelcorp/.rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.10/ext/ruby/extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=/home/pastelcorp/.rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.10/ext/ruby
    --curdir
    --ruby=/home/pastelcorp/.rvm/rubies/ruby-2.0.0-p247/bin/ruby
/home/pastelcorp/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:430:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /home/pastelcorp/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:561:in `try_cpp'
from /home/pastelcorp/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:1040:in `block in have_header'
from /home/pastelcorp/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:891:in `block in checking_for'
from /home/pastelcorp/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:336:in `block (2 levels) in postpone'
from /home/pastelcorp/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:306:in `open'
from /home/pastelcorp/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:336:in `block in postpone'
from /home/pastelcorp/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:306:in `open'
from /home/pastelcorp/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:332:in `postpone'
from /home/pastelcorp/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:890:in `checking_for'
from /home/pastelcorp/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:1039:in `have_header'
from /home/pastelcorp/.rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.10/ext/ruby/extconf.rb:37:in `<main>'
rake aborted!
Command failed with status (1): [cd 'buildout/ruby/ruby-2.0.0-x86_64-linux/...]
/home/pastelcorp/.rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.10/build/ruby_extension.rb:55:in `block in <top (required)>'
/home/pastelcorp/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `eval'
/home/pastelcorp/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => nginx => buildout/ruby/ruby-2.0.0-x86_64-linux//passenger_native_support.so => buildout/ruby/ruby-2.0.0-x86_64-linux//Makefile
(See full trace by running task with --trace)

就是说我必须先安装开发工具。但我已经完成了sudo apt-get install build-essential

这是我的 mkmf.log 文件(我根本不明白)

" -o conftest -I/home/pastelcorp/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/x86_64-linux -I/home/pastelcorp/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0/ruby/backward -I/home/pastelcorp/.rvm/rubies/ruby-2.0.0-p247/include/ruby-2.0.0 -I/home/pastelcorp/.rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.10/ext/ruby     -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  -fPIC -g conftest.c  -L. -L/home/pastelcorp/.rvm/rubies/ruby-2.0.0-p247/lib -Wl,-R/home/pastelcorp/.rvm/rubies/ruby-2.0.0-p247/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic     '-Wl,-rpath,/../lib' -Wl,-R -Wl,/home/pastelcorp/.rvm/rubies/ruby-2.0.0-p247/lib -L/home/pastelcorp/.rvm/rubies/ruby-2.0.0-p247/lib -lruby   -lpthread"
sh: 1: -o: not found
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

有什么想法吗?

4

2 回答 2

13

问题解决了。

在 RVM 中,我使用二进制文件安装了 ruby​​2.0.0,而不是编译源代码。

所以我做了

rvm remove 2.0.0rvm install 2.0.0 ----disable-binary

所以 ruby​​ 2.0.0 已经从源代码和乘客编译工作正常。

于 2013-07-25T16:35:36.903 回答
2

You have to install development tools first.

很可能您缺少一些库,就像错误所指示的那样。几周前我遇到了同样的事情。这是一个很好的教程,类似于帮助我的教程。

http://alexpearce.me/2012/06/setting-up-a-vps/

运气好的话,我相信这条线会解决您当前的问题,但请务必查看整个文档。

sudo apt-get -y install curl git-core python-software-properties build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libcurl4-openssl-dev 

另外:我在使用 rvm 时也总是遇到麻烦,并且发现 rbenv 的工作问题更少,本教程中实际上提到了这一点。

对于数据库,如果您不使用 postgres,那么您应该能够将数据库上的位换成 mysql 等效库。

于 2013-07-25T16:28:07.387 回答