Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

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.
{"cc_re__cc_re__cc_by_sa_3_0": ["sites in the Stack Exchange network\">Area 51</a></li>\r\n                        <li><a href=\"//careers.stackoverflow.com?utm_source=stackoverflow.com&amp;utm_medium=site-ui&amp;utm_campaign=footerlink\">Stack Overflow Careers</a></li>\r\n                    \r\n                </ol>\r\n            </td>\r\n    </tr>\r\n</table>\r\n                </div>\r\n            </div>\r\n\r\n            <div id=\"copyright\">\r\n                site design / logo &#169; 2014 stack exchange inc; user contributions licensed under <a href=\"http://creativecommons.org/licenses/by-sa/3.0/\" rel=\"license\">cc by-sa 3.0</a>                   with <a href=\"http://blog.stackoverflow.com/2009/06/attribution-required/\" rel=\"license\">attribution required</a>\r\n            </div>\r\n            <div id=\"svnrev\">\r\n                rev 2014.12.20.2132\r\n            </div>\r\n                <div id=\"additional-notices\">\r\n                    Linux is a registered trademark of Linus Torvalds. UNIX is a registered trademark of The Open Group. <br>This site is not affiliated with Linus Torvalds or The Open Group in a"], "copyright__copyright__copyright": ["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).\n\nFor ld, GCC (or clang, and possibly quite a few other compilers), you do that with the -L flag.\n\nshare|improve this answer\n\nYour Answer\n\n\u00a0\ndiscard\n\nBy posting your answer, you agree to the privacy policy and terms of service.\n\nNot the answer you're looking for? Browse other questions tagged or ask your own question."]}