nanobox-io / nanobox-engine-ruby

Engine for running Ruby apps on Nanobox
https://nanobox.io
MIT License
10 stars 9 forks source link

ruby 2.0 missing libxml2 #21

Closed jedgalbraith closed 7 years ago

jedgalbraith commented 7 years ago

libxml2 is a dependency of nokogiri. When I bundle install with ruby 2.0 I get:

Installing nokogiri 1.5.11 with native extensions

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /data/bin/ruby extconf.rb
checking for libxml/parser.h... no
-----
libxml2 is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
*** 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=/data/bin/ruby
    --with-zlib-dir
    --without-zlib-dir
    --with-zlib-include
    --without-zlib-include=${zlib-dir}/include
    --with-zlib-lib
    --without-zlib-lib=${zlib-dir}/lib
    --with-iconv-dir
    --without-iconv-dir
    --with-iconv-include
    --without-iconv-include=${iconv-dir}/include
    --with-iconv-lib
    --without-iconv-lib=${iconv-dir}/lib
    --with-xml2-dir
    --without-xml2-dir
    --with-xml2-include
    --without-xml2-include=${xml2-dir}/include
    --with-xml2-lib
    --without-xml2-lib=${xml2-dir}/lib
    --with-xslt-dir
    --without-xslt-dir
    --with-xslt-include
    --without-xslt-include=${xslt-dir}/include
    --with-xslt-lib
    --without-xslt-lib=${xslt-dir}/lib
    --with-libxslt-config
    --without-libxslt-config
    --with-pkg-config
    --without-pkg-config
    --with-libxml-2.0-config
    --without-libxml-2.0-config
    --with-pkg-config
    --without-pkg-config
    --with-libiconv-config
    --without-libiconv-config
    --with-pkg-config
    --without-pkg-config
jedgalbraith commented 7 years ago

Actually this error occurs with all versions of ruby, not just 2.0. But, upgrading nokogiri to 1.7.0.1 seems to have fixed the problem, so not sure if this is something we need to change about the engine or not.

tylerflint commented 7 years ago

Yeah, looks like this issue is that libxml-ruby doesn't know where to find the libxml libraries. I had to do this to get it to work:

bundle config build.libxml-ruby --with-xml2-include=/data/include/libxml2

@notxarb any thoughts on how this could be addressed?

jedgalbraith commented 7 years ago

Noting that this is still an issue. Just ran into it with libxml-ruby. Running the bundle config like @tylerflint suggested, was a sufficient workaround for now.

$ bundle install
Fetching gem metadata from https://rubygems.org/........
Fetching version metadata from https://rubygems.org/.
Using rake 12.0.0
Using coderay 1.1.1
Using multipart-post 2.0.0
Using json 2.0.3
Installing libxml-ruby 2.9.0 with native extensions
Using method_source 0.8.2
Using net-http-persistent 2.9.4
Using slop 3.6.0
Using puma 3.7.0
Using rack 1.6.5
Using redcarpet 3.4.0
Using ruby-hmac 0.4.0
Using tilt 2.0.6
Using bundler 1.14.6
Using faraday 0.11.0
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /app/vendor/bundle/ruby/2.3.0/gems/libxml-ruby-2.9.0/ext/libxml
/data/bin/ruby -r ./siteconf20170501-200-18fr6go.rb extconf.rb
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
    --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=/data/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:

  /app/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/libxml-ruby-2.9.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /app/vendor/bundle/ruby/2.3.0/gems/libxml-ruby-2.9.0 for inspection.
Results logged to /app/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/libxml-ruby-2.9.0/gem_make.out

An error occurred while installing libxml-ruby (2.9.0), and Bundler cannot continue.
Make sure that `gem install libxml-ruby -v '2.9.0'` succeeds before bundling.
notxarb commented 7 years ago

can you try setting your engine to ruby#bugfix/libxml2

jedgalbraith commented 7 years ago

That seems to work. Thanks!

FYI. To ensure I did a valid test, I did the following:

notxarb commented 7 years ago

fixed with #24