tjp
Posts: 10
Joined: Fri Apr 07, 2017 3:50 pm

missing X libraries

Thu Apr 04, 2019 2:34 am

Trying to build fltk examples I get the following errors.

/usr/bin/ld: cannot find -lXrender
/usr/bin/ld: cannot find -lXcursor
/usr/bin/ld: cannot find -lXft
/usr/bin/ld: cannot find -lfontconfig
/usr/bin/ld: cannot find -lXinerama

I ran
sudo apt-get install libx11-dev
and get they are up to date.

What do I need to do to get these libraries?

tjp

LdB
Posts: 1143
Joined: Wed Dec 07, 2016 2:29 pm

Re: missing X libraries

Thu Apr 04, 2019 5:04 am

You don't have the library path set or the permission are not correct, so basically it is looking for a .so or .a library file and it can't find them.

On the ld command line add --verbose at the end (careful there are two minus signs).

It will tell you where it is looking for and failed so you will get something like
attempt to open /usr/xlib/Xrender.so failed

Find the file and change and add a -L directive on the ld command line
-L<actual path the file exists at>

swampdog
Posts: 196
Joined: Fri Dec 04, 2015 11:22 am

Re: missing X libraries

Thu Apr 04, 2019 4:18 pm

A couple of useful tools when coding..

$sudo apt-get install mlocate apt-file

The first allows you to "sudo updatedb" then "man locate" to find files present on your system. The latter "sudo apt-file update" (do it after an "apt-get update") updates a database of every file in every package.

eg:
$ apt-file search libXrender
libxrender-dev: /usr/lib/arm-linux-gnueabihf/libXrender.a
libxrender-dev: /usr/lib/arm-linux-gnueabihf/libXrender.so
libxrender-dev: /usr/share/doc/libxrender-dev/libXrender.txt.gz
libxrender1: /usr/lib/arm-linux-gnueabihf/libXrender.so.1
libxrender1: /usr/lib/arm-linux-gnueabihf/libXrender.so.1.3.0
libxrender1-dbg: /usr/lib/debug/usr/lib/arm-linux-gnueabihf/libXrender.so.1.3.0
^^^hmm..

$ dpkg -l | grep -i libxrender | grep dev
ii libxrender-dev:armhf 1:0.9.8-1 armhf X Rendering Extension client library (development files)
^^^bet this is missing.

$sudo updatedb
$ locate -i libxrender | egrep "\.so"
/usr/lib/arm-linux-gnueabihf/libXrender.so
/usr/lib/arm-linux-gnueabihf/libXrender.so.1
/usr/lib/arm-linux-gnueabihf/libXrender.so.1.3.0
^^^confirms the above so "apt-get install libxrender-dev".

Repeat for the other missing libs.

Return to “C/C++”