2016年4月22日星期五

配置Redmine服务器遇到的一些问题总结

boss把配置失败的redmine扔给我,让我重新配置,撂下狠话,大不了你把debian重装下,于是我开始了拧巴的调试/配置/Debug/擦屁股之路,遇到很多问题,ruby/rails的坑很多,挨个写下来吧。注意,本机环境为VM虚拟服务器里的debian

1. gem install rails 失败

具体的报错信息如下,

 ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb 
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
checking for gzdopen() in -lz... no
zlib is missing; necessary for building libxml2
*** 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=.
    --curdir
    --ruby=/usr/bin/ruby1.9.1
    --help
    --clean
    --use-system-libraries
    --enable-static
    --disable-static
    --with-zlib-dir
    --without-zlib-dir
    --with-zlib-include
    --without-zlib-include=${zlib-dir}/include
    --with-zlib-lib
    --without-zlib-lib=${zlib-dir}/lib
    --enable-cross-build
    --disable-cross-build
首先提示Build gem native extension失败,接下来的检查各种依赖环境/包时,可以看到C compiler-yes,gzdopen()-no,重要提示来了,“zlib is missing; necessayr for building libxml2....”很显然,缺少libxml2环境,那装上不就得了,

    apt=get install zlib1g-dev
然后重新gem install rails,刷刷地一路successful.

2. bundle install --without development test失败
报错提示安装gem install rmagick,然后有错误如下,

Can't install RMagick 2.13.1. Can't find Magick-config in /Users/jjdevenuta/.rvm/gems/ruby-1.9.2-head@rails3/bin:/Users/jjdevenuta/.rvm/gems/ruby-1.9.2-head@global/bin:/Users/jjdevenuta/.rvm/rubies/ruby-1.9.2-head/bin:/Users/jjdevenuta/.rvm/bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/usr/X11/bin

*** 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
那么跟之前解决方案类似,缺啥补啥,再装上缺少的包!
apt-get install libmagickwand-dev imagemagick

就可以了,我在stockoverflow上看到一段话,对这类问题做了一个很好的归纳总结,摘录如下,

When building native ruby gems, sometimes you'll get an error containing "ruby extconf.rb". This is often caused by missing dev libraries for the gem you're installing, or even ruby itself. Do you have apt installed on your machine? If not, I'd recommend installing it, it's a quick and easy way to get a lot of dev libraries.

一般请款修改出现此类问题是因为缺少相应的dev包,或者ruby本身有问题,解决方案就是安装相应包的dev。

再次执行,bundle install --without development test,成功啦。





















没有评论:

发表评论