2

I'm trying to compile the lib https://github.com/bjz/gl-rs.

I'm getting an error when running make:

error: linking with `cc` failed: exit code: 1
(a long list of linker args follows)
note: /usr/bin/ld: cannot find -lxml2

If I'm reading this right, the linker cannot find the lib xml2. I made sure xml2 and libxml2 are installed (via sudo apt-get install) but that's not enough.

What to do?

1
  • 2
    Did you install libxml2-dev or just libxml2? usually it is the -dev package that provides the libraries and headers required for building May 23, 2014 at 11:43

2 Answers 2

4

In the Ubuntu packaging system, the libXXX packages often only contain the runtime libraries necessary for running applications that dynamically link the library.

In order to get the libraries and header files necessary for compiling and building, there is usually a separate libXXX-dev package (-dev indicating that the packages are for development). You can check what development packages are available for a particular library using the apt-cache search engine e.g.

apt-cache search devel | grep libxml2

In your case, you are probably missing the libxml2-dev package.

0

I found this helpful to find the package:

sudo yum provides /usr/lib64/libxml2.a

and this to install it:

sudo yum install libxml2-static

(I'm aware you are using apt, but I came across this post while looking for solution using yum)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .