LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-29-2007, 07:11 AM   #1
tramni1980
Member
 
Registered: Jul 2006
Location: Köln, Germany
Distribution: Slackware64-14.2 & -current, DragonFly BSD, OpenBSD
Posts: 819

Rep: Reputation: 55
Question 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.

Any suggestions will be appreciated.

Regards,
Martin
 
Old 03-29-2007, 09:27 AM   #2
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
do './configure --help', it should be something like

Code:
./configure --libdir=/usr/local
(or maybe '/usr/local/lib', I don't know, try both)

or maybe

Code:
LDFLAGS=/usr/local/lib

Last edited by H_TeXMeX_H; 03-29-2007 at 09:30 AM.
 
Old 03-29-2007, 10:52 AM   #3
chefkoch
LQ Newbie
 
Registered: Mar 2007
Posts: 19

Rep: Reputation: 0
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"
 
Old 03-29-2007, 11:21 AM   #4
tramni1980
Member
 
Registered: Jul 2006
Location: Köln, Germany
Distribution: Slackware64-14.2 & -current, DragonFly BSD, OpenBSD
Posts: 819

Original Poster
Rep: Reputation: 55
Quote:
Originally Posted by chefkoch
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
"echo $PKG_CONFIG_PATH" gives:
/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:/opt/kde/lib/pkgconfig:/usr/local/lib/pkgconfig:/opt/kde/lib/pkgconfig

So, /usr/lib/pkgconfig is in LD_CONFIG_PATH. It is strange, because I have not had such an issue when compiling other programs from source.
 
Old 03-29-2007, 12:18 PM   #5
tramni1980
Member
 
Registered: Jul 2006
Location: Köln, Germany
Distribution: Slackware64-14.2 & -current, DragonFly BSD, OpenBSD
Posts: 819

Original Poster
Rep: Reputation: 55
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?
 
Old 03-29-2007, 02:28 PM   #6
chefkoch
LQ Newbie
 
Registered: Mar 2007
Posts: 19

Rep: Reputation: 0
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?
 
Old 03-29-2007, 02:29 PM   #7
XGizzmo
Member
 
Registered: Mar 2007
Distribution: Slackware
Posts: 264

Rep: Reputation: 69
After you install orbit you may have to run ldonfig and let it do it's mojo.
 
Old 03-29-2007, 03:37 PM   #8
arcanex
Member
 
Registered: Mar 2007
Posts: 41

Rep: Reputation: 15
Quote:
Originally Posted by tramni1980
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.

1. "./configure LDFLAGS=-L/usr/lib"
2. "export LDFLAGS=-L/usr/lib; ./configure"

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.
 
Old 03-30-2007, 08:17 AM   #9
tramni1980
Member
 
Registered: Jul 2006
Location: Köln, Germany
Distribution: Slackware64-14.2 & -current, DragonFly BSD, OpenBSD
Posts: 819

Original Poster
Rep: Reputation: 55
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.

Regards,
Martin
 
Old 03-30-2007, 08:48 AM   #10
chefkoch
LQ Newbie
 
Registered: Mar 2007
Posts: 19

Rep: Reputation: 0
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.
 
Old 03-30-2007, 08:56 AM   #11
hussar
Member
 
Registered: Oct 2003
Location: Heidelberg, Germany
Distribution: Slackware 11.0; Kubuntu 6.06; OpenBSD 4.0; OS X 10.4.10
Posts: 345

Rep: Reputation: 30
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.)
 
Old 03-30-2007, 09:46 AM   #12
tramni1980
Member
 
Registered: Jul 2006
Location: Köln, Germany
Distribution: Slackware64-14.2 & -current, DragonFly BSD, OpenBSD
Posts: 819

Original Poster
Rep: Reputation: 55
Quote:
Originally Posted by chefkoch
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

Regards,
Martin
 
Old 03-30-2007, 10:36 AM   #13
chefkoch
LQ Newbie
 
Registered: Mar 2007
Posts: 19

Rep: Reputation: 0
/etc/ld.so.conf is only used for runtime linking.

Oh cool! didn't think of gconf.
 
Old 03-30-2007, 11:49 AM   #14
hussar
Member
 
Registered: Oct 2003
Location: Heidelberg, Germany
Distribution: Slackware 11.0; Kubuntu 6.06; OpenBSD 4.0; OS X 10.4.10
Posts: 345

Rep: Reputation: 30
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.
 
Old 03-30-2007, 02:05 PM   #15
chefkoch
LQ Newbie
 
Registered: Mar 2007
Posts: 19

Rep: Reputation: 0
Well, two option would be:

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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
error while loading shared libraries: libstdc++.so.5: cannot open shared object file: Franziss Linux - Newbie 10 06-28-2010 05:47 AM
Urgent !!! rpm: error while loading shared libraries: libelf.so.1: cannot open shared tinaa Linux - Software 5 12-02-2008 03:19 PM
error while loading shared libraries: libgvc.so.3: cannot open shared object file coolrock Slackware 6 01-17-2007 05:10 PM
telling "make" where to search for libraries tramni1980 Slackware 1 10-21-2006 11:09 AM
error while loading shared libraries: libdb-4.1.so: cannot open shared object file putquery8581 Linux - Software 1 10-01-2004 07:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration