Nokogiri for ruby

Hello,

is there a package available for nokogiri (ruby extension). If so, which package must be installed.

Regards lorglas

It built pretty easily for me on x86_64 once I had the proper development packages installed.

$ pkgman install ruby_devel libxml2_devel libxslt_devel
$ gem install nokogiri --user-install -- --use-system-libraries

The nokogiri command will end up installed as ~/.gem/ruby/2.7.0/bin/nokogiri

i have type this in the terminal after installing ruby devel package:
gem install nokogiri
Fetching nokogiri-1.13.1.gem
Fetching mini_portile2-2.7.1.gem
ERROR: While executing gem … (Gem::FilePermissionError)
You don’t have write permissions for the /boot/system/lib/x86/ruby/gems/2.7.0 directory.

How do you solve this, is a read-only file system?

This is a problem with the haikuports package. You can work around it with the --user-install argument which will put the files in your home directory instead.

gem install nokogiri --user-install -- --use-system-libraries

Hi, next problem. Maybe is only 32bit problem.

Directory /boot/home/.gem/ruby/2.7.0/bin is created.

gem install nokogiri --user-install – --use-system-libraries
WARNING: You don’t have /boot/home/.gem/ruby/2.7.0/bin in your PATH,
gem executables will not run.
Building native extensions with: ‘–use-system-libraries’
This could take a while…
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.

current directory: /boot/home/.gem/ruby/2.7.0/gems/nokogiri-1.13.1/ext/nokogiri

/boot/system/bin/ruby -I /boot/system/lib/x86/ruby/2.7.0 -r ./siteconf20220116-3431-1xnly7g.rb extconf.rb --use-system-libraries
checking for whether -std=c99 is accepted as CFLAGS… *** 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/x86
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=/boot/system/bin/$(RUBY_BASE_NAME)
–help
–clean
–prevent-strip
/boot/system/lib/x86/ruby/2.7.0/mkmf.rb:471:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /boot/system/lib/x86/ruby/2.7.0/mkmf.rb:597:in block in try_compile’
from /boot/system/lib/x86/ruby/2.7.0/mkmf.rb:544:in with_werror' from /boot/system/lib/x86/ruby/2.7.0/mkmf.rb:597:in try_compile’
from /boot/system/lib/x86/ruby/2.7.0/mkmf.rb:661:in try_cflags' from /boot/system/lib/x86/ruby/2.7.0/mkmf.rb:667:in block (2 levels) in append_cflags’
from /boot/system/lib/x86/ruby/2.7.0/mkmf.rb:971:in block in checking_for' from /boot/system/lib/x86/ruby/2.7.0/mkmf.rb:361:in block (2 levels) in postpone’
from /boot/system/lib/x86/ruby/2.7.0/mkmf.rb:331:in open' from /boot/system/lib/x86/ruby/2.7.0/mkmf.rb:361:in block in postpone’
from /boot/system/lib/x86/ruby/2.7.0/mkmf.rb:331:in open' from /boot/system/lib/x86/ruby/2.7.0/mkmf.rb:357:in postpone’
from /boot/system/lib/x86/ruby/2.7.0/mkmf.rb:970:in checking_for' from /boot/system/lib/x86/ruby/2.7.0/mkmf.rb:666:in block in append_cflags’
from /boot/system/lib/x86/ruby/2.7.0/mkmf.rb:665:in each' from /boot/system/lib/x86/ruby/2.7.0/mkmf.rb:665:in append_cflags’
from extconf.rb:603:in `’

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

/boot/home/.gem/ruby/2.7.0/extensions/x86-unknown/2.7.0/nokogiri-1.13.1/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /boot/home/.gem/ruby/2.7.0/gems/nokogiri-1.13.1 for inspection.
Results logged to /boot/home/.gem/ruby/2.7.0/extensions/x86-unknown/2.7.0/nokogiri-1.13.1/gem_make.out

My guess is that you need to run setarch x86 before running the gem command.

[x86] ~/.gem> gem install nokogiri --user-install -- --use-system-libraries
WARNING:  You don't have /boot/home/.gem/ruby/2.7.0/bin in your PATH,
          gem executables will not run.
Building native extensions with: '--use-system-libraries'
This could take a while...
ERROR:  Error installing nokogiri:
        ERROR: Failed to build gem native extension.

    current directory: /boot/home/.gem/ruby/2.7.0/gems/nokogiri-1.13.1/ext/nokogiri
/boot/system/bin/ruby -I /boot/system/lib/x86/ruby/2.7.0 -r ./siteconf20220116-3700-jtlfzp.rb extconf.rb --use-system-libraries
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 -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
Building nokogiri using system libraries.
checking for gzdopen() in -lz... yes
checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -llibxml2... no
checking for libxml-2.0 using `pkg_config`... yes: ["-I/packages/libxml2-2.9.12-1/.self/develop/headers/libxml2 ", "-L/packages/libxml2-2.9.12-1/.self/develop/lib", "-lxml2"]
checking for xmlParseDoc() in -lxml2... yes
checking for xsltParseStylesheetDoc() in -lxslt... no
checking for xsltParseStylesheetDoc() in -llibxslt... no
checking for libxslt using `pkg_config`... no
Please install either the `pkg-config` utility or the `pkg-config` rubygem.
checking for xsltParseStylesheetDoc() in -lxslt... no
checking for xsltParseStylesheetDoc() in -llibxslt... no
-----
extconf.rb:273:in `ensure_package_configuration'
extconf.rb:636:in `<main>'
xslt is missing. Please locate mkmf.log to investigate how it is failing.
-----
*** 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.

I booted a 32bit VM and tested it. It works with…

$ pkgman install ruby_x86_devel libxml2_x86_devel libxslt_x86_devel pkgconfig_x86
$ setarch x86
$ gem install nokogiri --user-install -- --use-system-libraries
1 Like

Yeah, it’s working. Two package wasn’t installed before. that was the problem. Thank you.

2 Likes