[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: postdeps empty on OpenBSD

From: Ralf Wildenhues
Subject: Re: postdeps empty on OpenBSD
Date: Wed, 21 Sep 2005 10:13:29 +0200
User-agent: Mutt/1.4.1i

Hi Olly, Brad,

[ quoting generously for the benefit of Brad; this thread is also at ]

* Olly Betts wrote on Tue, Sep 20, 2005 at 08:08:40PM CEST:
> I'm trying to link C++ code into a shared object for use as a Python
> module.  I'm using libtool to do the linking.  On Linux this works
> well, but on OpenBSD it fails with lots of C++ library symbols not
> found.
> The problem seems to be that on OpenBSD the shared object doesn't
> pull in libstdc++.  Python isn't written in C++, so doesn't pull in
> libstdc++ either.
> I've found that if I explicitly link with -lstdc++ then it works on
> OpenBSD, which supports this theory.  I could potentially just always
> explicitly link with -lstdc++, but I'm concerned that this could try
> to link in two different versions on a machine with multiple compilers
> installed.
> Comparing the generated libtool scripts on the 2 systems, I've noticed
> that postdeps is empty on OpenBSD.  On Linux it is:
> postdeps="-lstdc++ -lm -lgcc -lc -lgcc"
> So this would seem to be on the right track.
> I don't entirely follow the logic which generates this, but it seems
> to come from the output of something like:
> g++ -shared -v /dev/null 2>&1|grep "\-L"
> On an x86 Linux box (Debian unstable) with g++ 3.3.6 this gives:
>  /usr/bin/../lib/gcc-lib/i486-linux-gnu/3.3.6/collect2 --eh-frame-hdr -m 
> elf_i386 -shared /usr/bin/../lib/gcc-lib/i486-linux-gnu/3.3.6/../../../crti.o 
> /usr/bin/../lib/gcc-lib/i486-linux-gnu/3.3.6/crtbeginS.o 
> -L/usr/bin/../lib/gcc-lib/i486-linux-gnu/3.3.6 -L/usr/bin/../lib/gcc-lib 
> -L/usr/lib/gcc-lib/i486-linux-gnu/3.3.6 
> -L/usr/bin/../lib/gcc-lib/i486-linux-gnu/3.3.6/../../.. 
> -L/usr/lib/gcc-lib/i486-linux-gnu/3.3.6/../../.. /dev/null -lstdc++ -lm 
> -lgcc_s -lc -lgcc_s /usr/bin/../lib/gcc-lib/i486-linux-gnu/3.3.6/crtendS.o 
> /usr/bin/../lib/gcc-lib/i486-linux-gnu/3.3.6/../../../crtn.o
> On an x86 OpenBSD 3.7 box with g++ 3.3.5 this gives:
>  /usr/lib/gcc-lib/i386-unknown-openbsd3.7/3.3.5/collect2 --eh-frame-hdr 
> -shared -Bdynamic -dynamic-linker /usr/libexec/ /usr/lib/crtbeginS.o 
> -L/usr/lib/gcc-lib/i386-unknown-openbsd3.7/3.3.5 /dev/null -lsupc++ -lgcc 
> -lgcc /usr/lib/crtendS.o
> Note: -lsupc++ instead of -lstdc++.
> If I remove the "-shared" on OpenBSD I get -lstdc++ instead of -lsupc++.
> I don't know if it's relevant, but both systems have shared and static 
> versions
> of libstdc++, but only static versions of libsupc++ and libgcc.  The Linux
> system has a shared (only) libgcc_s, but the OpenBSD system doesn't have this
> at all.
> Is this a libtool issue, or should I be looking elsewhere?

Probably libtool needs to be adjusted (on OpenBSD,
output_verbose_link_cmd is set to `echo' in the C++ case). 

Brad, you changed this with this patch:
and presumably for good reason.  However, I could not find the
corresponding discussion by searching of web archives.  Unfortunately, I
don't have access to OpenBSD, either, at the moment, to test myself.

Could you be bothered to look at this issue?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]