Nokogiri: error while install nokogiri if it is bug?

Created on 21 Mar 2018  路  4Comments  路  Source: sparklemotion/nokogiri

nokogiri
$ gem install nokogiri -v '1.8.1'
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.

current directory: /data/data/com.termux/files/usr/lib/ruby/gems/2.4.0/gems/nokogiri-1.8.1/ext/nokogiri

/data/data/com.termux/files/usr/bin/ruby -r ./siteconf20180321-17251-19cbx2h.rb extconf.rb
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
Using mini_portile version 2.3.0
Static linking is disabled.
checking for gzdopen() in -lz... yes
checking for iconv... yes


IMPORTANT NOTICE:

Building Nokogiri with a packaged version of libxml2-2.9.5.

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.5.tar.gz into tmp/arm-linux-androideabi/ports/libxml2/2.9.5... OK
Running 'configure' for libxml2 2.9.5... OK
Running 'compile' for libxml2 2.9.5... * 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/data/com.termux/files/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}/lib
--enable-cross-build
--disable-cross-build
/data/data/com.termux/files/usr/lib/ruby/gems/2.4.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:380:in spawn': No such file or directory - make (Errno::ENOENT) from /data/data/com.termux/files/usr/lib/ruby/gems/2.4.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:380:inblock in execute'
from /data/data/com.termux/files/usr/lib/ruby/gems/2.4.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:373:in chdir' from /data/data/com.termux/files/usr/lib/ruby/gems/2.4.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:373:inexecute'
from /data/data/com.termux/files/usr/lib/ruby/gems/2.4.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:115:in compile' from /data/data/com.termux/files/usr/lib/ruby/gems/2.4.0/gems/mini_portile2-2.3.0/lib/mini_portile2/mini_portile.rb:154:incook'
from extconf.rb:365:in block (2 levels) in process_recipe' from extconf.rb:257:inblock in chdir_for_build'
from extconf.rb:256:in chdir' from extconf.rb:256:inchdir_for_build'
from extconf.rb:364:in block in process_recipe' from extconf.rb:262:intap'
from extconf.rb:262:in process_recipe' from extconf.rb:548:in

'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

/data/data/com.termux/files/usr/lib/ruby/gems/2.4.0/extensions/arm-linux/2.4.0/nokogiri-1.8.1/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /data/data/com.termux/files/usr/lib/ruby/gems/2.4.0/gems/nokogiri-1.8.1 for inspection.
Results logged to /data/data/com.termux/files/usr/lib/ruby/gems/2.4.0/extensions/arm-linux/2.4.0/nokogiri-1.8.1/gem_make.out

iam useing termux

Most helpful comment

Due to the uncommon shell path in termux, nokogiri doesn't install with bundled libxml2/libxslt libraries. However it should build with system libraries like so:

apt install libxslt-dev
gem install nokogiri -- --use-system-libraries

All 4 comments

Due to the uncommon shell path in termux, nokogiri doesn't install with bundled libxml2/libxslt libraries. However it should build with system libraries like so:

apt install libxslt-dev
gem install nokogiri -- --use-system-libraries

@larskanis can you explain a bit more about the root cause? I'm not sure I understand.

@flavorjones Termux is a Linux environment on non-rooted Android. Due to the system permissions it can not provide usual /bin or /usr/bin files. Therefore almost all shebang lines don't work. In mini_portile we use the shebang line on all OS except Windows. That's why it fails to configure libxml2.

Actually the second bug report #1742 fails on ./configure while this one fails at the make step. I can reproduce only failing ./configure.

Beside the solution above of using system libraries, we could either respect the $SHELL variable or use termux-fix-shebang as recommended by termux docs.

@Muhaiminkp I'm going to close this issue. I'm open to a PR that address the underlying issue; but I think the workaround mentioned by @larskanis above is enough to get nokogiri installed for you (using system libraries).

For more information, please see a few of these related issues:

Was this page helpful?
0 / 5 - 0 ratings