Package: g++-mingw-w64
Version: 4.9.0-2+13
Severity: important

Until relatively recently, cross-building a C++ application with "-static-
libgcc -static-libstdc++" resulted in an executable that only referenced
standard system DLLs (kernel32.dll and msvcrt.dll) plus whatever DLLs you
explicitly linked with.

However, this is no longer the case - executables now complain that
"libwinpthread-1.dll" is not found (and I did not request a link to it).
Only -static makes that go away, but that means that EVERYTHING gets linked
statically (if available), which is not ideal.

Looking in -dumpspecs output, there's a -no-pthread option to prevent linking
with -lpthread -- but that doesn't work, because linking fails:

/usr/lib/gcc/x86_64-w64-mingw32/4.9/libstdc++.a(eh_alloc.o):(.text$__cxa_allocate_exception+0xd0):
undefined reference to `pthread_mutex_lock'
/usr/lib/gcc/x86_64-w64-mingw32/4.9/libstdc++.a(eh_alloc.o):(.text$__cxa_allocate_exception+0x144):
undefined reference to `pthread_mutex_unlock'
/usr/bin/x86_64-w64-mingw32-ld:
/usr/lib/gcc/x86_64-w64-mingw32/4.9/libstdc++.a(eh_alloc.o): bad reloc address
0x144 in section `.text$__cxa_allocate_exception'

I guess I'd expect GCC to consider libwinpthread to be part of libstdc++ and
therefore also apply -static-libstdc++ to it (or, adding a -static-thread-
library option specifically for whatever thread library it links with).

This is probably an upstream issue, but it could also just be a matter of
configuring gcc/libstdc++ to use win32 threads instead of pthread (although I
think that would then remove std::thread support - not an issue for me, but it
could be for others).



-- System Information:
Debian Release: jessie/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.13-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages g++-mingw-w64 depends on:
ii  g++-mingw-w64-i686    4.9.0-2+13
ii  g++-mingw-w64-x86-64  4.9.0-2+13
ii  gcc-mingw-w64-base    4.9.0-2+13

g++-mingw-w64 recommends no packages.

g++-mingw-w64 suggests no packages.

-- no debconf information


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

Reply via email to