Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am attempting to install the protobuf library on a Redhat system (Amazon EC2's Linux build). I ran configure, make, and make install without a problem, and the .so libraries were copied over to /usr/local/lib. Since Redhat doesn't include the /usr/local/lib directory in /etc/ld.so.conf, I added it, and then ran ldconfig to update the linkages.

My problem is that, for whatever reason, ldconfig isn't picking up libprotobuf.so, even though it is in the /usr/local/lib directory.

Here is the output of ls -l /usr/local/lib:

total 61336
-rw-r--r-- 1 root root 17654940 Mar 26 02:39 libprotobuf.a
-rwxr-xr-x 1 root root      994 Mar 26 02:39 libprotobuf.la
-rw-r--r-- 1 root root  1948106 Mar 26 02:39 libprotobuf-lite.a
-rwxr-xr-x 1 root root     1029 Mar 26 02:39 libprotobuf-lite.la
lrwxrwxrwx 1 root root       25 Mar 26 02:39 libprotobuf-lite.so -> libprotobuf-lite.so.7.0.0
lrwxrwxrwx 1 root root       25 Mar 26 02:39 libprotobuf-lite.so.7 -> libprotobuf-lite.so.7.0.0
-rwxr-xr-x 1 root root   893083 Mar 26 02:39 libprotobuf-lite.so.7.0.0
lrwxrwxrwx 1 root root       20 Mar 26 02:39 libprotobuf.so -> libprotobuf.so.7.0.0
lrwxrwxrwx 1 root root       20 Mar 26 02:39 libprotobuf.so.7 -> libprotobuf.so.7.0.0
-rwxr-xr-x 1 root root  7326093 Mar 26 02:39 libprotobuf.so.7.0.0
-rw-r--r-- 1 root root 25883264 Mar 26 02:39 libprotoc.a
-rwxr-xr-x 1 root root     1010 Mar 26 02:39 libprotoc.la
lrwxrwxrwx 1 root root       18 Mar 26 02:39 libprotoc.so -> libprotoc.so.7.0.0
lrwxrwxrwx 1 root root       18 Mar 26 02:39 libprotoc.so.7 -> libprotoc.so.7.0.0
-rwxr-xr-x 1 root root  9071740 Mar 26 02:39 libprotoc.so.7.0.0
drwxr-xr-x 2 root root     4096 Mar 26 02:39 pkgconfig

Here is the output of ldconfig -v | grep protobuf:

libprotobuf.so.7 -> libprotobuf.so.7.0.0
libprotobuf-lite.so.7 -> libprotobuf-lite.so.7.0.0

What do I have to do to get libprotobuf recognized by the linker?

Edit: When I try to link the library directly, I get this error:

ldconfig: Ignored file /usr/local/lib/libprotobuf.so since it is not a regular file.

I tried copying libprotobuf.so.7.0.0 over libprotobuf.so so that it is no longer a symlink, which fixed the error, but my linker still can't find libprotobuf.

share|improve this question
up vote 1 down vote accepted

ld.so.conf is only used by the runtime dynamic linker. ld doesn't us that at all - you need to pass /usr/local/lib as a linker search directory (either directly to ld if you're calling it directly, or via your compiler).

For ld, GCC (or clang, and possibly quite a few other compilers), you do that with the -L flag.

share|improve this answer
You're right; I was barking up the wrong tree. My problem was as trivial as it gets -- I was passing -Llibprotobuf to GCC instead of -Lprotobuf. Thanks! – Kai Mar 27 '12 at 11:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.