challenge with libxml on… of course mac os
problem:
gem install libxml-ruby -v '3.1.0' --source 'https://rubygems.org/'
Building native extensions. This could take a while...
ERROR: Error installing libxml-ruby:
ERROR: Failed to build gem native extension.
current directory: /Volumes/Accounts/rafath/.rvm/gems/ruby-2.5.3/gems/libxml-ruby-3.1.0/ext/libxml
/Volumes/Accounts/rafath/.rvm/rubies/ruby-2.5.3/bin/ruby -r ./siteconf20191122-40373-1hk8d7t.rb extconf.rb
/Volumes/Accounts/rafath/.rvm/rubies/ruby-2.5.3/bin/ruby: warning: shebang line ending with \r may cause problems
checking for libxml/xmlversion.h in /opt/include/libxml2,/opt/local/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... 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
--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=/Volumes/Accounts/rafath/.rvm/rubies/ruby-2.5.3/bin/$(RUBY_BASE_NAME)
--with-xml2-config
--without-xml2-config
--with-xml2-dir
--without-xml2-dir
--with-xml2-include
--without-xml2-include=${xml2-dir}/include
--with-xml2-lib
--without-xml2-lib=${xml2-dir}/lib
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
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Volumes/Accounts/rafath/.rvm/gems/ruby-2.5.3/extensions/x86_64-darwin-18/2.5.0/libxml-ruby-3.1.0/mkmf.log
extconf failed, exit code 1
solution:
brew install libxml2 libxslt libiconv
and
gem install libxml-ruby -v '3.1.0' -- --with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config --with-xml2-dir=/usr/local/opt/libxml2 --with-xml2-lib=/usr/local/opt/libxml2/lib --with-xml2-include=/usr/local/opt/libxml2/include
credits: https://stackoverflow.com/questions/38129330/libxml-ruby-failed-to-build-gem-native-extension

Najnowsze komentarze