dmayer / idb

idb is a tool to simplify some common tasks for iOS pentesting and research
MIT License
942 stars 156 forks source link

Failed to install idb - extconf failure: need libxml2 #90

Closed jmpews closed 7 years ago

jmpews commented 7 years ago
$ ruby --version
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16]
$ brew install libxml2
Warning: libxml2 is a keg-only and another version is linked to opt.
Use `brew install --force` if you want to install this version
$ bundle install
Fetching gem metadata from https://rubygems.org/........
Fetching version metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 10.4.2
Using public_suffix 2.0.5
Using awesome_print 1.7.0 (was 1.6.1)
Using bundler 1.14.6
Using byebug 9.0.6
Using coderay 1.1.0
Using ffi 1.9.18 (was 1.9.10)
Using git 1.3.0 (was 1.2.9.1)
Using tilt 2.0.7 (was 2.0.1)
Using hexdump 0.2.3
Using htmlentities 4.3.4
Using json 2.1.0 (was 1.8.3)
Using log4r 1.1.10
Using net-ssh 4.1.0 (was 3.0.1)
Using mini_portile2 2.1.0 (was 2.0.0)
Installing libxml-ruby 3.0.0 (was 2.8.0) with native extensions
Using qtbindings 4.8.6.3 (was 4.8.6.2)
Using sqlite3 1.3.13 (was 1.3.11)
Using method_source 0.8.2
Using slop 3.6.0
Using addressable 2.5.1 (was 2.4.0)
Using haml 4.0.7
Using net-sftp 2.1.2
Using nokogiri 1.7.1 (was 1.6.7.2)
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/spiderzz/.rvm/gems/ruby-2.4.0/gems/libxml-ruby-3.0.0/ext/libxml
/Users/spiderzz/.rvm/rubies/ruby-2.4.0/bin/ruby -r ./siteconf20170425-39246-cios2e.rb extconf.rb
/Users/spiderzz/.rvm/rubies/ruby-2.4.0/bin/ruby: warning: shebang line ends with \r may cause a problem
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=/Users/spiderzz/.rvm/rubies/ruby-2.4.0/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:

  /Users/spiderzz/.rvm/gems/ruby-2.4.0/extensions/x86_64-darwin-16/2.4.0/libxml-ruby-3.0.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/spiderzz/.rvm/gems/ruby-2.4.0/gems/libxml-ruby-3.0.0 for inspection.
Results logged to /Users/spiderzz/.rvm/gems/ruby-2.4.0/extensions/x86_64-darwin-16/2.4.0/libxml-ruby-3.0.0/gem_make.out

An error occurred while installing libxml-ruby (3.0.0), and Bundler cannot continue.
Make sure that `gem install libxml-ruby -v '3.0.0'` succeeds before bundling.
spiderzz at localhost in /tmp/idb (master) (normal)
jmpews commented 7 years ago
$ brew link --force libxml2
Linking /usr/local/Cellar/libxml2/2.9.4_2... 17 symlinks created

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/usr/local/opt/libxml2/bin:$PATH"' >> ~/.zshrc
spiderzz at localhost in /tmp/idb (master) (normal)
$ echo 'export PATH="/usr/local/opt/libxml2/bin:$PATH"' >> ~/.zshrc
spiderzz at localhost in /tmp/idb (master) (normal)
$ bundle install
Fetching gem metadata from https://rubygems.org/........
Fetching version metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 10.4.2
Using public_suffix 2.0.5
Using awesome_print 1.7.0 (was 1.6.1)
Using bundler 1.14.6
Using byebug 9.0.6
Using coderay 1.1.0
Using ffi 1.9.18 (was 1.9.10)
Using git 1.3.0 (was 1.2.9.1)
Using tilt 2.0.7 (was 2.0.1)
Using hexdump 0.2.3
Using htmlentities 4.3.4
Using json 2.1.0 (was 1.8.3)
Using log4r 1.1.10
Using net-ssh 4.1.0 (was 3.0.1)
Using mini_portile2 2.1.0 (was 2.0.0)
Installing libxml-ruby 3.0.0 (was 2.8.0) with native extensions
Using qtbindings 4.8.6.3 (was 4.8.6.2)
Using sqlite3 1.3.13 (was 1.3.11)
Using method_source 0.8.2
Using slop 3.6.0
Using addressable 2.5.1 (was 2.4.0)
Using haml 4.0.7
Using net-sftp 2.1.2
Using nokogiri 1.7.1 (was 1.6.7.2)
Installing libxml4r 0.2.6
Installing pry 0.10.4
Using launchy 2.4.3
Installing plist4r 1.2.2 with native extensions
Installing pry-byebug 3.4.0
Using idb 2.9.1 (was 2.9.0) from source at `.`
Bundle complete! 5 Gemfile dependencies, 30 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
spiderzz at localhost in /tmp/idb (master●) (normal)
dmayer commented 7 years ago

For future reference, this should be fixable by using the system libraries as follows:

before installing idb / doing bundle install.

Alternatively, the homebrew route also works.

Further details on troubleshooting (the very frustrating nokogiri installation) is available at http://www.nokogiri.org/tutorials/installing_nokogiri.html