charlock_holmes icon indicating copy to clipboard operation
charlock_holmes copied to clipboard

Unable to install 0.7.5 on macOS Sierra 10.12.6

Open fepegar opened this issue 6 years ago • 25 comments

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

fepegar avatar Aug 31 '17 14:08 fepegar

+1

pkpp1233 avatar Sep 02 '17 04:09 pkpp1233

+1

inner-whisper avatar Sep 05 '17 07:09 inner-whisper

I had the same problem. 0.7.4 worked for me, but 0.7.3 and 0.7.5 did not. ¯\_(ツ)_/¯

AndrewSouthpaw avatar Sep 08 '17 00:09 AndrewSouthpaw

Hi all, I've run into this same issue, except I'm on El Capitan (10.11.6). Using bundler 1.15.4, ruby 2.3.1, Xcode 8.2.1 build 8C1002, and icu4c 59.1:

checking for main() in -licui18n... yes
checking for main() in -licui18n... yes
checking for unicode/ucnv.h... yes
checking for main() in -lz... yes
checking for main() in -licuuc... yes
checking for main() in -licudata... yes
creating Makefile

current directory: /Users/bbushey/Development/evolution/vendor/bundle/ruby/2.3.0/gems/charlock_holmes-0.7.5/ext/charlock_holmes
make "DESTDIR=" clean

current directory: /Users/bbushey/Development/evolution/vendor/bundle/ruby/2.3.0/gems/charlock_holmes-0.7.5/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:
/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

wbushey avatar Sep 12 '17 15:09 wbushey

... and this is why people stop using C++. 😂

(Just teasing. C++ is a wonderful language, all things considered.)

AndrewSouthpaw avatar Sep 13 '17 18:09 AndrewSouthpaw

Can you install gem setting manually c flags?

gem install charlock_holmes -- --with-cxxflags=-std=c++11

idanci avatar Sep 15 '17 14:09 idanci

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:

gem install charlock_holmes -v '0.7.3' -- --with-icu-dir=/usr/local/opt/icu4c --with-cxxflags=-std=c++11

vlymar avatar Sep 18 '17 00:09 vlymar

👍

inigomedina avatar Sep 25 '17 16:09 inigomedina

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:

compiling transliterator.cpp
In file included from transliterator.cpp:1:
In file included from ./common.h:9:
In file included from
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby.h:33:
In file included from
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby/ruby.h:24:
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin17/ruby/config.h:368:31:
error: invalid suffix on literal; C++11 requires a space between literal and
identifier [-Wreserved-user-defined-literal]
#define RUBY_ARCH "universal-"RUBY_PLATFORM_OS
                              ^
                               
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin17/ruby/config.h:369:35:
error: invalid suffix on literal; C++11 requires a space between literal and
identifier [-Wreserved-user-defined-literal]
#define RUBY_PLATFORM "universal."RUBY_PLATFORM_CPU"-"RUBY_PLATFORM_OS
                                  ^
                                   
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin17/ruby/config.h:369:55:
error: invalid suffix on literal; C++11 requires a space between literal and
identifier [-Wreserved-user-defined-literal]
#define RUBY_PLATFORM "universal."RUBY_PLATFORM_CPU"-"RUBY_PLATFORM_OS
                                                      ^
                                                       
3 errors generated.
make: *** [transliterator.o] Error 1

I fixed it by running:

bundle config build.charlock_holmes --with-icu-dir=/usr/local/opt/icu4c --with-cxxflags=\'-Wno-reserved-user-defined-literal -std=c++11\'

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!

a-hurst avatar Oct 02 '17 17:10 a-hurst

Only this works for me:

sudo gem install charlock_holmes -- --with-icu-dir=/usr/local/opt/icu4c --with-cxxflags=\'-Wno-reserved-user-defined-literal -std=c++11\'

mrjohannchang avatar Nov 15 '17 00:11 mrjohannchang

Please give 0.7.6 a try.

parkr avatar Mar 29 '18 19:03 parkr

Just tried, doesn't help... the workaround listed still fixes it.

rogerhu avatar Apr 02 '18 06:04 rogerhu

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.

chrisbloom7 avatar Apr 02 '18 14:04 chrisbloom7

Although that ☝️ appears to result in npm install not working, at least for the one library I tried installing, until I put icu4c back to the current version which then broke charlock_homes again 🤷‍♂️

chrisbloom7 avatar Apr 02 '18 20:04 chrisbloom7

This finally worked and allowed me to install charlock_holmes and run node/npm and run my rails server

brew uninstall icu4c --force --ignore-dependencies
brew cleanup # YMMV, be careful here if you like to keep multiple versions of certain brews
brew reinstall node # forces latest icu4c to be installed
gem install charlock_holmes --version 0.7.6 -- --with-icu-dir=/usr/local/opt/icu4c --with-cxxflags=-std=c++11

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

chrisbloom7 avatar Apr 03 '18 17:04 chrisbloom7

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:

ERROR:  Error installing charlock_holmes:
	ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.3.0/gems/charlock_holmes-0.7.6/ext/charlock_holmes
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20180726-54665-1wlohkx.rb extconf.rb --with-icu-dir=/usr/local/opt/icu4c --with-cxxflags=-std=c++11
checking for main() in -licui18n... yes
checking for main() in -licui18n... yes
checking for unicode/ucnv.h... yes
checking for main() in -lz... yes
checking for main() in -licuuc... yes
checking for main() in -licudata... yes
creating Makefile

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-17/2.3.0/charlock_holmes-0.7.6/mkmf.log

current directory: /Library/Ruby/Gems/2.3.0/gems/charlock_holmes-0.7.6/ext/charlock_holmes
make "DESTDIR=" clean

current directory: /Library/Ruby/Gems/2.3.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:1:
In file included from ./common.h:9:
In file included from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby.h:33:
In file included from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby/ruby.h:24:
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin17/ruby/config.h:368:31: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal]
#define RUBY_ARCH "universal-"RUBY_PLATFORM_OS
                              ^
                               
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin17/ruby/config.h:369:35: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal]
#define RUBY_PLATFORM "universal."RUBY_PLATFORM_CPU"-"RUBY_PLATFORM_OS
                                  ^
                                   
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin17/ruby/config.h:369:55: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal]
#define RUBY_PLATFORM "universal."RUBY_PLATFORM_CPU"-"RUBY_PLATFORM_OS
                                                      ^
                                                       
3 errors generated.
make: *** [transliterator.o] Error 1

make failed, exit code 2

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.

chronodm avatar Jul 26 '18 16:07 chronodm

Use the following command : gem install charlock_holmes -- --with-icu-dir=/opt/local/

anudeepkollapudi1 avatar Aug 16 '18 05:08 anudeepkollapudi1

I was finally able to get around this by downgrading my icu4c install as suggested at #117 (comment). 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.

This worked for me but with 0.7.6

zainzafar avatar Sep 23 '18 09:09 zainzafar

FWIW the install worked out of the box on Mojave with Homebrew icu4c-62.1.mojave.bottle.tar.gz (Ruby 2.5.1 via rvm).

chronodm avatar Oct 04 '18 22:10 chronodm

Solution for me was to set it in bundler so the config stayed set:

$ brew install icu4c
$ bundle config build.charlock_holmes --with-icu-dir=/usr/local/opt/icu4c --with-cxxflags=-std=c++11
$ bundle

mikel avatar Mar 02 '19 06:03 mikel

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

Building native extensions with: '--with-icu-dir=/usr/local/opt/icu4c --with-cxxfla
gs=-std=c++11'
This could take a while...
ERROR:  Error installing charlock_holmes:
        ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.3.0/gems/charlock_holmes-0.7.6/ext/char
lock_holmes
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -I /Library/Rub
y/Site/2.3.0 -r ./siteconf20191008-51558-13w2yvj.rb extconf.rb --with-icu-dir\=/usr
/local/opt/icu4c --with-cxxflags\=-std\=c\+\+11
checking for main() in -licui18n... yes
checking for main() in -licui18n... yes
checking for unicode/ucnv.h... yes
checking for main() in -lz... yes
checking for main() in -licuuc... yes
checking for main() in -licudata... yes
creating Makefile

current directory: /Library/Ruby/Gems/2.3.0/gems/charlock_holmes-0.7.6/ext/charlock
_holmes
make "DESTDIR=" clean

current directory: /Library/Ruby/Gems/2.3.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:1:
In file included from ./common.h:9:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby.h:33:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby/ruby.h:24:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin18/ruby/config.h:365:31: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal]
#define RUBY_ARCH "universal-"RUBY_PLATFORM_OS
                              ^
                               
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin18/ruby/config.h:366:35: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal]
#define RUBY_PLATFORM "universal."RUBY_PLATFORM_CPU"-"RUBY_PLATFORM_OS
                                  ^
                                   
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin18/ruby/config.h:366:55: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal]
#define RUBY_PLATFORM "universal."RUBY_PLATFORM_CPU"-"RUBY_PLATFORM_OS
                                                      ^
                                                       
In file included from transliterator.cpp:1:
In file included from ./common.h:9:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby.h:33:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby/ruby.h:1988:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby/intern.h:47:19: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]
void rb_mem_clear(register VALUE*, register long);

I fixed it by manually editing config.h and adding space between literals and identifiers

Before

#define RUBY_ARCH "universal-"RUBY_PLATFORM_OS
#define RUBY_PLATFORM"universal."RUBY_PLATFORM_CPU"-"RUBY_PLATFORM_OS

After

#define RUBY_ARCH "universal-" RUBY_PLATFORM_OS
#define RUBY_PLATFORM "universal." RUBY_PLATFORM_CPU "-" RUBY_PLATFORM_OS

Weakky avatar Oct 08 '19 10:10 Weakky

@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

mabraham avatar Nov 05 '19 13:11 mabraham

I've patched Ruby master to avoid the need to introduce such spaces in future. https://github.com/ruby/ruby/commit/07f2062c8ffecc774a4ebc1f39ff2c4940592be4

mabraham avatar Nov 05 '19 15:11 mabraham

This https://github.com/brianmario/charlock_holmes/issues/122#issuecomment-539457837 fixes Mac OS Catalina issue with charlock_holmes but I think the best solution is https://github.com/brianmario/charlock_holmes/issues/122#issuecomment-549819632 which does not involves editing source and it also works on Catalina.

Hopefully in future, with new @mabraham changes, we won't have this problem on a new Mac version anymore.

LucasArruda avatar Feb 13 '20 20:02 LucasArruda

Can confirm this still is an issue on macOS Monterey with 7.7

#122 (comment) does work.

blockarchitech avatar Jan 09 '22 14:01 blockarchitech