Return to Tech/ruby

Install Rails


Railsのインストール
$ sudo /usr/local/bin/gem install rails

なにかエラーがでる場合,結果ファイルを参照し対処しなければいけません。
今回の例ではlibxml2へパッチを適用する際にエラーとなったようです。

/usr/local/bin/ruby -r ./siteconf20151025-3599-1mimbnz.rb extconf.rb
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
checking for gzopen() in -lz... yes
checking for iconv... yes
*************************************************************************
IMPORTANT NOTICE:

Building Nokogiri with a packaged version of libxml2-2.9.2
with the following patches applied:
        - 0001-Revert-Missing-initialization-for-the-catalog-module.patch
        - 0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch

Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead: abort this installation process and
reinstall nokogiri as follows:

    gem install nokogiri -- --use-system-libraries
        [--with-xml2-config=/path/to/xml2-config]
        [--with-xslt-config=/path/to/xslt-config]

If you are using Bundler, tell it to use the option:

    bundle config build.nokogiri --use-system-libraries
    bundle install

Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.
*********************************************************************
Extracting libxml2-2.9.2.tar.gz into tmp/i686-pc-linux-gnu/ports/libxml2/2.29.2... OK
Running patch with /usr/local/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/ports/patches/libxml2/0001-Revert-Missing-initialization-for-the-catalog-module.patch...
Running 'patch' for libxml2 2.9.2... ERROR, review '/usr/local/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/ext/nokogiri/tmp/i686-pc-linux-gnu/ports/libxml2/2.9.2/patch.log' to see what happened.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmk.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/local/bin/$(RUBY_BASE_NAME)
    --help
    --clean
    --use-system-libraries
    --enable-static
    --disable-static
    --with-zlib-dir
    --without-zlib-dir
    --with-zlib-include

省略
※調べた結果、patchがインストールされていないことが原因でしたので
yum でpatchをインストール後、再度 gem install railsを試行しました。

retry
$ sudo /usr/local/bin/gem install rails
Building native extensions.  This could take a while...
Successfully installed rails-4.2.4
Parsing documentation for rails-4.2.4
Done installing documentation for rails after 7 seconds
1 gem installed


Return to Tech/ruby