Error trying to build with ASAN on Windows Topic is solved

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


jwwalker
Goblin
Posts: 291
Joined: Thu Aug 12, 2021 10:06 pm
Location: San Diego, CA, USA
x 21

Error trying to build with ASAN on Windows

Post by jwwalker »

I'm trying to build OgreNextMain on Windows with Address Sanitizer turned on, in Visual Studio Community 2022, but I get a slew of link errors like this:

Code: Select all

1>FreeImage_d.lib(Plugin.obj) : error LNK2038: mismatch detected for 'annotate_string': value '0' doesn't match value '1' in OgreAbiUtils.obj
1>FreeImage_d.lib(Plugin.obj) : error LNK2038: mismatch detected for 'annotate_vector': value '0' doesn't match value '1' in OgreAbiUtils.obj
1>FreeImage_d.lib(FreeImage.obj) : error LNK2038: mismatch detected for 'annotate_string': value '0' doesn't match value '1' in OgreAbiUtils.obj
1>FreeImage_d.lib(FreeImage.obj) : error LNK2038: mismatch detected for 'annotate_vector': value '0' doesn't match value '1' in OgreAbiUtils.obj

I pulled the latest changes from the ogre-next-deps repository and rebuilt, but that didn't help. What do these errors mean?

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5509
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1378

Re: Error trying to build with ASAN on Windows

Post by dark_sylinc »

It's been a while since I've tried ASAN on Windows.
Are you enabling ASAN via CMake option OGRE_ADDRESS_SANITIZER_ASAN or by manually modifying the VS Project?

The error you see indicates there's a setting disagreement in how ogre-next-deps was compiled vs ogre-next.
It may get fixed if ogre-next-deps is also forced to be compiled with ASAN.

jwwalker
Goblin
Posts: 291
Joined: Thu Aug 12, 2021 10:06 pm
Location: San Diego, CA, USA
x 21

Re: Error trying to build with ASAN on Windows

Post by jwwalker »

I turned on ASAN in the VS project. You are correct, turning on ASAN for FreeImage (not all of ogre-next-deps) make the link succeed! Thanks.