Thomas Stets
Thomas Stets

Reputation: 3043

ld unable to find librrd under Raspbian

I try to use the rrdtools library in a C program under Raspbian (The Debian variant for the Raspberry Pi). The linker keeps complaining that it can not find the rrd library:

tos@pi ~/work/reader $ gcc -o reader -lwiringPi -lrrd *.c                     
/usr/bin/ld: cannot find -lrrd                                                          
collect2: ld returned 1 exit status

The library seems to be where it should be:

tos@pi ~/work/reader $ ll /usr/lib/librrd.*
lrwxrwxrwx 1 root root     15 Sep  4  2012 /usr/lib/librrd.so.4 -> librrd.so.4.2.0
-rw-r--r-- 1 root root 327224 Sep  4  2012 /usr/lib/librrd.so.4.2.0

I also link the wiringPi library, which it finds without problems:

tos@pi ~/work/reader $ ll /usr/lib/libwiring*
lrwxrwxrwx 1 root root 36 Sep 25 14:50 /usr/lib/libwiringPiDev.so -> /usr/local/lib/libwiringPiDev.so.2.0
lrwxrwxrwx 1 root root 33 Sep 25 14:50 /usr/lib/libwiringPi.so -> /usr/local/lib/libwiringPi.so.2.0

ldconfig -v shows librrd, and the library seems to be for the correct architecture (arm). Is there anything else I am missing?

Upvotes: 1

Views: 307

Answers (1)

Santosh A
Santosh A

Reputation: 5361

Create a softlink in the /usr/lib folder with the library number to the actual version of the library installed. Like

$ ln -s librrd.so.4.2.0 /usr/lib/librrd.so

In general

$ ln -s Library_name.version.so Library_name.so

This issue is because that the linker would try to identify the library shared object files by the absolute name. If ld is unable to find, then it would throw errors like this.

Upvotes: 2

Related Questions