From: Marcelo E. M. <mar...@bi...> - 2001-05-21 21:33:38
|
>> "Sven M. Hallberg" <pe...@gm...> writes: > It must only do in some brand-new version. 1.4 doesn't seem to know > -release-info. Sorry, memory is playing tricks on me. -release. > This is really a nightmare. How can we have libtool solve the problem > of portable linking for us while still controlling the name of the > resulting library. Anyhow, if other linkers have such different ways > of doing things, how are we supposed to know the correct file name > anyhow?? That's the whole point: you don't. That's the reason for libtoo's libfoo.la files. The two things are coupled because "baptizing" the library is part of the linking process. Off the top of my head, MIPSpro does this using a linker program and a -soname flag while GNU CC does it using the compiler (the frontend really, which ends up calling the GNU linker) and a "-Wl,-soname," flag (for GNU CC it does make a difference if you use the linker or the gcc frontend). The solution you propose with CURRENT:AGE:REVISION works for Linux and other systems, but it's not portable (HP-UX is a good example, barring the fact that dynamic libraries are called libfoo.sl instead of libfoo.so, you'll note there aren't any libfoo.sl.1.2, only libfoo.1). There's no way to get the "correct" version number on every architecture, that's why libtool doesn't offer that possibility. Which reminds me of something else: inter-library dependencies, which libtool does support on systems that support it. It means, for example, that libGL.so.1 is linked against libpthread.so.0, libXext.so.6, libX11.so.6 and libdl.so.2. That is, the library itself uses functions from those libraries. This is the difference between: $ cc -o gears gears.c -lglut and $ cc -o gears gears.c -lglut -lGL -lGLU -L/usr/X11R6/lib -lXmu -lXext \ -lXi -lX11 -lm (I think those all all) in this case libglut contains "NEEDED" entries for all those libraries. All you need to change is: $ cc -o libfoo.so.1.2.3 foo.o bar.o baz.o -Wl,-shared,libfoo.so.1 to $ cc -o libfoo.so.1.2.3 foo.o bar.o baz.o -Wl,-shared,libfoo.so.1 \ -lfi -lfai -lfo (but again, this varies from compiler to compiler and that's why libtool performs some magick when it sees something like this) -- Marcelo |