Can't link a C++ lib to a program

Bug #2784 reported by Snark
6
Affects Status Importance Assigned to Milestone
mingw32-binutils (Ubuntu)
Fix Released
Medium
MOTU

Bug Description

Hi,

I'm trying to cross-compile gnomemeeting for win32 for mingw (native compiling with mingw works now).

I can cross-compile pwlib without problem, but when I try to compile the sample/hello_world program, I get a problem that I think isn't pwlib-specific, but more probably a mingw32-binutils issue. Especially the fact that an assertion fails and ld/collect2 segfaults is impressive.

Here is the log of the failed link :
i586-mingw32msvc-c++ -o obj_mingw_x86_r/hello -I/home/jpuydt/Gnomemeeting/Cross/windows/include -L/home/jpuydt/Gnomemeeting/Cross/windows/lib -L/home/jpuydt/Gnomemeeting/Cross/windows/lib -enable-auto-import -enable-runtime-pseudo-reloc -enable-stdcall-fixup -fatal-warning -L/home/jpuydt/Gnomemeeting/Cross/pwlib//lib
 ./obj_mingw_x86_r/hello.o -lpt_mingw_x86_r -lldap -lldap_r -llber -lwinmm -lwsock32 -lsnmpapi -lmpr -lcomdlg32 -lgdi32 -lavicap32 -lregex
collect2: ld terminated with signal 11 [Segmentation fault]
/home/jpuydt/Gnomemeeting/Cross/pwlib//lib/libpt_mingw_x86_r.dll(.text+0x100): In function `atexit':
/build/buildd/mingw32-runtime-3.7/build_dir/src/mingw-runtime-3.7/dllcrt1.c:161: multiple definition of `_atexit'
/usr/lib/gcc/i586-mingw32msvc/3.4.2/../../../../i586-mingw32msvc/lib/crt2.o(.text+0x210):/build/buildd/mingw32-runtime-3.7/build_dir/src/mingw-runtime-3.7/crt1.c:250: first defined here
/home/jpuydt/Gnomemeeting/Cross/pwlib//lib/libpt_mingw_x86_r.dll(.text+0x130): In function `_onexit':
/build/buildd/mingw32-runtime-3.7/build_dir/src/mingw-runtime-3.7/dllcrt1.c:177: multiple definition of `__onexit'
/usr/lib/gcc/i586-mingw32msvc/3.4.2/../../../../i586-mingw32msvc/lib/crt2.o(.text+0x220):/build/buildd/mingw32-runtime-3.7/build_dir/src/mingw-runtime-3.7/crt1.c:258: first defined here
/home/jpuydt/Gnomemeeting/Cross/pwlib//lib/libpt_mingw_x86_r.dll(.text+0x150): In function `_onexit':
/build/buildd/mingw32-runtime-3.7/build_dir/src/mingw-runtime-3.7/dllcrt1.c:183: multiple definition of `___do_sjlj_init'
/usr/lib/gcc/i586-mingw32msvc/3.4.2/crtbegin.o(.text+0x0): first defined here
/home/jpuydt/Gnomemeeting/Cross/pwlib//lib/libpt_mingw_x86_r.dll(.rdata+0x183d8): In function `_onexit':
/build/buildd/mingw32-runtime-3.7/build_dir/src/mingw-runtime-3.7/dllcrt1.c:183: multiple definition of `typeinfo for PThread'
./obj_mingw_x86_r/hello.o(.rdata$_ZTI7PThread[typeinfo for PThread]+0x0):hello.cxx: first defined here
/home/jpuydt/Gnomemeeting/Cross/pwlib//lib/libpt_mingw_x86_r.dll(.rdata+0x18548): In function `_onexit':
/build/buildd/mingw32-runtime-3.7/build_dir/src/mingw-runtime-3.7/dllcrt1.c:183: multiple definition of `typeinfo for PProcess'
./obj_mingw_x86_r/hello.o(.rdata$_ZTI8PProcess[typeinfo for PProcess]+0x0):hello.cxx: first defined here
/home/jpuydt/Gnomemeeting/Cross/pwlib//lib/libpt_mingw_x86_r.dll(.rdata+0x1bb64): In function `_onexit':
/build/buildd/mingw32-runtime-3.7/build_dir/src/mingw-runtime-3.7/dllcrt1.c:183: multiple definition of `typeinfo name for PProcess'
./obj_mingw_x86_r/hello.o(.rdata$_ZTS8PProcess[typeinfo name for PProcess]+0x0):hello.cxx: first defined here
/home/jpuydt/Gnomemeeting/Cross/pwlib//lib/libpt_mingw_x86_r.dll(.rdata+0x183b8): In function `_onexit':
/build/buildd/mingw32-runtime-3.7/build_dir/src/mingw-runtime-3.7/dllcrt1.c:183: multiple definition of `typeinfo for PObject'
./obj_mingw_x86_r/hello.o(.rdata$_ZTI7PObject[typeinfo for PObject]+0x0):hello.cxx: first defined here
/home/jpuydt/Gnomemeeting/Cross/pwlib//lib/libpt_mingw_x86_r.dll(.rdata+0x1b8b0): In function `_onexit':
/build/buildd/mingw32-runtime-3.7/build_dir/src/mingw-runtime-3.7/dllcrt1.c:183: multiple definition of `typeinfo name for PThread'
./obj_mingw_x86_r/hello.o(.rdata$_ZTS7PThread[typeinfo name for PThread]+0x0):hello.cxx: first defined here
/home/jpuydt/Gnomemeeting/Cross/pwlib//lib/libpt_mingw_x86_r.dll(.rdata+0x1b88c): In function `_onexit':
/build/buildd/mingw32-runtime-3.7/build_dir/src/mingw-runtime-3.7/dllcrt1.c:183: multiple definition of `typeinfo name for PObject'
./obj_mingw_x86_r/hello.o(.rdata$_ZTS7PObject[typeinfo name for PObject]+0x0):hello.cxx: first defined here
/usr/lib/gcc/i586-mingw32msvc/3.4.2/../../../../i586-mingw32msvc/bin/ld: BFD 2.15.91 20040904 assertion fail /build/buildd/mingw32-binutils-2.15.91.20040904.1/build_dir/src/binutils-2.15.91-20040904-1/bfd/cofflink.c:1929
make: *** [obj_mingw_x86_r/hello] Error 1

Let me add I use package version 2.15.91.20040904.1-1, with apt-cache policy saying it comes from http://archive.ubuntu.com breezy/universe Packages...

Is there hope ?

Snark on #gnomemeeting

Changed in mingw32-binutils:
assignee: nobody → motu
Revision history for this message
Martin Bergner (martin-bergner) wrote :

Does this problem still exist with the latest version?

Changed in mingw32-binutils:
status: Unconfirmed → Needs Info
Revision history for this message
Snark (julien-puydt) wrote :

Pfff... I don't have the developpment environment ready to retest anymore and lack the time to reinstall it properly.

I propose to close the bug.

PS: Isn't the reporter supposed to be able to close a report?

Revision history for this message
StefanPotyra (sistpoty) wrote :

closing on request.

P.S.: I guess the reporter cannot close a bug report, since general bug triaging has been limited to the ubuntu-qa team. Consider the (more common) case that you are not the only one noticing/being affected by the bug you reported. It wouldn't seem wise to me then, that you as reporter can close the bug, whereas other subscribers cannot. But to be honest, I haven't really thought about this in depth, probably because I'm a (indirect) member of ubuntu-qa ;)
Feel free to ask on launchpad-users mailing list for the real rationale or file a bug against launchpad if you think that this behavior is wrong.

Cheers,
   Stefan.

Changed in mingw32-binutils:
status: Needs Info → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.