I'm trying to install Rails with RVM using the newest version of Ruby but I'm running with a problem when installing Nokogiri.
I already have some RVM gemsets that use Ruby 2.4.0 and I didn't have an issue. I installed Ruby 2.4.1 with:
rvm install ruby-2.4.0
And created a new gemset with:
rvm use ruby-2.4.1#quiniela --create
And then ran:
gem install rails --pre
And I got this error:
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: /Users/andres/.rvm/gems/ruby-2.4.1#quiniela/gems/nokogiri-1.7.1/ext/nokogiri
/Users/andres/.rvm/rubies/ruby-2.4.1/bin/ruby -r ./siteconf20170325-50295-1sw75cw.rb extconf.rb
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
Using mini_portile version 2.1.0
checking for iconv.h... yes
checking for gzdopen() in -lz... yes
checking for iconv using --with-opt-* flags... yes
And then:
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
--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=/Users/andres/.rvm/rubies/ruby-2.4.1/bin/$(RUBY_BASE_NAME)
--help
--clean
--use-system-libraries
--enable-static
--disable-static
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--enable-cross-build
--disable-cross-build
/Users/andres/.rvm/gems/ruby-2.4.1#quiniela/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:366:in `block in execute': Failed to complete compile task (RuntimeError)
from /Users/andres/.rvm/gems/ruby-2.4.1#quiniela/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:337:in `chdir'
from /Users/andres/.rvm/gems/ruby-2.4.1#quiniela/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:337:in `execute'
from /Users/andres/.rvm/gems/ruby-2.4.1#quiniela/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:111:in `compile'
from /Users/andres/.rvm/gems/ruby-2.4.1#quiniela/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:150:in `cook'
from extconf.rb:364:in `block (2 levels) in process_recipe'
from extconf.rb:257:in `block in chdir_for_build'
from extconf.rb:256:in `chdir'
from extconf.rb:256:in `chdir_for_build'
from extconf.rb:363:in `block in process_recipe'
from extconf.rb:262:in `tap'
from extconf.rb:262:in `process_recipe'
from extconf.rb:547:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/andres/.rvm/gems/ruby-2.4.1#quiniela/extensions/x86_64-darwin-16/2.4.0/nokogiri-1.7.1/mkmf.log
extconf failed, exit code 1
It seems that it's a problem with Nokogiri.
I followed the suggestions in "Error installing nokogiri: Failed to build gem native extension & libiconv is missing (OSX)" without success.
I updated RVM and ran gem update but it didn't work. Xcode is updated as well.
Has anyone run into this problem?
Try this:
gem install nokogiri -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2 --use-system-libraries
It solved the problem for me ...
Related
I need to install canvas-lms stable/2018-12-08 in ubuntu 20.04
I have:
rbenv
ruby 2.4.0
bundler 1.16.4
I get this error:
Installing thrift 0.9.3.0 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/jxd/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thrift-0.9.3.0/ext /home/jxd/.rbenv/versions/2.4.0/bin/ruby -I /home/jxd/.rbenv/versions/2.4.0/lib/ruby/site_ruby/2.4.0 -r ./siteconf20220417-4132-wc9kcv.rb extconf.rb checking for strlcpy() in string.h... *** 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=/home/jxd/.rbenv/versions/2.4.0/bin/$(RUBY_BASE_NAME) /home/jxd/.rbenv/versions/2.4.0/lib/ruby/2.4.0/mkmf.rb:457:in `try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /home/jxd/.rbenv/versions/2.4.0/lib/ruby/2.4.0/mkmf.rb:542:in `try_link0' from /home/jxd/.rbenv/versions/2.4.0/lib/ruby/2.4.0/mkmf.rb:557:in `try_link' from /home/jxd/.rbenv/versions/2.4.0/lib/ruby/2.4.0/mkmf.rb:768:in `try_func' from /home/jxd/.rbenv/versions/2.4.0/lib/ruby/2.4.0/mkmf.rb:1055:in `block in have_func' from /home/jxd/.rbenv/versions/2.4.0/lib/ruby/2.4.0/mkmf.rb:945:in `block in checking_for' from /home/jxd/.rbenv/versions/2.4.0/lib/ruby/2.4.0/mkmf.rb:351:in `block (2 levels) in postpone' from /home/jxd/.rbenv/versions/2.4.0/lib/ruby/2.4.0/mkmf.rb:321:in `open' from /home/jxd/.rbenv/versions/2.4.0/lib/ruby/2.4.0/mkmf.rb:351:in `block in postpone' from /home/jxd/.rbenv/versions/2.4.0/lib/ruby/2.4.0/mkmf.rb:321:in `open' from /home/jxd/.rbenv/versions/2.4.0/lib/ruby/2.4.0/mkmf.rb:347:in `postpone' from /home/jxd/.rbenv/versions/2.4.0/lib/ruby/2.4.0/mkmf.rb:944:in `checking_for' from /home/jxd/.rbenv/versions/2.4.0/lib/ruby/2.4.0/mkmf.rb:1054:in `have_func' from extconf.rb:31:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/jxd/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0/thrift-0.9.3.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/jxd/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thrift-0.9.3.0 for inspection. Results logged to /home/jxd/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0/thrift-0.9.3.0/gem_make.out
An error occurred while installing thrift (0.9.3.0), and Bundler cannot continue. Make sure that `gem install thrift -v '0.9.3.0'
--source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile: event_stream was resolved to 0.0.1, which depends on
canvas_cassandra was resolved to 0.0.1, which depends on
cassandra-cql was resolved to 1.2.3, which depends on
thrift_client was resolved to 0.9.3, which depends on
thrift
I followed the directions found in the canvas-lms documentation
I tried:
~/canvas$ bundle config build.thrift --with-cppflags='-D_FORTIFY_SOURCE=0'
gem install thrift -v 0.8.0 -- --with-cppflags=\"-D_FORTIFY_SOURCE=0 -Wno-shift-negative-value\"
~/canvas$ bundle config build.eventmachine --with-cppflags=-I/usr/local/opt/openssl/include
Not work
I switch to ruby 2.5.0 (upgrade) and bundler 1.13.3 (downgrade). It works for me.
I do not understand but it works.
update....
Does bundle config build.thrift
"--with-cppflags="-Wno-compound-token-split-by-macro"" && bundle
install work? – razvans
work but with ruby 2.5.0
I try to execute
bundle i
I get an error message:
An error occurred while installing therubyracer (0.12.3), and Bundler cannot continue.
Make sure that gem install therubyracer -v '0.12.3' succeeds before bundling.
I try:
$ gem uninstall libv8
$ gem install therubyracer
And:
gem list libv8 --remote --all
gem install libv8 -v 3.16.14.19 -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/Users/MY_NAME/homebrew/opt/v8#3.15
Don't work.
I have result file gem_make.out:
current directory: /Users/MY_NAME/.rvm/gems/ruby-2.5.1/gems/therubyracer-0.12.3/ext/v8
/Users/MY_NAME/.rvm/rubies/ruby-2.5.1/bin/ruby -I /Users/MY_NAME/.rvm/rubies/ruby-
2.5.1/lib/ruby/site_ruby/2.5.0 -r ./siteconf20200814-13680-i9h23c.rb extconf.rb --with-v8-
dir\=/Users/MY_NAME/homebrew/opt/v8#3.15
checking for -lpthread... *** 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
--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=/Users/MY_NAME/.rvm/rubies/ruby-2.5.1/bin/$(RUBY_BASE_NAME)
--with-pthreadlib
--without-pthreadlib
/Users/MY_NAME/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/MY_NAME/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/mkmf.rb:541:in `try_link0'
from /Users/MY_NAME/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/mkmf.rb:559:in `try_link'
from /Users/MY_NAME/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/mkmf.rb:777:in `try_func'
from /Users/MY_NAME/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/mkmf.rb:1004:in `block in have_library'
from /Users/MY_NAME/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/mkmf.rb:947:in `block in checking_for'
from /Users/MY_NAME/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/mkmf.rb:350:in `block (2 levels) in postpone'
from /Users/MY_NAME/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/mkmf.rb:320:in `open'
from /Users/MY_NAME/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/mkmf.rb:350:in `block in postpone'
from /Users/MY_NAME/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/mkmf.rb:320:in `open'
from /Users/MY_NAME/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/mkmf.rb:346:in `postpone'
from /Users/MY_NAME/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/mkmf.rb:946:in `checking_for'
from /Users/MY_NAME/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/mkmf.rb:999:in `have_library'
from extconf.rb:3:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/MY_NAME/.rvm/gems/ruby-2.5.1/extensions/x86_64-darwin-17/2.5.0/therubyracer- 0.12.3/mkmf.log
extconf failed, exit code 1
It was helpful for me:
brew install ruby
brew upgrade ruby
xcode-select --install
I have installed Ruby and in my project file i have rmagick gem.
gem "rmagick", "2.13.2", require: "RMagick"
Ruby Version
gem "rmagick", "2.13.2", require: "RMagick"
I am getting an error while installing rmagick.
g native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/home/suganya/.rvm/rubies/ruby-2.2.5/bin/ruby -r ./siteconf20160916-13775-z6z2nl.rb extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... *** 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=/home/suganya/.rvm/rubies/ruby-2.2.5/bin/$(RUBY_BASE_NAME)
/home/suganya/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /home/suganya/.rvm/rubies/ruby- 2.2.5/lib/ruby/2.2.0/mkmf.rb:587:in `try_cpp'
from /home/suganya/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/mkmf.rb:1060:in `block in have_header'
from /home/suganya/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/mkmf.rb:911:in `block in checking_for'
from /home/suganya/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /home/suganya/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/mkmf.rb:321:in `open'
from /home/suganya/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/mkmf.rb:351:in `block in postpone'
from /home/suganya/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/mkmf.rb:321:in `open'
from /home/suganya/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/mkmf.rb:347:in `postpone'
from /home/suganya/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/mkmf.rb:910:in `checking_for'
from /home/suganya/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/mkmf.rb:1059:in `have_header'
from extconf.rb:194:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /home/suganya/.rvm/gems/ruby-2.2.5/gems/rmagick-2.13.2 for inspection.
Results logged to /home/suganya/.rvm/gems/ruby-2.2.5/extensions/x86_64-linux/2.2.0/rmagick-2.13.2/gem_make.out.
i have been working on this for past two days and I tried a lot of work arounds.
sudo apt-get install libmagickwand-dev imagemagick
But if I run just
gem install rmagick
It runs perfect installs rmagick-2.16.0
You need to run the following commands for ubuntu
sudo apt-get install libmagick++-dev
sudo apt-get install imagemagick
Then try to install
gem install rmagick
I am installing Nokogiri gem with bundle install, but its failing with below error in CentOS 6.6. I installed libxml2, libxslt also.
Building native extensions. This could take a while...
ERROR: Error installing nokogiri-1.6.6.2.gem:
ERROR: Failed to build gem native extension.
/usr/bin/ruby -r ./siteconf20160301-19713-3tkoho.rb extconf.rb
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
checking for gzdopen() in -lz... yes
checking for iconv... yes
************************************************************************
IMPORTANT NOTICE:
Building Nokogiri with a packaged version of libxml2-2.9.2
with the following patches applied:
- 0001-Revert-Missing-initialization-for-the-catalog-module.patch
- 0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch
Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:
gem install nokogiri -- --use-system-libraries
[--with-xml2-config=/path/to/xml2-config]
[--with-xslt-config=/path/to/xslt-config]
If you are using Bundler, tell it to use the option:
bundle config build.nokogiri --use-system-libraries
bundle install
Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.
************************************************************************
Extracting libxml2-2.9.2.tar.gz into tmp/x86_64-redhat-linux-gnu/ports/libxml2/2.9.2... OK
Running patch with /usr/lib64/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/ports/patches/libxml2/0001-Revert-Missing-initialization-for-the-catalog-module.patch...
Running 'patch' for libxml2 2.9.2... ERROR, review '/usr/lib64/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/ext/nokogiri/tmp/x86_64-redhat-linux-gnu/ports/libxml2/2.9.2/patch.log' to see what happened.
*** 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}/lib64
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/$(RUBY_BASE_NAME)
--help
--clean
--use-system-libraries
--enable-static
--disable-static
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib64
--enable-cross-build
--disable-cross-build
/usr/lib64/ruby/gems/2.2.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:279:in `block in execute': Failed to complete patch task (RuntimeError)
from /usr/lib64/ruby/gems/2.2.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:271:in `chdir'
from /usr/lib64/ruby/gems/2.2.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:271:in `execute'
from extconf.rb:311:in `block in patch'
from extconf.rb:308:in `each'
from extconf.rb:308:in `patch'
from /usr/lib64/ruby/gems/2.2.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:108:in `cook'
from extconf.rb:278:in `block in process_recipe'
from extconf.rb:177:in `tap'
from extconf.rb:177:in `process_recipe'
from extconf.rb:475:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /usr/lib64/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2 for inspection.
Results logged to /usr/lib64/ruby/gems/2.2.0/extensions/x86_64-linux/2.2.0/nokogiri-1.6.6.2/gem_make.out
[root#hh-rcs-push1 gemfiles]#
Fixed with installing rvm(ruby version manager).
hs-mac-air:~ zuohaisu$ sudo gem install bson_ext -v '1.9.2'
Building native extensions. This could take a while...
ERROR: Error installing bson_ext:
ERROR: Failed to build gem native extension.
/Users/zuohaisu/.rvm/rubies/ruby-1.9.3-p429/bin/ruby extconf.rb
checking for asprintf()... *** 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
--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=/Users/zuohaisu/.rvm/rubies/ruby-1.9.3-p429/bin/ruby
/Users/zuohaisu/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/zuohaisu/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:461:in `try_link0'
from /Users/zuohaisu/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:476:in `try_link'
from /Users/zuohaisu/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:619:in `try_func'
from /Users/zuohaisu/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:894:in `block in have_func'
from /Users/zuohaisu/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /Users/zuohaisu/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /Users/zuohaisu/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/zuohaisu/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /Users/zuohaisu/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/zuohaisu/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /Users/zuohaisu/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /Users/zuohaisu/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:893:in `have_func'
from extconf.rb:3:in `<main>'
Gem files will remain installed in /Users/zuohaisu/.rvm/gems/ruby-1.9.3-p429/gems/bson_ext-1.9.2 for inspection.
Results logged to /Users/zuohaisu/.rvm/gems/ruby-1.9.3-p429/gems/bson_ext-1.9.2/ext/cbson/gem_make.out
I tried to install bson_ext but always failed. can somebody help?
My rails version is 1.9.3
My Mongo shell version is 2.4.3
My rails version is 4
It is said that some libraries missing. what does that mean?
try
gem update --system
gem install bson_ext
if all else fails download the gem
http://rubygems.org/gems/bson_ext
and add it to your gemsets manually
I had the exact same issue and installed gcc to resolve, thanks for the hint by gspatel.
yum install gcc