やってみる

アウトプットすべく己を導くためのブログ。その試行錯誤すらたれ流す。

zlibをインストールする

前回のつづき。

開発環境

  • LinuxMint 17.3 MATE

問題のエラー

$ sudo gem install hatenablog
[sudo] password for mint: 
Building native extensions.  This could take a while...
ERROR:  Error installing hatenablog:
    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.
Using mini_portile version 2.1.0
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


Gem files will remain installed in /var/lib/gems/1.9.1/gems/nokogiri-1.6.8.1 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/nokogiri-1.6.8.1/ext/nokogiri/gem_make.out

問題箇所

checking for gzdopen() in -lz... no
zlib is missing; necessary for building libxml2

上記からzlibが存在しないエラーと思われる。

どうやって目星をつけたか

...
checking if the C compiler accepts ... yes
...
checking for gzdopen() in -lz... no
...

以前、MinGWでGTKmmをコンパイルしたときもyesnoの表記があった。インストールすれば解決できた。... yesをみて今回も同じかもしれないと思った。

細かいことだがログから問題点をサクっと見つけられるようになれば解析の苦痛がやわらぐ。

zlibをインストールする

前回と同じく、Synapticパッケージマネージャを使う。LinuxMint17.3の場合はこのほうが安全なのかもしれない。知らないけど。

 $ sudo gem install hatenablog
[sudo] password for mint: 
Building native extensions.  This could take a while...
Fetching: oauth-0.4.7.gem (100%)
Fetching: hatenablog-0.5.0.gem (100%)
ERROR:  Error installing hatenablog:
    hatenablog requires Ruby version >= 2.0.

6分間ほどかかった。nokogiriのコンパイルが完了したらしい。表題の件はクリアしたし、これまでのエラーもこれで解決したと言えるはず。長かった。

Server Error
Server Error
http://ytyaru.hatenablog.com/entry/2017/05/14/000000
http://ytyaru.hatenablog.com/entry/2017/05/15/000000

しかし、hatenablogはRuby2.0以上が必要らしい。おそらく最後の壁、だと思いたい。

所感

次から次へと聞いてないことばかり。Linuxの洗礼か。Ruby2.0が必要なら最初からそう言って欲しかった。2.0インストールから全部やりなおしになるんじゃないか。そもそもLinuxMintでRubyのバージョンアップはできるのだろうか。