[CLN-list] shared libs on MinGW

Sheplyakov Alexei varg at theor.jinr.ru
Mon Aug 7 15:48:01 CEST 2006


Hello,

On Mon, Aug 07, 2006 at 01:11:59PM +0200, Ralf Wildenhues wrote:
> I see that MinGW support has been added -- nice!
> But say, why is shared library support disabled there?
> Anything missing other than a -no-undefined
> link flag when creating the library (which is unfortunately necessary
> for libtool on w32 systems)?

Yes. The main reason is MAYBE_INLINE thing which leads to multiple
definitions of the same symbol (in different object files), so linker 
miserably fails (see the attached file for exact error message):

.libs/cl_I_zerop.o: In function `ZN3cln5zeropERKNS_4cl_IE':/home/pc7135/varg/tmp/build/w32/cln-1.1.11/obj/src/../../src/integer/elem/cl_I_zerop.cc:19: multiple definition of `cln::zerop(cln::cl_I const&)'
.libs/cl_LF_I_div.o:/home/pc7135/varg/tmp/build/w32/cln-1.1.11/obj/src/../../src/float/lfloat/elem/cl_LF_I_div.cc:23: first defined here
.libs/cl_RA_ring.o: In function `ZN3cln5zeropERKNS_5cl_RAE':/home/pc7135/varg/tmp/build/w32/cln-1.1.11/obj/src/../../src/rational/cl_RA.h:109: multiple definition of `cln::zerop(cln::cl_RA const&)'
.libs/cl_RA_zerop.o:/home/pc7135/varg/tmp/build/w32/cln-1.1.11/obj/src/../../src/rational/elem/cl_RA_zerop.cc:19: first defined here
.libs/libcln.la-1.o: In function `ZN3cln6ffloorERKNS_5cl_FFE':/home/pc7135/varg/tmp/build/w32/cln-1.1.11/obj/src/../../src/float/ffloat/elem/cl_FF_ffloor.cc:(.text$_ZN3cln8cl_floatERKNS_4cl_RE[__ZN3cln8cl_floatERKNS_4cl_RE]+0x0): multiple definition of `cln::cl_float(cln::cl_R const&)'
.libs/cl_F_from_R_def.o:/home/pc7135/varg/tmp/build/w32/cln-1.1.11/obj/src/../../src/real/conv/cl_F_from_R_def.cc:20: first defined here
i586-mingw32msvc-ld: BFD 2.16.91 20060119 assertion fail /home/ron/devel/debian/mingw32-binutils/mingw32-binutils-2.16.91-20060119.1/build_dir/src/binutils-2.16.91-20060119-1/bfd/cofflink.c:1926
Segmentation fault (core dumped)

Just for a record, I'm using
 mingw32                 3.4.5.20060117.1-1      Minimalist GNU win32 (cross) compiler
 mingw32-binutils        2.16.91-20060119.1-1    Minimalist GNU win32 (cross) binutils
 mingw32-runtime         3.9-4                   Minimalist GNU win32 (cross) runtime

I've also tried native MinGW compiler/binutils (on ReactOS 0.3), but 
the result is essentially the same.

And indeed, cln::zerop(cln::cl_I const&) is defined in several object
files, as the following script shows:

for i in src/.libs/*.o; do
OOPS=`i586-mingw32msvc-nm -B -C $i | grep zerop | grep cl_I | \
      grep -e '\(\<T\>\)\|\(\<t\>\)'`
if test ! -z "$OOPS"; then
 echo "$i: $OOPS"
fi
done

src/.libs/cl_F_readparsed.o: 00000000 t .text$_ZN3cln5zeropERKNS_4cl_IE
00000000 T cln::zerop(cln::cl_I const&)
src/.libs/cl_I_ash_I.o: 00000000 t .text$_ZN3cln5zeropERKNS_4cl_IE
00000000 T cln::zerop(cln::cl_I const&)
src/.libs/cl_I_ash.o: 00000000 t .text$_ZN3cln5zeropERKNS_4cl_IE
00000000 T cln::zerop(cln::cl_I const&)
src/.libs/cl_I_cached_power.o: 00000000 t .text$_ZN3cln5zeropERKNS_4cl_IE
00000000 T cln::zerop(cln::cl_I const&)
src/.libs/cl_I_ceil1.o: 00000000 t .text$_ZN3cln5zeropERKNS_4cl_IE
00000000 T cln::zerop(cln::cl_I const&)
src/.libs/cl_I_ceil2.o: 00000000 t .text$_ZN3cln5zeropERKNS_4cl_IE
00000000 T cln::zerop(cln::cl_I const&)
src/.libs/cl_I_exquo.o: 00000000 t .text$_ZN3cln5zeropERKNS_4cl_IE
00000000 T cln::zerop(cln::cl_I const&)
src/.libs/cl_I_exquopos.o: 00000000 t .text$_ZN3cln5zeropERKNS_4cl_IE
00000000 T cln::zerop(cln::cl_I const&)
src/.libs/cl_I_floor1.o: 00000000 t .text$_ZN3cln5zeropERKNS_4cl_IE
00000000 T cln::zerop(cln::cl_I const&)
src/.libs/cl_I_floor2.o: 00000000 t .text$_ZN3cln5zeropERKNS_4cl_IE
00000000 T cln::zerop(cln::cl_I const&)
src/.libs/cl_I_mod.o: 00000000 t .text$_ZN3cln5zeropERKNS_4cl_IE
00000000 T cln::zerop(cln::cl_I const&)
src/.libs/cl_I_mul.o: 00000000 t .text$_ZN3cln5zeropERKNS_4cl_IE
00000000 T cln::zerop(cln::cl_I const&)
src/.libs/cl_I_ring.o: 00000000 t .text$_ZN3cln5zeropERKNS_4cl_IE
00000000 T cln::zerop(cln::cl_I const&)
src/.libs/cl_I_signum.o: 00000000 t .text$_ZN3cln5zeropERKNS_4cl_IE
00000000 T cln::zerop(cln::cl_I const&)
src/.libs/cl_I_to_digits.o: 00000000 t .text$_ZN3cln5zeropERKNS_4cl_IE
00000000 T cln::zerop(cln::cl_I const&)
src/.libs/cl_I_zerop.o: 000000c0 t global destructors keyed to _ZN3cln5zeropERKNS_4cl_IE
000000a0 t global constructors keyed to _ZN3cln5zeropERKNS_4cl_IE
00000000 T cln::zerop(cln::cl_I const&)
src/.libs/cl_LF_I_div.o: 00000000 t .text$_ZN3cln5zeropERKNS_4cl_IE
00000000 T cln::zerop(cln::cl_I const&)
src/.libs/cl_MI.o: 00000000 t .text$_ZN3cln5zeropERKNS_4cl_IE
00000000 T cln::zerop(cln::cl_I const&)
src/.libs/cl_nt_cornacchia4.o: 00000000 t .text$_ZN3cln5zeropERKNS_4cl_IE
00000000 T cln::zerop(cln::cl_I const&)
src/.libs/cl_RA_expt_I.o: 00000000 t .text$_ZN3cln5zeropERKNS_4cl_IE
00000000 T cln::zerop(cln::cl_I const&)
src/.libs/cl_RA_mul.o: 00000000 t .text$_ZN3cln5zeropERKNS_4cl_IE
00000000 T cln::zerop(cln::cl_I const&)
src/.libs/cl_RA_readparsed.o: 00000000 t .text$_ZN3cln5zeropERKNS_4cl_IE
00000000 T cln::zerop(cln::cl_I const&)
src/.libs/cl_R_signum.o: 00000000 t .text$_ZN3cln5zeropERKNS_4cl_IE
00000000 T cln::zerop(cln::cl_I const&)
src/.libs/cl_R_zerop.o: 00000000 t .text$_ZN3cln5zeropERKNS_4cl_IE
00000000 T cln::zerop(cln::cl_I const&)

Secondly, to build proper win32 dll many __declspec annotation are necessary
(I've tried --enable-auto-exports, but libtool refuses to create dll anyway),
and I don't think CLN maintainer will ever accept such a patch.


Best regards,
 Alexei.


-- 
All science is either physics or stamp collecting.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: Digital signature
Url : http://www.cebix.net/pipermail/cln-list/attachments/20060807/97bbde6b/attachment.pgp


More information about the CLN-list mailing list