Date: Sun, 9 Jul 2006 16:02:58 +0200 From: Alexander Leidinger <Alexander@Leidinger.net> To: Alejandro Pulver <alepulver@FreeBSD.org> Cc: ports@FreeBSD.org Subject: Re: Renaming and symlinking shared libraries Message-ID: <20060709160258.5871bc1b@Magellan.Leidinger.net> In-Reply-To: <20060706161534.4b8d2639@phobos.mars.bsd> References: <20060701202522.00da2f4e@phobos.mars.bsd> <20060703114027.tj9s4h5mog8ww0ck@netchild.homeip.net> <20060703142907.62215dae@phobos.mars.bsd> <20060704074308.9gtr3ucj7ogs8kcs@netchild.homeip.net> <20060706161534.4b8d2639@phobos.mars.bsd>
next in thread | previous in thread | raw e-mail | index | archive | help
Quoting Alejandro Pulver <alepulver@FreeBSD.org> (Thu, 6 Jul 2006 16:15:34 -0300): > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On Tue, 04 Jul 2006 07:43:08 +0200 > Alexander Leidinger <Alexander@Leidinger.net> wrote: > > > > >> Quoting Alejandro Pulver <alepulver@freebsd.org> (from Sat, 1 Jul 2006 > > >> 20:25:22 -0300): > > > > > > But then how do the databases/dbXX ports achieve the same result > > > without it? I thought it should find it since there is a symlink > > > in /usr/local/lib that points to it. I want that when I compile a > > > program with -L/usr/local/lib/test -ltest it actually links to test-2 > > > for example. Please look at the dbXX ports to see what I mean. > > > > If you link with "-ltest-2" or if you link lib/libtest.so -> > > lib/test2/libtest-2.so, it should work, else you have to use the new > > LDCONFIG infrastructure. > > > > The problem is that there are many versions of libtest > (lib/libtest-2.so, lib/libtest-3.so), and I want to select the library > by adding a -L linker flag to the corresponding directory, without > altering the program (each lib/test2, lib/test3, etc. has a symlink > libtest.so which points to the corresponding one; I want the mapping to > take effect at link time). > > For example (note that I didn't specify -ldb-4.2, just -ldb, and > lib/db42 isn't in the linker path): > % cc test.c -L/usr/local/lib/db42 -ldb > % ldd a.out > a.out: > libdb-4.2.so.2 => /usr/local/lib/libdb-4.2.so.2 (0x28077000) > libc.so.6 => /lib/libc.so.6 (0x2814a000) > > When I try it after symlinking the lua4 library this happens: > % cc test.c -L/usr/local/lib/lua4 -llua > % ldd a.out > a.out: > liblua.so => (not found) > libc.so.6 => /lib/libc.so.6 (0x2814a000) > > I would like to achieve the same result as the first case. Does the lua4 lib contain a SONAME entry? % objdump -R -x /usr/lib/libsdp.so | grep SONAME SONAME libsdp.so.2 Does our runtime linker follow runtime linker paths embedded into a lib (gcc -L/path -R/path/foo -lbar) and does the libdb-4.2.so.2 contain a runtime linker path entry (don't know how to check, maybe you have to search the build logs for -R). Bye, Alexander. -- You can disable tcsh's terminal beep if you `set nobeep'. http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060709160258.5871bc1b>