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 in CentOS 7.5 - undefined method "<<" for nil:NilClass (NoMethodError) #136

Open
cpMillingworth opened this issue Sep 21, 2018 · 2 comments

Comments

@cpMillingworth
Copy link

cpMillingworth commented Sep 21, 2018

First off, yes, libicu-devel is installed.

#gem install charlock_holmes
Building native extensions. This could take a while...
ERROR: Error installing charlock_holmes:
ERROR: Failed to build gem native extension.

current directory: /usr/local/rvm/gems/ruby-2.1.2/gems/charlock_holmes-0.7.6/ext/charlock_holmes

/usr/local/rvm/rubies/ruby-2.1.2/bin/ruby -r ./siteconf20180921-15180-1f6r92q.rb extconf.rb
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
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/rvm/rubies/ruby-2.1.2/bin/ruby
--with-icu-dir
--without-icu-dir
--with-icu-include
--without-icu-include=${icu-dir}/include
--with-icu-lib
--without-icu-lib=${icu-dir}/lib
--with-icui18nlib
--without-icui18nlib
--with-icui18nlib
--without-icui18nlib
--with-zlib
--without-zlib
--with-icuuclib
--without-icuuclib
--with-icudatalib
--without-icudatalib
extconf.rb:60:in '

': undefined method '<<' for nil:NilClass (NoMethodError)

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

/usr/local/rvm/gems/ruby-2.1.2/extensions/x86_64-linux/2.1.0/charlock_holmes-0.7.6/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/rvm/gems/ruby-2.1.2/gems/charlock_holmes-0.7.6 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.1.2/extensions/x86_64-linux/2.1.0/charlock_holmes-0.7.6/gem_make.out

There's nothing useful in the mkmf.log file (there's a warning about a set but unused variable named 'p') and the gem_make.out is just a regurgitation of the above output.

Help is appreciated, thank you.

@wikiti
Copy link

wikiti commented Nov 6, 2018

I'm facing this issue too with Ubuntu 18.04.1 and ruby 2.1.2.

I've solved this problem by downloading a copy of the repository, applying this minor change:

diff --git a/ext/charlock_holmes/extconf.rb b/ext/charlock_holmes/extconf.rb
index 4c97643..0144880 100644
--- a/ext/charlock_holmes/extconf.rb
+++ b/ext/charlock_holmes/extconf.rb
@@ -1,5 +1,7 @@
 require 'mkmf'
 
+$CXXFLAGS ||= ''
+
 CWD = File.expand_path(File.dirname(__FILE__))
 def sys(cmd)
   puts "  -- #{cmd}"

Then, I installed the local copy of the gem:

cd path/to/charlock_holmes
gem build charlock_holmes.gemspec && gem install charlock_holmes-0.7.6.gem

@neakni
Copy link

neakni commented Apr 4, 2019

current directory: /usr/local/ruby/lib/ruby/gems/2.3.0/gems/charlock_holmes-0.7.6/ext/charlock_holmes

/usr/local/ruby/bin/ruby -r ./siteconf20190404-358-udo3gu.rb extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/ruby/bin/$(RUBY_BASE_NAME)
extconf.rb:12:in ``': No such file or directory - which (Errno::ENOENT)
from extconf.rb:12:in `

'

extconf failed, exit code 1

Gem files will remain installed in /usr/local/ruby/lib/ruby/gems/2.3.0/gems/charlock_holmes-0.7.6 for inspection.
Results logged to
/usr/local/ruby/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/charlock_holmes-0.7.6/gem_make.out

An error occurred while installing charlock_holmes (0.7.6), and Bundler cannot continue.
Make sure that gem install charlock_holmes -v '0.7.6' succeeds before bundling.
[root@031401cf0544 admin-ruby]#

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

3 participants