我正在使用 Amazon 网络服务(ubuntu 12.04.1 LTS)并使用带有 RVM 的 Ruby 1.9.3(单用户安装)
我使用 rvmsudo gem install passenger
安装了 passenger
我尝试rvmsudo passenger-install-apache2-module
它说出了点问题......
我认为有两个错误
第一个错误
checking for alloca.h... *** /home/ubuntu/.rvm/gems/ruby-1.9.3-p392/gems/passenger-3.0.19/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/ubuntu/.rvm/gems/ruby-1.9.3-p392/gems/passenger-3.0.19/ext/ruby
--curdir
--ruby=/home/ubuntu/.rvm/rubies/ruby-1.9.3-p392/bin/ruby
所以我检查了 mkmf.log 但我找不到问题所在。
在 mkmf.log 中
" -o conftest -I/home/ubuntu/.rvm/rubies/ruby-1.9.3-p392/include/ruby-1.9.1/x86_64-linux -I/home/ubuntu/.rvm/rubies/ruby-1.9.3-p392/include/ruby-1.9.1/ruby/backward -I/home/ubuntu/.rvm/rubies/ruby-1.9.3-p392/include/ruby-1.9.1 -I/home/ubuntu/.rvm/gems/ruby-1.9.3-p392/gems/passenger-3.0.19/ext/ruby -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fPIC -g conftest.c -L. -L/home/ubuntu/.rvm/rubies/ruby-1.9.3-p392/lib -Wl,-R/home/ubuntu/.rvm/rubies/ruby-1.9.3-p392/lib -L. -rdynamic -Wl,-export-dynamic '-Wl,-rpath,/../lib' -Wl,-R -Wl,/home/ubuntu/.rvm/rubies/ruby-1.9.3-p392/lib -L/home/ubuntu/.rvm/rubies/ruby-1.9.3-p392/lib -lruby "
sh: 0: Illegal option -
Current option settings
errexit on
noglob on
ignoreeof on
interactive on
monitor on
noexec on
stdin on
xtrace on
verbose on
vi on
emacs on
noclobber on
allexport on
notify on
nounset on
nolog on
debug on
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */
2.第二个错误
/home/ubuntu/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /home/ubuntu/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
from /home/ubuntu/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:931:in `block in have_header'
from /home/ubuntu/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /home/ubuntu/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /home/ubuntu/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /home/ubuntu/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /home/ubuntu/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /home/ubuntu/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /home/ubuntu/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /home/ubuntu/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:930:in `have_header'
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p392/gems/passenger-3.0.19/ext/ruby/extconf.rb:36:in `<main>'
rake aborted!
Command failed with status (1): [cd 'ext/ruby/ruby-1.9.3-x86_64-linux/' && ...]
/home/ubuntu/.rvm/gems/ruby-1.9.3-p392/gems/passenger-3.0.19/build/ruby_extension.rb:43:in `block in <top (required)>'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `eval'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => apache2 => native_support => ext/ruby/ruby-1.9.3-x86_64-linux//passenger_native_support.so => ext/ruby/ruby-1.9.3-x86_64-linux//Makefile
(See full trace by running task with --trace)
但是我在这里找不到任何线索......
有人知道怎么解决吗?
我会首先确保我已经通过如下安装 build-essential 配置了 Ubuntu 以进行开发
xyz@supergLTS:~$ sudo apt-get install build-essential
这将获得 make 和 gcc 需要的所有开发工具、文件和头文件。然后我将重新运行 Apache2 模块的构建过程
rvmsudo passenger-install-apache2-module
我是一名优秀的程序员,十分优秀!