Posted at

charlock_holmes(0.7.3) が Siera(10.12.6)でインストールできない場合の対応

More than 1 year has passed since last update.

icu4cのバージョンを上げたらcharlock_holmesがicu4cを見つけられなくなったため、bundlerでcharlock_holmes(0.7.3)を再インストールしようとしたが、今度はインストール時にエラーが出て少し嵌ったので対応をメモ。


環境


  • OSX Siera 10.12.6

  • ruby 2.4.1p111

  • charlock_holmes 0.7.3

  • icu4c 59.1


bundle時のエラー内容

-- 前半省略 -- 

In file included from transliterator.cpp:5:
In file included from /usr/local/Cellar/icu4c/59.1/include/unicode/translit.h:25:
/usr/local/Cellar/icu4c/59.1/include/unicode/unistr.h:3025:7: error: delegating constructors are permitted only in C++11
UnicodeString(ConstChar16Ptr(text)) {}
^~~~~~~~~~~~~
/usr/local/Cellar/icu4c/59.1/include/unicode/unistr.h:3087:7: error: delegating constructors are permitted only in C++11
UnicodeString(ConstChar16Ptr(text), length) {}
^~~~~~~~~~~~~
/usr/local/Cellar/icu4c/59.1/include/unicode/unistr.h:3180:7: error: delegating constructors are permitted only in C++11
UnicodeString(Char16Ptr(buffer), buffLength, buffCapacity) {}
^~~~~~~~~~~~~
transliterator.cpp:101:60: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int32_t' (aka 'int') [-Wshorten-64-to-32]
trans = Transliterator::createInstance(UnicodeString(id, id_len), UTRANS_FORWARD, p_error, status);
~~~~~~~~~~~~~ ^~~~~~
transliterator.cpp:106:34: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int32_t' (aka 'int') [-Wshorten-64-to-32]
u_txt = new UnicodeString(txt, txt_len);
~~~~~~~~~~~~~ ^~~~~~~
4 warnings and 3 errors generated.
make: *** [transliterator.o] Error 1

make failed, exit code 2


対応

bundle configにオプションを指定してbundlerを実行するとインストール出来た

$ bundle config --local build.charlock_holmes -- --with-cxxflags=-std=c++11

$ bundle
The latest bundler is 1.16.0.pre.2, but you are currently running 1.15.4.
To update, run `gem install bundler --pre`
Fetching gem metadata from https://rubygems.org/.
Fetching version metadata from https://rubygems.org/
Using bundler 1.15.4
Fetching charlock_holmes 0.7.3
Installing charlock_holmes 0.7.3 with native extensions
Bundle complete! 1 Gemfile dependency, 2 gems now installed.


参考