brianmario / charlock_holmes

Character encoding detection, brought to you by ICU
MIT License
1.03k stars 140 forks source link

Unable to install 0.7.6 using instructions in README #130

Open nightpool opened 6 years ago

nightpool commented 6 years ago

Using the instructions in the readme (brew install icu4c && bundle config build.charlock_holmes --with-icu-dir=/usr/local/opt/icu4c), I still get this error related to C++11 extensions:

~/.rbenv/versions/2.5.0/bin/ruby -r ./siteconf20180428-83236-rj6taa.rb extconf.rb --with-icu-dir=/usr/local/opt/icu4c
checking for -licui18n... yes
checking for -licui18n... yes
checking for unicode/ucnv.h... yes
checking for -lz... yes
checking for -licuuc... yes
checking for -licudata... yes
creating Makefile

current directory: ~/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/charlock_holmes-0.7.6/ext/charlock_holmes
make "DESTDIR=" clean

current directory: ~/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/charlock_holmes-0.7.6/ext/charlock_holmes
make "DESTDIR="
compiling converter.c
compiling encoding_detector.c
compiling ext.c
compiling transliterator.cpp
In file included from transliterator.cpp:5:
In file included from /usr/local/opt/icu4c/include/unicode/translit.h:25:
In file included from /usr/local/opt/icu4c/include/unicode/unistr.h:33:
/usr/local/opt/icu4c/include/unicode/char16ptr.h:90:19: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
    Char16Ptr() = delete;
                  ^
/usr/local/opt/icu4c/include/unicode/char16ptr.h:198:24: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
    ConstChar16Ptr() = delete;
                       ^
In file included from transliterator.cpp:5:
In file included from /usr/local/opt/icu4c/include/unicode/translit.h:25:
In file included from /usr/local/opt/icu4c/include/unicode/unistr.h:37:
/usr/local/opt/icu4c/include/unicode/bytestream.h:129:32: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
  ByteSink(const ByteSink &) = delete;
                               ^
/usr/local/opt/icu4c/include/unicode/bytestream.h:130:43: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
  ByteSink &operator=(const ByteSink &) = delete;
                                          ^
/usr/local/opt/icu4c/include/unicode/bytestream.h:221:28: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
  CheckedArrayByteSink() = delete;
                           ^
/usr/local/opt/icu4c/include/unicode/bytestream.h:222:56: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
  CheckedArrayByteSink(const CheckedArrayByteSink &) = delete;
                                                       ^
/usr/local/opt/icu4c/include/unicode/bytestream.h:223:67: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
  CheckedArrayByteSink &operator=(const CheckedArrayByteSink &) = delete;
                                                                  ^
/usr/local/opt/icu4c/include/unicode/bytestream.h:265:22: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
  StringByteSink() = delete;
                     ^
/usr/local/opt/icu4c/include/unicode/bytestream.h:266:44: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
  StringByteSink(const StringByteSink &) = delete;
                                           ^
/usr/local/opt/icu4c/include/unicode/bytestream.h:267:55: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
  StringByteSink &operator=(const StringByteSink &) = delete;
                                                      ^
In file included from transliterator.cpp:5:
In file included from /usr/local/opt/icu4c/include/unicode/translit.h:25:
/usr/local/opt/icu4c/include/unicode/unistr.h:1902:42: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
  UnicodeString &operator=(UnicodeString &&src) U_NOEXCEPT {
                                         ^
/usr/local/opt/icu4c/include/unicode/unistr.h:3358:31: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
  UnicodeString(UnicodeString &&src) U_NOEXCEPT;
                              ^
/usr/local/opt/icu4c/include/unicode/unistr.h:3014:7: error: delegating constructors are permitted only in C++11
      UnicodeString(ConstChar16Ptr(text)) {}
      ^~~~~~~~~~~~~
/usr/local/opt/icu4c/include/unicode/unistr.h:3076:7: error: delegating constructors are permitted only in C++11
      UnicodeString(ConstChar16Ptr(text), length) {}
      ^~~~~~~~~~~~~
/usr/local/opt/icu4c/include/unicode/unistr.h:3169:7: error: delegating constructors are permitted only in C++11
      UnicodeString(Char16Ptr(buffer), buffLength, buffCapacity) {}
      ^~~~~~~~~~~~~
In file included from transliterator.cpp:5:
In file included from /usr/local/opt/icu4c/include/unicode/translit.h:27:
In file included from /usr/local/opt/icu4c/include/unicode/utrans.h:20:
/usr/local/opt/icu4c/include/unicode/localpointer.h:221:34: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
    LocalPointer(LocalPointer<T> &&src) U_NOEXCEPT : LocalPointerBase<T>(src.ptr) {
                                 ^
/usr/local/opt/icu4c/include/unicode/localpointer.h:238:48: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
    LocalPointer<T> &operator=(LocalPointer<T> &&src) U_NOEXCEPT {
                                               ^
/usr/local/opt/icu4c/include/unicode/localpointer.h:366:30: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
    LocalArray(LocalArray<T> &&src) U_NOEXCEPT : LocalPointerBase<T>(src.ptr) {
                             ^
/usr/local/opt/icu4c/include/unicode/localpointer.h:383:44: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
    LocalArray<T> &operator=(LocalArray<T> &&src) U_NOEXCEPT {
                                           ^
In file included from transliterator.cpp:5:
In file included from /usr/local/opt/icu4c/include/unicode/translit.h:27:
In file included from /usr/local/opt/icu4c/include/unicode/utrans.h:23:
/usr/local/opt/icu4c/include/unicode/uenum.h:68:1: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
U_DEFINE_LOCAL_OPEN_POINTER(LocalUEnumerationPointer, UEnumeration, uenum_close);
^
/usr/local/opt/icu4c/include/unicode/localpointer.h:493:53: note: expanded from macro 'U_DEFINE_LOCAL_OPEN_POINTER'
        LocalPointerClassName(LocalPointerClassName &&src) U_NOEXCEPT \
                                                    ^
In file included from transliterator.cpp:5:
In file included from /usr/local/opt/icu4c/include/unicode/translit.h:27:
In file included from /usr/local/opt/icu4c/include/unicode/utrans.h:23:
/usr/local/opt/icu4c/include/unicode/uenum.h:68:1: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
/usr/local/opt/icu4c/include/unicode/localpointer.h:498:64: note: expanded from macro 'U_DEFINE_LOCAL_OPEN_POINTER'
        LocalPointerClassName &operator=(LocalPointerClassName &&src) U_NOEXCEPT { \
                                                               ^
In file included from transliterator.cpp:5:
In file included from /usr/local/opt/icu4c/include/unicode/translit.h:27:
In file included from /usr/local/opt/icu4c/include/unicode/utrans.h:24:
/usr/local/opt/icu4c/include/unicode/uset.h:326:1: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
U_DEFINE_LOCAL_OPEN_POINTER(LocalUSetPointer, USet, uset_close);
^
/usr/local/opt/icu4c/include/unicode/localpointer.h:493:53: note: expanded from macro 'U_DEFINE_LOCAL_OPEN_POINTER'
        LocalPointerClassName(LocalPointerClassName &&src) U_NOEXCEPT \
                                                    ^
In file included from transliterator.cpp:5:
In file included from /usr/local/opt/icu4c/include/unicode/translit.h:27:
In file included from /usr/local/opt/icu4c/include/unicode/utrans.h:24:
/usr/local/opt/icu4c/include/unicode/uset.h:326:1: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
/usr/local/opt/icu4c/include/unicode/localpointer.h:498:64: note: expanded from macro 'U_DEFINE_LOCAL_OPEN_POINTER'
        LocalPointerClassName &operator=(LocalPointerClassName &&src) U_NOEXCEPT { \
                                                               ^
In file included from transliterator.cpp:5:
In file included from /usr/local/opt/icu4c/include/unicode/translit.h:27:
/usr/local/opt/icu4c/include/unicode/utrans.h:255:1: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
U_DEFINE_LOCAL_OPEN_POINTER(LocalUTransliteratorPointer, UTransliterator, utrans_close);
^
/usr/local/opt/icu4c/include/unicode/localpointer.h:493:53: note: expanded from macro 'U_DEFINE_LOCAL_OPEN_POINTER'
        LocalPointerClassName(LocalPointerClassName &&src) U_NOEXCEPT \
                                                    ^
In file included from transliterator.cpp:5:
In file included from /usr/local/opt/icu4c/include/unicode/translit.h:27:
/usr/local/opt/icu4c/include/unicode/utrans.h:255:1: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
/usr/local/opt/icu4c/include/unicode/localpointer.h:498:64: note: expanded from macro 'U_DEFINE_LOCAL_OPEN_POINTER'
        LocalPointerClassName &operator=(LocalPointerClassName &&src) U_NOEXCEPT { \
                                                               ^
transliterator.cpp:101:70: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int32_t' (aka 'int') [-Wshorten-64-to-32]
  trans = icu::Transliterator::createInstance(icu::UnicodeString(id, id_len), UTRANS_FORWARD, p_error, status);
                                              ~~~                    ^~~~~~
transliterator.cpp:106:39: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int32_t' (aka 'int') [-Wshorten-64-to-32]
  u_txt = new icu::UnicodeString(txt, txt_len);
              ~~~                     ^~~~~~~
24 warnings and 3 errors generated.
make: *** [transliterator.o] Error 1

I was able to fix this by using gem install charlock_holmes -v 0.7.6 -- --with-cxxflags=-std=c++11 but that's very inconvenient to do every time and pretty hard to figure out if you're not familiar with how native extension building works.

Please fix both this and the icu4c problem (if you're recommending people use homebrew to install icu4c then why not make /usr/local/opt/icu4c the default on osx?)

pbtura commented 6 years ago

Any news on this? I'm running into the same issue.

skarsol commented 5 years ago

Running into a similar issue here on Gentoo as well. --with-cxxflags=-std=c++11 fixed the install.

bobschi commented 5 years ago

Same problem for me on macOS 10.13.6, trying to install charlock_holmes 0.7.6 with icu4c 62.1 (installed via homebrew). --with-cxxflags=-std=c++11 fixed it.