sparklemotion/nokogiri

[install] Cannot install nokogiri-1.1.16.4 on termux (arm-linux-androidabi) due to tar and hardlinks

Closed this issue · 1 comments

Installing of nokogir-1.1.16.4 fails on Termux (a terminal emulator / Ubuntu-based Linux environment for Adnroid), due to libxml2 not being able to extract due to hardlink issues with tar.

Have you read and followed the installation tutorial at http://www.nokogiri.org/tutorials/installing_nokogiri.html?

  • Yes!

What is the complete output of gem install or bundle install?

ERROR:  Error installing ronin:
        ERROR: Failed to build gem native extension.
 
    current directory: /data/data/com.termux/files/usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.4/ext/nokogiri
/data/data/com.termux/files/usr/bin/ruby extconf.rb
checking for whether -std=c99 is accepted as CFLAGS... yes
checking for whether -Wno-declaration-after-statement is accepted as CFLAGS... yes
checking for whether -O2 is accepted as CFLAGS... yes
checking for whether -g is accepted as CFLAGS... yes
checking for whether -Winline is accepted as CFLAGS... yes
checking for whether -Wmissing-noreturn is accepted as CFLAGS... yes
checking for whether -Wconversion -Wno-sign-conversion is accepted as CFLAGS... yes
Building nokogiri using packaged libraries.
Static linking is enabled.
Cross build is disabled.
Using mini_portile version 2.8.6
checking for iconv... yes
---------- IMPORTANT NOTICE ----------
Building Nokogiri with a packaged version of libxml2-2.12.6.
Configuration options: --host\=arm-unknown-linux-androideabi --enable-static --disable-shared --libdir\=/data/data/com.termux/files/usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.4/ports/arm-linux-androideabi/libxml2/2.12.6/lib --with-iconv\=yes --disable-dependency-tracking --without-python --without-readline --with-c14n --with-debug --with-threads --without-tls --disable-shared --enable-static CPPFLAGS\= CFLAGS\=-O2\ -U_FORTIFY_SOURCE\ -g\ -fPIC
The following patches are being applied:
  - 0001-Remove-script-macro-support.patch
  - 0002-Update-entities-to-remove-handling-of-ssi.patch
  - 0003-libxml2.la-is-in-top_builddir.patch
  - 0009-allow-wildcard-namespaces.patch
  - 0010-update-config.guess-and-config.sub-for-libxml2.patch
  - 0011-rip-out-libxml2-s-libc_single_threaded-support.patch
 
The Nokogiri maintainers intend to provide timely security updates, but if
this is a concern for you and want to use your OS/distro system library
instead, then abort this installation process and install nokogiri as
instructed at:
 
  https://nokogiri.org/tutorials/installing_nokogiri.html#installing-using-standard-system-libraries
 
Note, however, that nokogiri cannot guarantee compatibility with every
version of libxml2 that may be provided by OS/package vendors.
 
Extracting libxml2-2.12.6.tar.xz into tmp/arm-unknown-linux-androideabi/ports/libxml2/2.12.6... ERROR. Please review logs to see what happened:
----- contents of '/data/data/com.termux/files/usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.4/ext/nokogiri/tmp/arm-unknown-linux-androideabi/ports/libxml2/2.12.6/extract.log' -----
tar: libxml2-2.12.6/test/relaxng/ambig_name-class.xml: Cannot hard link to ‘libxml2-2.12.6/test/relaxng/ambig_name-class2.rng’: Permission denied
tar: libxml2-2.12.6/test/relaxng/ambig_name-class.rng: Cannot hard link to ‘libxml2-2.12.6/test/relaxng/tutorA.rng’: Permission denied
tar: Exiting with failure status due to previous errors
----- end of file -----
*** 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
        --prevent-strip
        --enable-system-libraries
        --disable-system-libraries
        --use-system-libraries
        --enable-system-libraries
        --disable-system-libraries
        --use-system-libraries
        --enable-static
        --enable-cross-build
        --disable-cross-build
        --enable-cross-build
        --disable-cross-build
        --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-xml2-source-dir
/data/data/com.termux/files/usr/lib/ruby/gems/3.2.0/gems/mini_portile2-2.8.6/lib/mini_portile2/mini_portile.rb:612:in `block in execute': Failed to complete extract task (RuntimeError)
        from /data/data/com.termux/files/usr/lib/ruby/gems/3.2.0/gems/mini_portile2-2.8.6/lib/mini_portile2/mini_portile.rb:578:in `chdir'
        from /data/data/com.termux/files/usr/lib/ruby/gems/3.2.0/gems/mini_portile2-2.8.6/lib/mini_portile2/mini_portile.rb:578:in `execute'
        from /data/data/com.termux/files/usr/lib/ruby/gems/3.2.0/gems/mini_portile2-2.8.6/lib/mini_portile2/mini_portile.rb:564:in `extract_file'
        from /data/data/com.termux/files/usr/lib/ruby/gems/3.2.0/gems/mini_portile2-2.8.6/lib/mini_portile2/mini_portile.rb:138:in `block in extract'
        from /data/data/com.termux/files/usr/lib/ruby/gems/3.2.0/gems/mini_portile2-2.8.6/lib/mini_portile2/mini_portile.rb:136:in `each'
        from /data/data/com.termux/files/usr/lib/ruby/gems/3.2.0/gems/mini_portile2-2.8.6/lib/mini_portile2/mini_portile.rb:136:in `extract'
        from /data/data/com.termux/files/usr/lib/ruby/gems/3.2.0/gems/mini_portile2-2.8.6/lib/mini_portile2/mini_portile.rb:231:in `cook'
        from extconf.rb:540:in `block (2 levels) in process_recipe'
        from extconf.rb:319:in `chdir'
        from extconf.rb:319:in `chdir_for_build'
        from extconf.rb:540:in `block in process_recipe'
        from <internal:kernel>:90:in `tap'
        from extconf.rb:438:in `process_recipe'
        from extconf.rb:871:in `<main>'
 
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/3.2.0/extensions/arm-linux-androideabi/3.2.0/nokogiri-1.16.4/mkmf.log
 
extconf failed, exit code 1
 
Gem files will remain installed in /data/data/com.termux/files/usr/lib/ruby/gems/3.2.0/gems/nokogiri-1.16.4 for inspection.
Results logged to /data/data/com.termux/files/usr/lib/ruby/gems/3.2.0/extensions/arm-linux-androideabi/3.2.0/nokogiri-1.16.4/gem_make.out

Tell us about your system!

What is the output from ruby -v?

ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm-linux-androideabi]

What is the output from gem -v?

3.4.10

What is the output from gem env?

RubyGems Environment:
  - RUBYGEMS VERSION: 3.4.10
  - RUBY VERSION: 3.2.2 (2023-03-30 patchlevel 53) [arm-linux-androideabi]
  - INSTALLATION DIRECTORY: /data/data/com.termux/files/usr/lib/ruby/gems/3.2.0
  - USER INSTALLATION DIRECTORY: /data/data/com.termux/files/home/.local/share/gem/ruby/3.2.0
  - RUBY EXECUTABLE: /data/data/com.termux/files/usr/bin/ruby
  - GIT EXECUTABLE: /data/data/com.termux/files/usr/bin/git
  - EXECUTABLE DIRECTORY: /data/data/com.termux/files/usr/bin
  - SPEC CACHE DIRECTORY: /data/data/com.termux/files/home/.local/share/gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: ./etc
  - RUBYGEMS PLATFORMS:
     - ruby
     - arm-linux-androideabi
  - GEM PATHS:
     - /data/data/com.termux/files/usr/lib/ruby/gems/3.2.0
     - /data/data/com.termux/files/home/.local/share/gem/ruby/3.2.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => true
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
    - https://rubygems.org/
  - SHELL PATH:
    - /data/data/com.termux/files/usr/bin

If Linux or a BSD variant, please note:

  • the distro you're using: Termux
  • the output of uname -a: Linux localhost 3.18.71-perf-g552d533 #1 SMP PREEMPT Thu Aug 13 21:46:04 CST 2020 armv7l Android
  • the contents of /etc/lsb-release. I cannot find the file.

@postmodern Looks like hard links have been present in the libxml2 tarball since 2.9.10 (2019-10-30), which first appeared in Nokogiri in v1.10.5 (2019-10-31).

This may have been fixed in GNOME/libxml2@f0df3e6d? It may be worth opening an issue upstream to confirm how it's going to be packaged. There's nothing I can easily do in Nokogiri to address this.

One user commented they were able to work around this problem in #2416 (comment) by installing against system libraries with gem install nokogiri --platform=ruby -- --use-system-libraries. Hope that helps?