Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to install 0.7.5 on macOS Sierra 10.12.6 #122

Open
fepegar opened this issue Aug 31, 2017 · 26 comments
Open

Unable to install 0.7.5 on macOS Sierra 10.12.6 #122

fepegar opened this issue Aug 31, 2017 · 26 comments

Comments

@fepegar
Copy link

fepegar commented Aug 31, 2017

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
@pkpp1233
Copy link

pkpp1233 commented Sep 2, 2017

+1

1 similar comment
@inner-whisper
Copy link

+1

@AndrewSouthpaw
Copy link

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

@wbushey
Copy link

wbushey commented Sep 12, 2017

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

@AndrewSouthpaw
Copy link

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

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

@idanci
Copy link

idanci commented Sep 15, 2017

Can you install gem setting manually c flags?

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

@vlymar
Copy link

vlymar commented Sep 18, 2017

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

@inigomedina
Copy link

👍

@a-hurst
Copy link

a-hurst commented Oct 2, 2017

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!

@mrjohannchang
Copy link

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\'

@parkr
Copy link

parkr commented Mar 29, 2018

Please give 0.7.6 a try.

@rogerhu
Copy link

rogerhu commented Apr 2, 2018

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

@chrisbloom7
Copy link

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.

@chrisbloom7
Copy link

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
Copy link

chrisbloom7 commented Apr 3, 2018

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

@chronodm
Copy link

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.

@anudeepkollapudi1
Copy link

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

@zainzafar
Copy link

zainzafar commented Sep 23, 2018

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

@chronodm
Copy link

chronodm commented Oct 4, 2018

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).

@mikel
Copy link

mikel commented Mar 2, 2019

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

@Weakky
Copy link

Weakky commented Oct 8, 2019

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

@mabraham
Copy link

mabraham commented Nov 5, 2019

@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
Copy link

mabraham commented Nov 5, 2019

I've patched Ruby master to avoid the need to introduce such spaces in future. ruby/ruby@07f2062

@LucasArruda
Copy link

This #122 (comment) fixes Mac OS Catalina issue with charlock_holmes but I think the best solution is #122 (comment) 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.

@blockarchitech
Copy link

blockarchitech commented Jan 9, 2022

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

#122 (comment) does work.

@ExerciseBook
Copy link

sudo gem install charlock_holmes -- --with-cxxflags="-Wno-reserved-user-defined-literal -std=c++11"

2024 version 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests