GNOME Bugzilla – Bug 617145
Compile mplex element with with --enable-runtime-pseudo-reloc-v2 on Windows
Last modified: 2010-05-25 14:54:34 UTC
From MinGW GCC 4.5.0 README "Known Issues" section: * When linking C++ modules with shared libstdc++ (the default), the linker may warn about activating auto-import. The workaround is to add one of the following flags: a) -Wl,--enable-runtime-pseudo-reloc-v2 The warning is still printed, but is now harmless. b) -Wl,--enable-auto-import Actually does what the warning suggests. c) -static-libstdc++ Avoids creating the issue in the first place. d) none of the above. You may get a 0xc0000005 error at runtime. This is exactly what is happening to me - mplex conftest crashes with 0xC0000005 when compiled with GCC 4.5.0
Created attachment 159838 [details] [review] Compile mplex element with --enable-runtime-pseudo-reloc-v2 on Windows This patch is by no means feature-complete. It lacks a check for g++ version (should only use --enable-runtime-pseudo-reloc-v2 with g++ >= 4.4.0 or so), but i don't know how to implement that in autoconf.
Created attachment 160038 [details] [review] Compile mplex element with --enable-runtime-pseudo-reloc-v2 on Windows Added a check for g++ version
Created attachment 160109 [details] [review] Alternative light version - adds MPLEX_LDFLAGS With MPLEX_LDFLAGS available, user can set it when calling configure script, i.e. it is up to user to do or not to do MPLEX_LDFLAGS="-Wl,--enable-runtime-pseudo-reloc-v2" This is an alternative to patch 160038
Created attachment 160505 [details] [review] Alternative light version - adds MPLEX_LDFLAGS variable (fixed)
Marking as blocker so we look at it before the release.
I think I prefer the non-light version. Things should just work out of the box, so we should detect when this is needed and add it. The compiler/version detection seems a bit convoluted though, couldn't we just do something like: AC_LANG_PUSH([C++]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ #if !defined(__GNUC__) || !defined(__MINGW32__) || (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) #error "Not MingW GCC or older than version 4.5" #endif ]])], [ EXTRA_MPLEX_LDFLAGS="-Wl,--enable-runtime-pseudo-reloc-v2" ], [ EXTRA_MPLEX_LDFLAGS="" ]) AC_LANG_POP([C++]) ? Also, could you by any chance give us a link or two that points to some background about why this is needed exactly?
Ah, well, your test looks nicer than mine :) I'm still not sure about "4.5 or later" thing. In theory we should i should have hit this issue long time ago, but i never did. I guess this only happens with g++ that links against shared libstdc++ (ffmpeg had this problem earlier, roughly at 4.3.0, for different reasons - see below), which became default in 4.5 As for background... maybe this - http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40905 and http://lists-archives.org/mingw-users/16849-mingw-gcc-4-5-0-released.html
So this is really a compiler/linker bug?
Otherwise it wouldn't be in the "known issues" section of the release notes, or?
"Known issue" doesn't necessarily indicate whether it's considered a bug, or WONTFIX or SUCKSTOBEYOU. I don't think we should be hacking around compiler/linker bugs in our configure though, so I'll just commit the minimal patch after all I think: commit 71b8d4b5cefafbffdef9541b10f84625de58f94f Author: Руслан Ижбулатов <lrn1986@gmail.com> Date: Fri May 7 16:42:12 2010 +0400 mplex: add MPLEX_LDFLAGS variable So mingw32 users can hack around a compiler/linker bug. Fixes #617145