[osg-users] Windows 7 beta: "The binary is not a valid Windows image."

Jean-Sébastien Guay jean-sebastien.guay at cm-labs.com
Fri Mar 27 07:36:05 PDT 2009

Hi all,

I have been running Windows 7 beta for a few weeks now at home (being 
the eternal early adopter at heart :-) ), and I just tried to compile 
and run OSG on it. Everything seems fine in debug, but I'm hitting one 
little snag in release mode.

The exact problem is discussed at length on this page:


(note that I'm using Visual Studio 2005 SP1, but the problem is exactly 
the same)

The short version is that after linking executables, when mt.exe is 
called to include the manifest into them, the executables somehow get 
corrupted (see the link above for the exact explanation) and I get the 
following error message:

mt.exe : general error c101008d: Failed to write the updated manifest to 
the resource of file "<executable file name>". The binary is not a valid 
Windows image.

This happens for every executable, every time.

According to that same link above, there are two ways to work around 
this apparent bug:

1. Enable /DYNAMICBASE in the linker options (the bug happens when using 
/DYNAMICBASE:NO, which apparently is the default in our case)

2. Include an empty RC file in each project.

I'd like to add /DYNAMICBASE into the CMake config (perhaps only for 
Windows 7 if that can be detected, and perhaps conditionally so we can 
remove the workaround when/if the bug gets fixed), but I wanted to get 
opinions. What do others think would be the best course of action (other 
than waiting for the official release of Windows 7 ;-) )? Are there any 
drawbacks to specifically linking with the /DYNAMICBASE option? I'm not 
familiar with this option, and the MSDN page does not have any 
recommendations of when to use it and when not to, it just describes it.


If I get no opinions I'll just submit a modified CMakeLists.txt that 
includes /DYNAMICBASE.

Thanks in advance,

Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com

More information about the osg-users mailing list