charlock_holmes: Unable to install 0.7.5 on macOS Sierra 10.12.6
My command:
gem install charlock_holmes -- --with-icu-dir=/usr/local/opt/icu4c
Output:
Building native extensions with: '--with-icu-dir=/usr/local/opt/icu4c'
This could take a while...
ERROR: Error installing charlock_holmes:
ERROR: Failed to build gem native extension.
current directory: /usr/local/lib/ruby/gems/2.4.0/gems/charlock_holmes-0.7.5/ext/charlock_holmes
/usr/local/opt/ruby/bin/ruby -r ./siteconf20170831-19095-1crbzog.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: /usr/local/lib/ruby/gems/2.4.0/gems/charlock_holmes-0.7.5/ext/charlock_holmes
make "DESTDIR=" clean
current directory: /usr/local/lib/ruby/gems/2.4.0/gems/charlock_holmes-0.7.5/ext/charlock_holmes
make "DESTDIR="
compiling converter.c
converter.c:23:12: warning: implicit conversion loses integer precision: 'long' to 'int32_t' (aka 'int') [-Wshorten-64-to-32]
src_len = RSTRING_LEN(rb_txt);
~ ^~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/ruby/2.4.1_1/include/ruby-2.4.0/ruby/ruby.h:980:6: note: expanded from macro 'RSTRING_LEN'
RSTRING_EMBED_LEN(str) : \
^~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/ruby/2.4.1_1/include/ruby-2.4.0/ruby/ruby.h:976:6: note: expanded from macro 'RSTRING_EMBED_LEN'
(long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
converter.c:23:12: warning: implicit conversion loses integer precision: 'long' to 'int32_t' (aka 'int') [-Wshorten-64-to-32]
src_len = RSTRING_LEN(rb_txt);
~ ^~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/ruby/2.4.1_1/include/ruby-2.4.0/ruby/ruby.h:981:28: note: expanded from macro 'RSTRING_LEN'
RSTRING(str)->as.heap.len)
~~~~~~~~~~~~~~~~~~~~~~^~~
2 warnings generated.
compiling encoding_detector.c
encoding_detector.c:183:71: warning: implicit conversion loses integer precision: 'long' to 'int32_t' (aka 'int') [-Wshorten-64-to-32]
ucsdet_setDeclaredEncoding(detector->csd, RSTRING_PTR(rb_enc_hint), RSTRING_LEN(rb_enc_hint), &status);
~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/ruby/2.4.1_1/include/ruby-2.4.0/ruby/ruby.h:980:6: note: expanded from macro 'RSTRING_LEN'
RSTRING_EMBED_LEN(str) : \
^~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/ruby/2.4.1_1/include/ruby-2.4.0/ruby/ruby.h:976:6: note: expanded from macro 'RSTRING_EMBED_LEN'
(long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
encoding_detector.c:183:71: warning: implicit conversion loses integer precision: 'long' to 'int32_t' (aka 'int') [-Wshorten-64-to-32]
ucsdet_setDeclaredEncoding(detector->csd, RSTRING_PTR(rb_enc_hint), RSTRING_LEN(rb_enc_hint), &status);
~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/ruby/2.4.1_1/include/ruby-2.4.0/ruby/ruby.h:981:28: note: expanded from macro 'RSTRING_LEN'
RSTRING(str)->as.heap.len)
~~~~~~~~~~~~~~~~~~~~~~^~~
encoding_detector.c:232:71: warning: implicit conversion loses integer precision: 'long' to 'int32_t' (aka 'int') [-Wshorten-64-to-32]
ucsdet_setDeclaredEncoding(detector->csd, RSTRING_PTR(rb_enc_hint), RSTRING_LEN(rb_enc_hint), &status);
~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/ruby/2.4.1_1/include/ruby-2.4.0/ruby/ruby.h:980:6: note: expanded from macro 'RSTRING_LEN'
RSTRING_EMBED_LEN(str) : \
^~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/ruby/2.4.1_1/include/ruby-2.4.0/ruby/ruby.h:976:6: note: expanded from macro 'RSTRING_EMBED_LEN'
(long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
encoding_detector.c:232:71: warning: implicit conversion loses integer precision: 'long' to 'int32_t' (aka 'int') [-Wshorten-64-to-32]
ucsdet_setDeclaredEncoding(detector->csd, RSTRING_PTR(rb_enc_hint), RSTRING_LEN(rb_enc_hint), &status);
~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/ruby/2.4.1_1/include/ruby-2.4.0/ruby/ruby.h:981:28: note: expanded from macro 'RSTRING_LEN'
RSTRING(str)->as.heap.len)
~~~~~~~~~~~~~~~~~~~~~~^~~
4 warnings generated.
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:
/usr/local/opt/icu4c/include/unicode/unistr.h:3025:7: error: delegating constructors are permitted only in C++11
UnicodeString(ConstChar16Ptr(text)) {}
^~~~~~~~~~~~~
/usr/local/opt/icu4c/include/unicode/unistr.h:3087:7: error: delegating constructors are permitted only in C++11
UnicodeString(ConstChar16Ptr(text), length) {}
^~~~~~~~~~~~~
/usr/local/opt/icu4c/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
Gem files will remain installed in /usr/local/lib/ruby/gems/2.4.0/gems/charlock_holmes-0.7.5 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0/charlock_holmes-0.7.5/gem_make.out
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 24
- Comments: 25
Only this works for me:
Can you install gem setting manually c flags?
Having a similar issue with the official release of High Sierra (10.13.0) and the system installed Ruby 2.3.0, except it’s also having issues with the Ruby Frameworks’s config.h header which appears to conflict with a c++11 standard and errors out:
I fixed it by running:
before installing the bundle that required charlock_holmes 0.7.5 (GitLab CE), which suppressed the error and got it building properly. Hope this helps someone in the future!
I just ran into this issue while I was attempting to reinstall
0.7.3
after upgrading my computer to the High Sierra GM candidate (10.3 Beta).Was fixed when I ran:
This finally worked and allowed me to install charlock_holmes and run node/npm and run my rails server
edit: this doesn’t solve the OPs issue as it’s 0.7.6 instead of 0.7.5, but it’s the only configuration that seems to work for me on OS X High Sierra 10.13.3
@Weakky One can also work around outdated headers in Ruby by using e.g.
gem install charlock_holmes -- --with-icu-dir=/opt/local --with-cxxflags=-Wno-reserved-user-defined-literal
+1
I’ve patched Ruby master to avoid the need to introduce such spaces in future. https://github.com/ruby/ruby/commit/07f2062c8ffecc774a4ebc1f39ff2c4940592be4
In case it can help:
I was having the following error when running:
gem install charlock_holmes -v '0.7.6' -- --with-icu-dir=/usr/ local/opt/icu4c --with-cxxflags=-std=c++11
I fixed it by manually editing
config.h
and adding space between literals and identifiersBefore
After
I had the same problem.
0.7.4
worked for me, but0.7.3
and0.7.5
did not.¯\_(ツ)_/¯
Solution for me was to set it in bundler so the config stayed set:
I was able to install 0.7.6 fine under High Sierra 10.3.6 with Ruby 2.4.4 via RVM, but trying to install it against the system Ruby (2.3.7p456) fails with:
I get the same error with or without specifying
--with-icu-dir
and--with-cxflags
. It’s not a dealbreaker since I rarely use the system Ruby and only wanted to suppress some errors I was getting on Emacs startup, but it might indicate some other problem.I was finally able to get around this by downgrading my icu4c install as suggested at https://github.com/brianmario/charlock_holmes/issues/117#issuecomment-347267575. Once that was done
gem install charlock_holmes --version 0.7.5 -- --with-icu-dir=/usr/local/opt/icu4c --with-cxxflags=-std=c++11
installed without issue.Use the following command : gem install charlock_holmes – --with-icu-dir=/opt/local/
Please give 0.7.6 a try.
… and this is why people stop using C++. 😂
(Just teasing. C++ is a wonderful language, all things considered.)