On Tue, 28 Dec 2010 14:02:39 +0100, Matthias Klose <[email protected]> wrote:

Hi All,

Thanks for the bug-report and the proposed fix.

right, but the shared library uses ssl symbols. You do link with it,

True, but if I were the linker then to resolve the externals I would start with the explicitly mentioned object modules, and then I'd go looking for the external refs in the provided libs. Then those objects would be added (either explicitly as with static linking) or on-the-spot (with dynamic linking), and
I wouldn't come across the ssl lib that way.

you assume a lot about linking order, which might not be true for
every linker.

Okay, it is true that a common approach for linkers is to look for external
symbols from left to right in the libraries list passed to the linker.
Thus a library containing a definition of a function must be specified
after any source or object files which use it.

Originally we didn't explicitly
mention these additional libs when building bobcat, but then the additional libs had to mentioned explicitly when linking programs against bobcat. That irritating requirement ended after adding the extra libraries to bobcat's lib
construction. But now the --as-needed flag spoils the soup ;-)

Here is the difference:

wrong order:

$ gcc -shared -Wl,--as-needed -Wl,-z,def,-soname,libbobcat.so.2 -o
tmp/lib/libbobcat.so.2.10.01 -lmilter -L/usr/lib/libmilter -lX11 -lssl
-lreadline */os/*.o
$ ldd tmp/lib/libbobcat.so.2.10.01
        linux-gate.so.1 =>  (0xf77df000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xf771a000)
        libc.so.6 => /lib/libc.so.6 (0xf75b9000)
        /lib/ld-linux.so.2 (0xf77e0000)


correct order:

$ gcc -shared -Wl,--as-needed -Wl,-z,def,-soname,libbobcat.so.2 -o
tmp/lib/libbobcat.so.2.10.01 */os/*.o -lmilter -L/usr/lib/libmilter
-lX11 -lssl -lreadline
$ ldd tmp/lib/libbobcat.so.2.10.01 linux-gate.so.1 => (0xf77bb000) libmilter.so.1.0.1 => /usr/lib/libmilter.so.1.0.1 (0xf7704000)
        libX11.so.6 => /usr/lib/libX11.so.6 (0xf75ec000)
        libreadline.so.6 => /lib/libreadline.so.6 (0xf75b7000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xf759a000)
        libc.so.6 => /lib/libc.so.6 (0xf7439000)
        libpthread.so.0 => /lib/libpthread.so.0 (0xf741f000)
        libxcb.so.1 => /usr/lib/libxcb.so.1 (0xf7405000)
        libdl.so.2 => /lib/libdl.so.2 (0xf7401000)
        libncurses.so.5 => /lib/libncurses.so.5 (0xf73c8000)
        /lib/ld-linux.so.2 (0xf77bc000)
        libXau.so.6 => /usr/lib/libXau.so.6 (0xf73c4000)
        libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xf73be000)

I agree, we need to fix the order of specified libraries.

well, I think I attached a patch what is the correct solution, but
the somewhat unfamiliar build system doesn't like that patch in this place, or it requires another similiar one which I am still missing.

Ok, thanks for the patch. I thought you wrote it didn't work, but I'll have a
closer look at it soon.

the patch does apply, but I still see the wrong order on the command
line. Either I'm doing something stupid, or I patch the wrong place.
That was my question to you as the package maintainer.

the correct tweak for icmake/libraries should be:

run(GCC + " -shared -Wl,-z,def,-soname," + libsomajor +
" -o " + destDir + libsoshared + " */os/*.o " + g_sharedLibReq );







--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to