On 28.12.2010 13:41, Frank B. Brokken wrote:
Dear Matthias Klose, you wrote:


^^^ the mistake is that shared libraries are placed before the
object files on the command line.

^^^ this is the think to fix

I did, but nothing changed. Here is what I just used to create the library:

gcc -shared -Wl,-z,def,-soname,libbobcat.so.2 */os/*.o  -lmilter
-L/usr/lib/libmilter -lX11 -lssl -lreadline -o tmp/lib/libbobcat.so.2.10.02

With the --as-needed option the problem remained.

I'm not sure why you're using ld --as-needed. When I add -Xlinker --as-needed
to the library construction phase lcgen indeed fails to link.

hmm, no, it should not fail. how does it for you?

Well, --as-needed causes problems, irrespective of the location of the object
files.

I can't see that. could you attach your build log?

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.

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)

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.



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to