bundle updateやgem installでkakasiをインストールしようとすると"libkakasi is not found"でエラーになる

gemやbundleでkakasiをインストールしようとすると、次のようなエラーが出た。

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/home/hoge/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/kakasi-1.0.2/ext/kakasi-config
/home/hoge/.rbenv/versions/2.3.1/bin/ruby -r
./siteconf20170429-71637-q77g1z.rb extconf.rb
checking fiddle... yes
checking for kakasi... failed -- libkakasi is not found
*** 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=/home/hoge/.rbenv/versions/2.3.1/bin/$(RUBY_BASE_NAME)
        --with-kakasi-dir
        --without-kakasi-dir
        --with-kakasi-include
        --without-kakasi-include=${kakasi-dir}/include
        --with-kakasi-lib
        --without-kakasi-lib=${kakasi-dir}/lib

extconf failed, exit code 1

Gem files will remain installed in
/home/hoge/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/kakasi-1.0.2 for
inspection.
Results logged to
/home/hoge/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/kakasi-1.0.2/gem_make.out

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

解決方法

kakasiのインストール

こちらを参考 http://satolabo.0t0.jp/2017/03/09/ubuntu-replacement-by-kakasi/

共有ライブラリの更新

$ sudo echo "/usr/local/lib" >> /etc/ld.so.conf.d/usrlocal.conf
$ sudo ldconfig

これで、gem installやbundle updateをすれば、無事にkakasiがインストールされます。

$ bundle update
.
.
Installing kakasi 1.0.2 with native extensions
.
.