のんびりSEの議事録

プログラミング系のポストからアプリに関してのポストなどをしていきます。まれにアニメ・マンガなど

High Sierraにアップデートしたらbundle installでこけた話

久しぶりにRuby周りやろうとして、bundle install でライブラリを取得しようとしたときに、また依存関係でこけたので対応した話です。
MacでのRubyあるあるですw

nokogiriのインストールでエラー

checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using system libraries.
ERROR: cannot discover where libxml2 is located on your system. please make sure `pkg-config` is installed.
*** 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=/Users/tatsunorinishikori/.anyenv/envs/rbenv/versions/2.2.2/bin/$(RUBY_BASE_NAME)
        --help
        --clean
        --use-system-libraries
        --with-zlib-dir
        --without-zlib-dir
        --with-zlib-include
        --without-zlib-include=${zlib-dir}/include
        --with-zlib-lib
        --without-zlib-lib=${zlib-dir}/lib
        --with-xml2-dir
        --without-xml2-dir
        --with-xml2-include
        --without-xml2-include=${xml2-dir}/include
        --with-xml2-lib
        --without-xml2-lib=${xml2-dir}/lib
        --with-libxml-2.0-config
        --without-libxml-2.0-config
        --with-pkg-config
        --without-pkg-config
        --with-xslt-dir
        --without-xslt-dir
        --with-xslt-include
        --without-xslt-include=${xslt-dir}/include
        --with-xslt-lib
        --without-xslt-lib=${xslt-dir}/lib
        --with-libxslt-config
        --without-libxslt-config
        --with-exslt-dir
        --without-exslt-dir
        --with-exslt-include
        --without-exslt-include=${exslt-dir}/include
        --with-exslt-lib
        --without-exslt-lib=${exslt-dir}/lib
        --with-libexslt-config
        --without-libexslt-config

extconf failed, exit code 1

Gem files will remain installed in /Users/tatsunorinishikori/workspace/ruby/sample-devise/vendor/bundle/ruby/2.2.0/gems/nokogiri-1.8.0 for inspection.
Results logged to /Users/tatsunorinishikori/workspace/ruby/sample-devise/vendor/bundle/ruby/2.2.0/extensions/x86_64-darwin-16/2.2.0-static/nokogiri-1.8.0/gem_make.out

An error occurred while installing nokogiri (1.8.0), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.8.0'` succeeds before bundling.

cannot discover where libxml2 is located on your system.と怒られる。。。

ls -la /usr/local/lib/ | grep libxml2

どうやら、libxml2のsymlinkが消えているので、再度リンクし直す

brew link --force libxml2

これでnokogiriのエラーは解消し、インストールに成功しました。

mysql2のインストールでエラー

result.c:326:40: warning: incompatible pointer types assigning to 'my_bool *' (aka 'char *') from 'bool *' [-Wincompatible-pointer-types]
    wrapper->result_buffers[i].is_null = &wrapper->is_null[i];
                                       ^ ~~~~~~~~~~~~~~~~~~~~
result.c:328:40: warning: incompatible pointer types assigning to 'my_bool *' (aka 'char *') from 'bool *' [-Wincompatible-pointer-types]
    wrapper->result_buffers[i].error   = &wrapper->error[i];
                                       ^ ~~~~~~~~~~~~~~~~~~
2 warnings generated.
linking shared-object mysql2/mysql2.bundle
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mysql2.bundle] Error 1

make failed, exit code 2

openssl周りっぽい感じのエラーが出ている。。。

Xcode Command Line Toolをアップデートしてみることに

xcode-select --install

アップデートが進んでいったので、どうやら、High Sierraにアップデート後に、コマンドラインツールをアップデートし忘れていたのかもしれない。。。

とりあえずこれで、mysql2のインストールも出来ました。

参考