debugging a crash on Windows

Thiago Macieira thiago at macieira.org
Sat Jun 7 13:57:50 PDT 2014


Em sáb 07 jun 2014, às 13:45:13, Dirk Hohndel escreveu:
> On Sat, Jun 07, 2014 at 01:33:37PM -0700, Thiago Macieira wrote:
> > Em sáb 07 jun 2014, às 12:13:51, Dirk Hohndel escreveu:
> > > On June 7, 2014 10:56:16 AM Thiago Macieira <thiago at macieira.org> wrote:
> > > > Em sáb 07 jun 2014, às 08:02:11, Dirk Hohndel escreveu:
> > > > >  My biggest problem is that I cannot produce debug builds for
> > > > > 
> > > > > Windows - this fails with my cross build environment. So I'm really
> > > > > at a
> > > > > loss how to debug this.
> > > > 
> > > > What's the problem there? Are you getting errors trying to link to
> > > > libQt5Cored.dll that doesn't exist anywhere?
> > > 
> > > Yep. Exactly
> > 
> > Add this to your qmake command-line:
> > 
> > 'QMAKE_CFLAGS_RELEASE=$$QMAKE_CFLAGS_DEBUG -O0'
> > 'QMAKE_CXXFLAGS_RELEASE=$$QMAKE_CXXFLAGS_DEBUG -O0'
> 
> I'm curious what this does... so you are asking me to make a release
> version but to use the debug flags with a -O0 thrown in for good measure...

Yes.

> which means it is NOT trying to link against the debug versions of the Qt
> libraries I assume (since the compile finishes). But then - what's
> different under Windows?

Visual Studio.

The Microsoft compiler has a separate switch for whether you're building 
against the static runtime or the dynamic runtime, and whether you're using 
the debug version or the release version (-MT, -MTd, -MD, -MDd). Because of 
the debug/release split of Visual Studio, Qt on Windows inherited the split 
and hence has two DLLs for each module.

If you set CONFIG of "debug", it will add a "d" to the DLL name. Since Fedora 
and OpenSUSE only have release DLLs, you need to use a CONFIG of "release" but 
just compile Subsurface code with -O0 -g (the QMAKE_C...FLAGS_DEBUG variables 
contain the -g).

In time: on Mac, Qt also has a similar split. Qt can build in debug-and-
release mode. But, unlike Windows, you always link to just the plain library 
name. To trigger the loading of the debug libraries, you have to set 
DYLD_IMAGE_SUFFIX=_debug in the environment.

Qt 4.0 and 4.1 had that split on Linux as well, but it was removed by 4.2 
because it was a headache for everyone. It would be nice if ld-linux.so had a 
similar environment variable as Mac's dyld.

> I reverted Linus' patch, added these two lines, rebuilt the binary (after
> making clean) and installed on Windows. Same problem, same crash report
> devoid any information whatsoever.
> 
> So I'm missing something, right? :-)

Well, first thing is to check whether the flags applied. The Makefile should have 
them as the last thing in CFLAGS and CXXFLAGS before $(DEFINES).

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358



More information about the subsurface mailing list