[Development] ICU and Windows

Shaw Andy Andy.Shaw at digia.com
Fri Jan 11 14:32:35 CET 2013


As I was investigating a different problem I came across a bigger issue regarding ICU on Windows.  The problem is that when ICU is linked against on Windows it links against the same copy of the library even if it is building for release which causes a problem with C runtime libraries on Windows if you use MSVC.

For those who are not aware of the issue here whenever you link an application or library on Windows with MSVC then it will use a setting for the C runtime libraries, Qt defaults to using the release version for release builds (-MD) and the debug version for debug builds (-MDd).  And provided the same one is used for all the libraries linked against and the application then everything is fine.  However if they were to be mixed then it opens up the potential for memory corruption to occur as it ends up with two memory heaps in use by the application.

Unfortunately this is what is happening now if ICU is linked in, ICU will always use the release version so if Qt is built in debug mode then it will end up mixing the C runtime libraries.

Since ICU doesn't provide the debug version of the libraries in their binary packages then this means that either the user has to build them themselves (which means modifying the target as well since the output for debug and release defaults to be the same in their project files) or we should consider adding them to the 3rdparty section (like we do for libegl and so on) so we can control the situation better.

Either way I feel that this needs to be fixed ASAP because we could end up seeing bug reports that are in effect caused by this and end up creating more noise as a result.   A short term option (and potentially permanent) would be to link against a different version of the ICU libraries and point out that if they want to use Qt in debug they would need to build ICU themselves and make the relevant modifications to the output library names.

Regards,
Andy
--
Andy Shaw
Head of Support,
Digia, Qt



More information about the Development mailing list