Cannot find -llibxml2

Ran into an error: cannot find -llibxml2 on AL 8.7'. I'm trying a bundle install` and this tosses an error. I can’t run a ruby script without this.

Installing libxml-ruby 4.0.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

# log:
/usr/bin/ld: cannot find -llibxml2
collect2: error: ld returned 1 exit status

How can I get this properly installed?

looks like you want the libraries, so:

dnf install libxml2-devel

1 Like

That is a bit unusual. Usually build-scripts tell linker to seek libXXX.so with parameter -lXXX, but here the parameter is -llibXXX. That is, the “lib” prefix and “.so” suffix could both be implicit.

Regardless, the linker cannot find file libxml2.so. Which package does have such file?

dnf provides */libxml2.so

That command tells that package libxml2-devel.x86_64 has file /usr/lib64/libxml2.so.
Therefore, the dnf install libxml2-devel does indeed put the file into our system.

One must however ask whether a source build is really necessary?

The dnf list \*ruby\* shows multiple “rubygem” packages. None of them provides what this script requires?

The dnf module list ruby shows multiple streams. They might not all contain same set of packages; other version could have more.

This worked. Thank you.

1 Like