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

Jean-Sébastien Guay jean-sebastien.guay at cm-labs.com
Sat Mar 28 08:44:09 PDT 2009


Hi all,

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

OK, perhaps it's a result of my previous message being overly verbose, 
but I got no responses. So I'm now going to do this and submit it.

One question for CMake experts (Philip? Mattias?): is there some way to 
know the exact version of Windows?

I'm putting my option inside the IF(WIN32) ... IF(MSVC) ... block of the 
main CMakeLists.txt (search for WIN32_USE_MP) but since this workaround 
is only needed on Windows 7, I'd like to narrow down the condition even 
more. Although I've put it as an advanced option, set the default to 
OFF, and documented it as being necessary only to work around a bug in 
Windows 7, so that could be enough too.

         # This option is to enable the /DYNAMICBASE switch
         # It is used to workaround a bug in Windows 7 when linking in
         # release, which results in corrupt executables. See this page
         # for details:
         # 
http://www.wintellect.com/CS/blogs/jrobbins/archive/2009/01/24/the-case-of-the-corrupt-pe-binaries.aspx
         OPTION(WIN32_USE_DYNAMICBASE "Set to ON to build OpenSceneGraph 
with the /DYNAMICBASE option to work around a bug when linking release 
executables on Windows 7." OFF)
         MARK_AS_ADVANCED(WIN32_USE_DYNAMICBASE)
         IF(WIN32_USE_DYNAMICBASE)
             SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} 
/DYNAMICBASE")
         ENDIF(WIN32_USE_DYNAMICBASE)

And this seems to work. I'll send the complete file as a submission soon 
if there's no way to address the question above.

J-S
-- 
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com
                                http://www.cm-labs.com/
                         http://whitestar02.webhop.org/



More information about the osg-users mailing list