gcc-4.6.x generate buggy code and other debug and build problems

Farkas Levente lfarkas at lfarkas.org
Fri Aug 19 22:22:34 UTC 2011


hi,
after a few years or rebuild, debugging i find a serious problem.
the short story gcc-4.6.1 and even the trunk 4.6.2 generate code which
segfault while gcc-4.5.3 generate good.

the long story:
i like to build cross compiler environment for rhel-6 and the final goal
to build gstreamer for windows on linux. after fix and port a few things
from the fedora mingw project everything seems to build properly. the
only problem is that gstreamer-ffmpeg always segfault:-(
here comes the harder part to find the reason why?
to rebuild everything it's always takes a day or night:-(
then i reduce the problem to libav (which is behind gstreamer-ffmpeg).
it's also always segfault (eg a ffplay on a h264 or mpeg4 file). and i'm
not able to debug in mingw-w64 but it's another story at the of this mail.
i try ot rebuild everything with gcc-4.6.1 and with gcc-4.6.2 (and also
bootstrap with both) also try with mingw-w64 1.0, 1.0 daily snaphost and
2.0rc1 too. none of them working.
while the downloadable windows binary at libav.org is working. at the
same time the mingw32 build also working (but mingw32 is not good for us
since it's missing directx and direct3d support).
then i recognized that almost everybody else use gcc-4.5.x (cygwin, and
other linux distro) and also libav use it to produce the good binaries.
so i bootstrap and rebuild everything with gcc-4.5.3 and it's finally
working.
my conclusion is to suggest everybody to use gcc-4.5.3 until find the
reason what's the problem.
anybody can easily test the problem:
- checkout the latest git of libav.org (0.7.1 can't build on windows:-)
- build it and try ffplay any mpeg4 or h264 file.

about the debugging.
i try to debug with gdb on windows (after cross compile gdb too).
there're mainly 2 problems (even on windows or on linux with wine)
1. sometimes i've got CRC mismatch even when i 100% sure that the debug
info is extracted from the right file and install it (i rebuild and
double check it many times):
------------------------------
warning: the debug information found in "c:\Program
Files\foo\gstreamer\lib\gstreamer-0.10\libgstffmpeg.dll.debug" does
not match "c:\Program
Files\foo\gstreamer\lib\gstreamer-0.10\libgstffmpeg.dll" (CRC mismatch).
------------------------------
when this is not happened i've got "section .gnu_debuglink not found"
----------------------------------------------
$ export WINEDLLPATH=/usr/i686-w64-mingw32/sys-root/mingw/bin; wine
/usr/i686-w64-mingw32/sys-root/mingw/bin/gdb.exe --args
/usr/i686-w64-mingw32/sys-root/mingw/bin/ffplay.exe ./mpeg4.mkv
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-w64-mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from
/usr/i686-w64-mingw32/sys-root/mingw/bin/ffplay.exe...Reading symbols
from /usr/i686-w64-mingw32/sys-root/mingw/bin/ffplay.exe.debug...
warning: section .gnu_debuglink not found in
/usr/i686-w64-mingw32/sys-root/mingw/bin/ffplay.exe.debug
done.
done.
(gdb) Exception condition detected on fd 0
error detected on stdin
----------------------------------------------
so what is the proper way to generate and extract debug info?
after we build binaries we extract debuginfo (similar as in linux)
----------------------------------------------
mingw-objcopy --only-keep-debug $f $f.debug
mingw-objcopy --add-gnu-debuglink=`basename $f.debug` --strip-unneeded
`basename $f`
----------------------------------------------
where this is the multilib version of the binutils programs.
regards.

-- 
  Levente                               "Si vis pacem para bellum!"


More information about the mingw mailing list