Sample Header Ad - 728x90

Ruby GEM nokogiri does not build on Rocky 9 Linux due to missing XML libraries even though packages are installed

0 votes
0 answers
37 views
I have a Rocky 9 host with multiple versions of Ruby installed using rbenv. # rbenv versions * system (set by /usr/local/rbenv/version) 2.4.1 2.7.1 2.7.6 The *system version of Ruby is 3.0.7p220. As part of my deployment of a Ruby (2.4.1) on Rails app, I can see the following errors when attempting to build and install nokogiri defined in a Gemfile: checking if the C compiler accepts ... no Building nokogiri using system libraries. pkg-config could not be used to find libxml-2.0 Please install either pkg-config or the pkg-config gem per gem install pkg-config -v "~> 1.1.7" pkg-config could not be used to find libxslt Please install either pkg-config or the pkg-config gem per gem install pkg-config -v "~> 1.1.7" pkg-config could not be used to find libexslt Please install either pkg-config or the pkg-config gem per gem install pkg-config -v "~> 1.1.7" ERROR: cannot discover where libxml2 is located on your system. please make sure pkg-config is installed. *** extconf.rb failed *** However, if I run the following, I can see the first 3 libraries are installed. # pkg-config --exists libxml-2.0 && echo "Package exists" || echo "Package not found" Package exists # pkg-config --exists libxslt && echo "Package exists" || echo "Package not found" Package exists # pkg-config --exists libexslt && echo "Package exists" || echo "Package not found" Package exists pkg-config does seem to find libxml2: # pkg-config --exists libxml2 && echo "Package exists" || echo "Package not found" Package not found The packages already installed are: # rpm -qa libxml2-devel libxslt-devel libxml2 libxml2-2.9.13-6.el9_5.2.x86_64 libxml2-devel-2.9.13-6.el9_5.2.x86_64 libxslt-devel-1.1.34-9.el9_5.1.x86_64 Any idea what I am missing?
Asked by Confounder (131 rep)
Mar 28, 2025, 05:30 PM
Last activity: Mar 28, 2025, 11:40 PM