Shared Libraries : library paths ??

Shared Libraries : library paths ??

Post by john.maxim » Tue, 07 Jun 2005 21:56:38


Hi,
I have downloaded some package. i used ./configure, make and make
install.

my friend has told me that the libraries created will have library
paths embedded in them. ie programs will work only if the libraries
are at specific places. in this case my home directory. is it true.

how to avoid it.


I also saw while compiling a line which states:

Checking how to hardcode library paths into programs ... immediate


what does this mean ?.


Regards,
/J
 
 
 

Shared Libraries : library paths ??

Post by Phil Endec » Wed, 08 Jun 2005 00:03:01


I suggest looking at the libtool documentation. You will quickly learn
that this is a horribly complicated problem that is different on
different platforms, with different compilers etc.

The libraries that you have in your home directory probably don't have
paths embedded in them. The difficulty is with executables that link
against these libraries. In order to know where the libraries are at
run time, they can either (a) have the path to your home directory
included in them, or (b) require you to set LD_LIBRARY_PATH at run time
to point to them, or (c) require you to edit /etc/ld.so.conf to point to
them.

--Phil.

 
 
 

Shared Libraries : library paths ??

Post by phil-news- » Wed, 08 Jun 2005 03:40:52


| I suggest looking at the libtool documentation. You will quickly learn
| that this is a horribly complicated problem that is different on
| different platforms, with different compilers etc.

It seems when a tool is meant to be able to do everything for everyone,
it tends to become easy for no one. I personally avoid libtool.

--
-----------------------------------------------------------------------------
| Phil Howard KA9WGN | http://www.yqcomputer.com/ ://ham.org/ |
| (first name) at ipal.net | http://www.yqcomputer.com/ ://ka9wgn.ham.org/ |
-----------------------------------------------------------------------------
 
 
 

Shared Libraries : library paths ??

Post by ptb » Wed, 08 Jun 2005 07:26:24


Like the plague. Amen. I really fail to see what problem it purports to
solve .. since when is there a common unix platform without dynamically
loadable libraries that are expected to be found in /usr/lib or similar?

And if there is one, will someone please shoot it? I really don't want
it to exist.

Peter
 
 
 

Shared Libraries : library paths ??

Post by Ms Rullg » Wed, 08 Jun 2005 08:28:10


XXXX@XXXXX.COM (Peter T. Breuer) writes:




Take a look at Linux, *BSD, Solaris, AIX, HP-UX, Tru64, and whatever
else you have access to. Then come back and tell me if you found
anything they all had in common with respect to shared libraries.

--
Ms Rullgd
XXXX@XXXXX.COM
 
 
 

Shared Libraries : library paths ??

Post by phil-news- » Wed, 08 Jun 2005 10:55:56


| XXXX@XXXXX.COM (Peter T. Breuer) writes:
|


|>
|>> | I suggest looking at the libtool documentation. You will quickly learn
|>> | that this is a horribly complicated problem that is different on
|>> | different platforms, with different compilers etc.
|>
|>> It seems when a tool is meant to be able to do everything for everyone,
|>> it tends to become easy for no one. I personally avoid libtool.
|>
|> Like the plague. Amen. I really fail to see what problem it purports to
|> solve .. since when is there a common unix platform without dynamically
|> loadable libraries that are expected to be found in /usr/lib or similar?
|>
|> And if there is one, will someone please shoot it? I really don't want
|> it to exist.
|
| Take a look at Linux, *BSD, Solaris, AIX, HP-UX, Tru64, and whatever
| else you have access to. Then come back and tell me if you found
| anything they all had in common with respect to shared libraries.

Are they so _radically_ different that it takes something like libtool
to get a library to successfully build on these platforms?

--
-----------------------------------------------------------------------------
| Phil Howard KA9WGN | http://www.yqcomputer.com/ ://ham.org/ |
| (first name) at ipal.net | http://www.yqcomputer.com/ ://ka9wgn.ham.org/ |
-----------------------------------------------------------------------------
 
 
 

Shared Libraries : library paths ??

Post by Paul Pluzh » Wed, 08 Jun 2005 11:34:20


XXXX@XXXXX.COM writes:




They all have the concept of shared libraries, but that's about it :-)


You don't have to use libtool, and in fact libtool (last I looked
at it) did not build correct AIX shared libraries, when used with
the native compiler.

However, if you don't use libtool, you better have access to the
platform, be experienced on it, and your makefile will not look
pretty :-(

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
 
 
 

Shared Libraries : library paths ??

Post by ptb » Wed, 08 Jun 2005 11:55:03


Well, AIX and Tru64 I have never used. The others I am or have been
totally familiar with. They don't need any "help" from libtool at all,
since they use dynamic libraries searched for in /usr/lib. What is the
precise point you are making here?


As far as I know, if you compile with gcc on these platforms, it
suffices to do

gcc -o foo foo.o -lbar

in order to get an executable foo that is dynamically linked against
whatever /usr/lib/libbar.so pints to. Where is the problem?

Peter
 
 
 

Shared Libraries : library paths ??

Post by Paul Pluzh » Wed, 08 Jun 2005 12:43:31


XXXX@XXXXX.COM (Peter T. Breuer) writes:


The problem that libtool is trying to solve is how to *build*
shared libraries on all the various platforms.

One answer is 'gcc -shared ...', but if you do not want to have
libgcc_s.so dependency, or are building C++ with a need to run
global initializers, or are building with the aCC compiler, things
quickly get complicated.


And AIX'x shared library model is unlike any other UNIX (much closer
to Win32 actually). So you've just eliminated half of the problem
space. Sure, you don't need anything more complicated then
'gcc -shared' if all you are targeting is straight C on Linux.
But that's not what libtool was created for.

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
 
 
 

Shared Libraries : library paths ??

Post by ptb » Wed, 08 Jun 2005 13:28:59


Well, OK. gcc -shared -o libfoo.so.1.2 -Wl,-soname=libfoo.so.1 *.o
is what I'd do. If you don't have gcc or gnu ld, then one needs to read
the man page for the local linker and/or compiler. But as far as I
recall things were prety much the same under Sun's linkers, and HP's.
And the *bsd use gnu. And anyway "compile gnu toolchain first" works.

So on a linux platform, or a *bsd one, and probably a Sun platform (not
that I am up to date), I don't see the slightest need.


?? I never have it. Does your gcc emit code which calls special
functions? Oh - it seems to be part of gcc 3.*. I don't use modern
gcc. Where's the .a version?


Double dutch to me. Global initializers? You mean global static
objects (which would get created and hence initialized by their
constructor before runtime)? I don't see what extra this needs.


That different compilers have different syntax is not something one can
get around. It's a fact. I fail to see why one should expect that
different linkers don't also have different syntax and deal with it!
libtool seems to be an attempt at a frontend for ump *** different
linkers ... pshawwwww. Fair enough, but just LART the lauthors until
they agree on a reasonable syntax if it bothers you. Isn't this
posix-ized?





Good.


Then why use it? Let the AIX people build a compatibility frontend.
The idea of fontending ump *** linkers when they practically all
work the same anyway is just daft. Let the platforms with a problem mend
their problem by providing a compatibility frontend. Everyone else
can just be happy.

Peter
 
 
 

Shared Libraries : library paths ??

Post by Lawrence D » Wed, 08 Jun 2005 14:12:11

In article < XXXX@XXXXX.COM >,



I would like to see non-ANSI C compilers shot as well, but it seems some
UNIX systems still run them...
 
 
 

Shared Libraries : library paths ??

Post by Paul Pluzh » Wed, 08 Jun 2005 14:46:46


XXXX@XXXXX.COM (Peter T. Breuer) writes:


This is *not* a solution to the problem libtool is trying to solve,
because the above command will fail on all non-ELF platforms.


Your solution to the problem that libtool is trying to solve
(paraphrased):

I am not going to solve this problem. I'll wait till someone else
(mythical "AIX people") solves it for me.

I should try this with my boss sometime :-)


But they don't all work the same, that's the point.

And if "AIX people" do come up with a "compatibility frontend",
how is this any different from what libtool is trying do?


Paraphrasing: "My software builds on Linux; be happy. If you must
run on AIX, tough luck, *** to "AIX people" and be happy anyway" [1] :-)

Cheers,

[1] I wonder how happy you'll be if 'gcc people' were to adopt the
same attitude.

P.S. I don't actually defend libtool -- I dislike it quite a bit.
I am just stating the problem it intends to solve, which is quite
a bit more complicated then you make it appear.

--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
 
 
 

Shared Libraries : library paths ??

Post by Ms Rullg » Wed, 08 Jun 2005 16:53:38

Lawrence Dliveiro < XXXX@XXXXX.COM > writes:



If you stick to C89 you should have very few problems. C99 is not
quite as widespread.

--
Ms Rullgd
XXXX@XXXXX.COM
 
 
 

Shared Libraries : library paths ??

Post by ptb » Wed, 08 Jun 2005 18:05:45


Tough - there aren't any. To as good an approximation as I care to know
about, and linux, *bsd, sun etc are certainly not among them! Do you
think I CARE about a platform that hasn't even bothered to make itself
compatible enough to run ELF? Let them un-stone-age themselves!




Exactly so - I am not interested in running on AIX, I am not compiling
for AIX, I am not developing for AIX, AIX is not amoong the platforms I
care about or test on. If they want to run my stuff, they can figure
out how t compile on their platform, tell me, and I'll add it to my
makefile as an ARCH=aix option, and that's it.


Go ahead. It's not your problem.




The right people are doing it, in the right place, and libtool is out
of my face.




Exactly. If they are so interested in having my stuff, let them develop
a libtool -like frontend so that my stuff may compile on their platform.
It is not reasonable to expect me too use a nonsense frontend on all
OTHER platforms.



The problem it solves is that AIX needs a nonstandard way of making
shared libraries, according to you. Therefore it is an AIX problem,
and I will thank the AIX people for including it in their toolchain and
I will call it when on AIX. FOr linux and anything else normal I don't
want to see it.


Peter
 
 
 

Shared Libraries : library paths ??

Post by Ms Rullg » Wed, 08 Jun 2005 18:29:42


XXXX@XXXXX.COM (Peter T. Breuer) writes:



Tru64, at least up to v5.0, uses ECOFF.


The whole idea is that your programs will compile and run out of the
box, on platforms you have never heard of, without you needing to care
about it.

--
Ms Rullgd
XXXX@XXXXX.COM