how to tell make where to search for shared libraries?
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
how to tell make where to search for shared libraries?
Hello!
I have to ask a rather newbish question, but I hope to learn something useful . So my question is: when compiling programs from source, how to tell make where the shared libraries it needs are? For instance I recently compiled and installed graphviz, but its make looked for ORbit2 in /usr/local/lib, instead of /usr/lib. So I had to compile ORbit2 with prefix /usr/local in order to be able to compile graphviz. I believe there is a better solution to such an issue.
Normally those things are detected via pkg-config these days. So it should be enough to set PKG_CONFIG_PATH to wherever you have orbit installed and run configure eg: if in /usr/, /usr/lib/pkgconfig
and via LDFLAGS that'd have to be LDFLAGS="-L /usr/lib"
Normally those things are detected via pkg-config these days. So it should be enough to set PKG_CONFIG_PATH to wherever you have orbit installed and run configure eg: if in /usr/, /usr/lib/pkgconfig
So I uninstalled the orbit2 package, compiled with prefix=/usr/local, and
then tried all the suggestions, but in vain. The result is inevitably this:
grep: /usr/local/lib/libORBit-2.la: No such file or directory
/usr/bin/sed: can't read /usr/local/lib/libORBit-2.la: No such file or directory
libtool: link: `/usr/local/lib/libORBit-2.la' is not a valid libtool archive
I tried
LDFLAGS="-L /usr/lib" ./configure
LDFLAGS=/usr/lib ./configure
./configure --libdir=/usr/lib
I've looked at the configure script.. it's actually looking for libgnomeui. Which has orbit as dependency. So make sure that you have that installed too if you've only moved orbit, that could cause this problem.
Does the toplevel Makefile contain the string "/usr/local/lib/libORBit-2.la" somewhere? if so in which variable definition?
So I uninstalled the orbit2 package, compiled with prefix=/usr/local, and
then tried all the suggestions, but in vain. The result is inevitably this:
grep: /usr/local/lib/libORBit-2.la: No such file or directory
/usr/bin/sed: can't read /usr/local/lib/libORBit-2.la: No such file or directory
libtool: link: `/usr/local/lib/libORBit-2.la' is not a valid libtool archive
I tried
LDFLAGS="-L /usr/lib" ./configure
LDFLAGS=/usr/lib ./configure
./configure --libdir=/usr/lib
Any ideas?
Hmm... so you installed Orbit into '/usr/local', and it's still not finding it? Make sure the file it's trying to look for is actually there.
LDFLAGS should be set as either of the below (the second is the more "general" way, the first is acceptable by the configure script). Notice there's no space between -L and the path.
Check the line before the error messages as well. That tells you what make is trying to execute and tell you if it's even reading LDFLAGS right (you should see your -L/usr/lib next to gcc or ld commands for example), and looking at the right paths.
Hello!
Thank you very much for your responsiveness. First, I have to clarify that after I install the version of ORbit2, compiled with prefix /usr/local, I compile graphviz compile ok. But with only the version of ORbit, compiled with prefix /usr/, the make command of graphviz complains about missing libORbit-2.la, although libORbit-2.la is actually present, but in /usr/lib, not in /usr/local/lib. The error message is:
creating libgvplugin_gtk_C.la
(cd .libs && rm -f libgvplugin_gtk_C.la && ln -s ../libgvplugin_gtk_C.la libgvplugin_gtk_C.la)
/bin/sh ../../libtool --tag=CC --mode=link gcc -g -O2 -Wno-unused-parameter -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wall -ffast-math -L/usr/lib -o libgvplugin_gtk.la -rpath /usr/lib/graphviz -version-info 3:0:0 -no-undefined gvplugin_gtk.lo gvdevice_gtk.lo support.lo interface.lo callbacks.lo -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 -pthread -L/usr/X11/lib -lgnomeui-2 -lSM -lICE -lbonoboui-2 -lgnome-keyring -lxml2 -lz -lgnomecanvas-2 -lgnome-2 -lpopt -lart_lgpl_2 -lpangoft2-1.0 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgnomevfs-2 -lbonobo-2 -lgconf-2 -lbonobo-activation -lgmodule-2.0 -ldl -lORBit-2 -lgthread-2.0 -lgobject-2.0 -lglib-2.0
grep: /usr/local/lib/libORBit-2.la: No such file or directory
/usr/bin/sed: can't read /usr/local/lib/libORBit-2.la: No such file or directory
libtool: link: `/usr/local/lib/libORBit-2.la' is not a valid libtool archive
make[3]: *** [libgvplugin_gtk.la] Error 1
This message appears no matter whether I have called configure as:
./configure LDFLAGS=-L/usr/lib --prefix=/usr
or the usual way:
./configure --prefix=/usr
By the way, I do have libgnomeui (libgnomeui-2.14.1-i486-1frg) on my system, which is compiled with prefix /usr. Could libgnomeui somehow induce search for ORbit2 in /usr/local?
The string "/usr/local/lib/libORBit-2.la" is not present in any file in the graphviz source directory.
Yeah, it probably gets that from one of the *.la files in /usr/lib/, probably libgnome-2.la. Installing the frg version of orbit isn't an option? That would be the cleanest way to sort this out.
The other way would be to edit /usr/lib/libgnome-2.la (it's just a text file) to point to your selfbuilt orbit.
Distribution: Slackware 11.0; Kubuntu 6.06; OpenBSD 4.0; OS X 10.4.10
Posts: 345
Rep:
Edit /etc/ld.so.conf to add /usr/local/lib and /usr/lib and maybe even /usr/X11/lib to the list of locations ldconfig looks in to find library files. Then run ldconfig. (Actually, I strongly suspect that the latter two are already listed.)
The other way would be to edit /usr/lib/libgnome-2.la (it's just a text file) to point to your selfbuilt orbit.
Adding /usr/lib to /etc/ld.so.conf did not work. However, in /usr/lib I issued:
grep -R '/usr/local/lib/libORBit-2.la' *.la
and it turned out that the path for ORbit in /usr/local is contained in the file libgconf-2.la. The line was:
libgconf-2.la:dependency_libs=' -L/usr/local/lib /usr/lib/libgobject-2.0.la /usr/local/lib/libORBit-2.la /usr/lib/libgmodule-2.0.la /usr/lib/libgobject-2.0.la /usr/lib/libgthread-2.0.la -lm /usr/lib/libgmodule-2.0.la -ldl /usr/lib/libgthread-2.0.la -lpthread /usr/lib/libglib-2.0.la /usr/lib/libglib-2.0.la'
and I just edited it to:
libgconf-2.la:dependency_libs=' -L/usr/lib
/usr/lib/libgobject-2.0.la /usr/lib/libORBit-2.la /usr/lib/libgmodule-2.0.la /usr/lib/libgobject-2.0.la /usr/lib/libgthread-2.0.la -lm /usr/lib/libgmodule-2.0.la -ldl /usr/lib/libgthread-2.0.la -lpthread /usr/lib/libglib-2.0.la /usr/lib/libglib-2.0.la'
Now graphviz compiles without complaints . I really did not know that dependencies are described that way. thank you very much for your helpful clues
Distribution: Slackware 11.0; Kubuntu 6.06; OpenBSD 4.0; OS X 10.4.10
Posts: 345
Rep:
Quote:
Originally Posted by chefkoch
/etc/ld.so.conf is only used for runtime linking.
According to the ldconfig manpage, ldconfig uses /etc/ld.so.conf to build the cache that is used by the run-time linker.
But, if that cache is only used during runtime and not during compiling, then I will have to come up with another hypothesis of what was actually going on the last time an app I was compiling complained of a missing library dependency and after I installed the missing library continued to refuse to see the newly installed library until I ran ldconfig.
If it complained during configure, it probably tried to run a test program which was linked to that newly installed library and wasn't yet cached.
If it was during the build, make possibly ran a program that was linked to that library.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.