I'm currently trying to install a ruby gem which fails because extconf says it needs libxml, so when I follow these instructions to install libxml (which includes these instructions for the ruby dev kit installation) I get the following output:
$ gem install libxml-ruby --platform x86-mswin32-60
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing libxml-ruby:
ERROR: Failed to build gem native extension.
c:/Ruby/bin/ruby.exe extconf.rb
checking for socket() in -lsocket... no
checking for gethostbyname() in -lnsl... no
checking for atan() in -lm... yes
checking for inflate() in -lz... no
checking for inflate() in -lzlib... no
checking for inflate() in -lzlib1... yes
checking for iconv_open() in -liconv... no
checking for libiconv_open() in -liconv... yes
checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -llibxml2... no
checking for xmlParseDoc() in -lxml2... no
*** 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
--8<--
--with-xml2lib
--without-xml2lib
extconf failure: need libxml2.
Install the library or try one of the following options to extconf.rb:
--with-xml2-config=/path/to/xml2-config
--with-xml2-dir=/path/to/libxml2
--with-xml2-lib=/path/to/libxml2/lib
--with-xml2-include=/path/to/libxml2/include
Gem files will remain installed in c:/Ruby/lib/ruby/gems/1.9.1/gems/libxml-ruby-2.2.2 for inspection.
Results logged to c:/Ruby/lib/ruby/gems/1.9.1/gems/libxml-ruby-2.2.2/ext/libxml/gem_make.out
I'm on a Windows 7 x64 install using my minGW32-shell/git to install. The install fails with the same message from the windows ruby-enhanced command promt.
fwiw:
$ ruby -v
ruby 1.9.2p290 (2011-07-09) [i386-mingw32]
$ git --version
git version 1.7.6.msysgit.0
$ gem -v
1.8.10
You should try the nokogiri gem instead of using libxml-ruby. It includes the precompiled libxml2 dlls as part of the installation, so you don't have to worry about building it yourself.
Nokogiri's API is different from libxml-ruby's, but I'm sure you'll find the same functionality.
If libxml-ruby is a dependency for another gem or app, you probably can't use nokogiri. What are you trying to do?
I had this as a comment, but was asked to post it as an answer for visibility:
The answer to this question solved my problem: libxml-ruby failed to load at x86_64
Try to run
yum install -y gcc ruby-devel libxml2 libxml2-devel libxslt libxslt-devel
Than it should work
try first with;
yum install -y libxml2 libxml2-devel
If libxslt needed, then
yum install -y libxslt libxslt-devel
Related
I've been trying to install an api that says to use
bundle install
rails s
But when I do bundle, I get this error:
An error occurred while installing pg (0.18.1), and Bundler cannot
continue. Make sure that `gem install pg -v '0.18.1' --source 'https://rubygems.org/'`succeeds before bundling.
But when I run that gem install command, I get this:
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.3.0/gems/pg-0.18.1/ext /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20191018-63874-el2g8s.rb extconf.rb checking for pg_config... yes Using config values from /usr/local/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** 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.
And the mkmf.log file says:
ld: warning: directory not found for option '-L/BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.Internal.sdk/usr/local/libressl/lib'
I'm not really sure where to start, as I've followed a good amount of other guides online and they either don't work or lead me to new errors.
Install brew. This will take care of any dependencies like Xcode's command line tools. Run this command in your terminal to install brew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
When brew has successfully installed, install PostgreSQL with:
brew install postgresql
Then retry:
gem install pg -v '0.18.1' --source 'https://rubygems.org/'
Please note that the gem version specified is almost five years out of date.
I found this "Zlib missing" continously when installing gems for Rails on Ruby, please let me know a solution :
Fetching nokogiri 1.10.2
Installing nokogiri 1.10.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /usr/local/lib/ruby/gems/2.6.0/gems/nokogiri-1.10.2/ext/nokogiri
/usr/local/opt/ruby/bin/ruby -I /usr/local/Cellar/ruby/2.6.2/lib/ruby/2.6.0 -r ./siteconf20190407-34092-u44l37.rb extconf.rb
checking if the C compiler accepts -I /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2... 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.4.0
checking for iconv.h... yes
checking for gzdopen() in -lz... no
zlib is missing; necessary for building libxml2
*** 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.
I also re-installed OSX 10.14 SDK header but didn't work.
It turned out that I have to manually download zlib from its site and then install it myself to make it work.
Extract the package then install as instruction :
./Configure
make
make install
It looks like a frequent error, but after 2 days, I still did not find the definite solution to this issue.
I installed Ruby 2.0.0-p451 (x64) and DevKit (DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe) from RubyInstaller for Windows. Ruby -v returns:
ruby 2.0.0p451 (2014-02-24) [x64-mingw32]
Now, I run gem install tiny_tds, which returns:
E:\>gem install tiny_tds
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing tiny_tds:
ERROR: Failed to build gem native extension.
E:/Ruby200/bin/ruby.exe extconf.rb
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... no
-----
libiconv is missing.
-----
*** 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.
Actually, the only libiconv I have on my system is E:\Ruby200\bin\libiconv-2.dll
I tried all I could find around without success, but I'm sure there is a smart answer to this. Can you please help me find it ?
Thanks a lot,
Best regards,
Fred
Can seem to get around this.
$gem install ffi
Building native extensions. This could take a while...
ERROR: Error installing ffi:
ERROR: Failed to build gem native extension.
/remote/part/usern/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi... no
checking for rb_thread_blocking_region()... yes
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
checking for ffi_prep_cif_var()... no
creating extconf.h
creating Makefile
make
libffi.gnu.mk:16: Extraneous text after `else' directive
libffi.gnu.mk:18: *** only one `else' per conditional. Stop.
Gem files will remain installed in /remote/part/usern/.rvm/gems/ruby-1.9.3-p448#myrailsapp/gems/ffi-1.9.0 for inspection.
Results logged to /remote/part/usern/.rvm/gems/ruby-1.9.3-p448#myrailsapp/gems/ffi-1.9.0/ext/ffi_c/gem_make.out
Any ideas?
try this before
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
apt-get install ruby{version}-dev
bundle install ffi
it worked for me
I had to set the gcc to 4.2 and it worked. I also changed the ffi version to 1.0.9 in Gemfile.lock.
export PATH=/opt/gcc-4.2.0/bin/:$PATH
Hi that's related with the GCC compiler i updated mine and also did the trick that Harpreet mentioned (ffi version downgrade) BUT it's not necessary ffi-1.9.3 worked just fine as well :D
in the Gemfile.lock
ffi (1.9.3)
ffi (1.9.3-x86-mingw32)
https://github.com/kennethreitz/osx-gcc-installer
click here github repo with the .pkg installer for all OS (not only MacOSX)
I am getting this error when I try to install RMagick on my machine so I can play with Scruffy graph creator:
sudo gem install rmagick
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/Users/richardjburton/.rvm/rubies/ruby-1.9.2-p290/bin/ruby 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.
Any help would be awesome! Thanks.
Looks like you installed ImageMagick using a binary distro or something else which didn't include the headers. From your /Users directory you're probably using OSX. Assuming so, install ImageMagick using either Macports or Homebrew.