[mythtv] Win32 + QT4 segfault: resolved

Andrei Tanas andrei at tanas.ca
Tue Jul 1 19:52:47 UTC 2008


Almost absolutely correct. I wouldn't say that the references needed to be resolved at run time though: the actual exception was happening inside ntdll.dll code, when it was trying to initialize the static const references with addresses of cross-dll inherited class instances while loading the dlls.
It's hard to tell whose responsibility it is: QT used static const, gcc put the variables into the read-only segment, even though it was impossible to resolve the references at compile time, and Windows put the segment into read-only mode before finishing resolving the references. I would say that QT and gcc haven't done anything "illegal", and Windows should have been smarter than that.
If you and Arnon were so close, why haven't you tried to test your theory, or at least haven't told me what you new? It was fun chasing this stuff, but i spent over 15 hours on it.
Anyway, looks like QT4 didn't mess things up too badly, it's in almost working condition now.

Regards,
Andrei.


----- Original message -----
Andrei,

It seems my theory was correct earlier... if I understand
correctly.... basically it means that (at least under mingw/msys) that
'extern const'  is NOT allowed to refer to a DATA section (as created
by the 'const' keyword) (eg: extern const struct, or extern const
QMetaObject in this case )  if any/all of the data comes from a DLL.
I think.

This results in a DLL with an .rdata section that contains a run-time
resolved reference to the data/struct/etc, and because it's in a
read-only (.rdata) section of the executable, it can't be "run-time
resolved", because the piece of application is loaded into memory as
read-only, which SHOULD made sense if it's a .rdata section, right??
clearly not.

Arnon was also correct in his determination that it was related to the
QMetaObject, and the fact that it had changed ('const' added) from
QT3->QT4 had also not escaped him, so well done to all!

I am currently building with a modified win32-packager.pl script ...
and will let you all know how I go......(including changing to qt
4.4.0, so the qt build is slow.... )  quick patch will come after I
know it works.....

Buzz.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mythtv.org/pipermail/mythtv-dev/attachments/20080701/587ca23b/attachment.htm 


More information about the mythtv-dev mailing list