ogre icon indicating copy to clipboard operation
ogre copied to clipboard

Switching between release/ debug not possible

Open paroj opened this issue 6 years ago • 8 comments

for multi-config generators, notably Xcode and MSVC, switching release/ debug builds is not possible. This is due to the dependencies being installed with the config of the first build and not being rebuild accordingly. The workaround for now is to use two build directories - one for release and one for debug.

example error messages:

LNK2038 mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2'
LNK2038	mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug'

paroj avatar Oct 17 '19 16:10 paroj

I'm getting this with Visual Studio Build Tools 2019:

...
[C:\Projects\NonTerra\__build\OGRE\Tools\AssimpConverter\OgreAssimpConverter.vcxproj]
[build] assimp-vc142-mt.lib(Importer.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in main.obj [C:\Projects\NonTerra\__build\OGRE\Tools\AssimpConverter\OgreAssimpConverter.vcxproj]
[build] assimp-vc142-mt.lib(Importer.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in main.obj 
...

Deleting my __build directory and doing a total reconfigure/rebuild gets the same error. All the other tools build fine. It's just OgreAssimpConverter that doesn't ever build.

I did notice that even though I'm building a Debug config, I have __build\OGRE\Dependencies\lib\assimp-vc142-mt.lib instead of __build\OGRE\Dependencies\lib\assimp-vc142-mtd.lib

MBetters avatar Sep 19 '20 14:09 MBetters

to get a debug build, you must specify the build-type at configure time via CLI:

cmake.exe -DCMAKE_BUILD_TYPE=Debug ...

otherwise CMake just uses Release by default, but you only get to choose the type in the GUI after you hit configure.

paroj avatar Sep 19 '20 14:09 paroj

hello there, I ask myself, is it possible or is there anybody kind enough, and I know it's time consumming but it's important, just for helping newbies like me, to have a clear receipe, step by step, without considering that we know, a kind of tutorial about how to construct ogre fully and successfully with msvc 2019 both in debug, and release for everyone can enjoy this great (well it seems great ) framework. Can I say thank you in advance ? And may be ... please, command line only beacuse it seems cmake-gui will not be the good tool if I understand well, am I?

aldric-diamoco avatar Mar 07 '22 09:03 aldric-diamoco

cmake.exe -DCMAKE_BUILD_TYPE=Debug thank you well I did try this command, if I understand well it sets the variable for a debug build, and i need it bad because, the lack of working sample with qt 6 lead me to progress very slowly and I need to trace what happens.

here is the final result of the command

-- Configuring done CMake Error in CMakeLists.txt: IMPORTED_LOCATION not set for imported target "assimp::assimp" configuration "Debug".

CMake Error in CMakeLists.txt: IMPORTED_LOCATION not set for imported target "assimp::assimp" configuration "Release".

CMake Error in CMakeLists.txt: IMPORTED_LOCATION not set for imported target "assimp::assimp" configuration "MinSizeRel".

CMake Error in CMakeLists.txt: IMPORTED_LOCATION not set for imported target "assimp::assimp" configuration "RelWithDebInfo".

CMake Error in CMakeLists.txt: IMPORTED_LOCATION not set for imported target "assimp::assimp" configuration "Debug".

CMake Error in CMakeLists.txt: IMPORTED_LOCATION not set for imported target "assimp::assimp" configuration "Release".

CMake Error in CMakeLists.txt: IMPORTED_LOCATION not set for imported target "assimp::assimp" configuration "MinSizeRel".

CMake Error in CMakeLists.txt: IMPORTED_LOCATION not set for imported target "assimp::assimp" configuration "RelWithDebInfo".

-- Generating done CMake Generate step failed. Build files cannot be regenerated correctly.

aldric-diamoco avatar Mar 07 '22 10:03 aldric-diamoco

hello there, I ask myself, is it possible or is there anybody kind enough, and I know it's time consumming but it's important, just for helping newbies like me, to have a clear receipe, step by step, without considering that we know, a kind of tutorial about how to construct ogre fully and successfully with msvc 2019 both in debug, and release for everyone can enjoy this great (well it seems great ) framework. Can I say thank you in advance ? And may be ... please, command line only beacuse it seems cmake-gui will not be the good tool if I understand well, am I?

I use cmake-gui (v 3.23.2+) and build release and debug separately just like paroj recommends above.

  1. use github to pull down the tag/version of ogre you want.
  2. for debug builds, open a command console window and type: set CMAKE_BUILD_TYPE=Debug. then from the same command window launch "C:\Program Files\CMake\bin\cmake-gui.exe". for release builds, just launch cmake-gui.exe from windows desktop / start menu (you don't need to set the environment variable or use the command window)
  3. if your ogre source is at d:\source\ogre3d\ogre then place the cmake output at d:\source\ogre3d\ogre\build\debug or d:\source\ogre3d\ogre\build\release. image
  4. hit configure in cmake and set CMAKE_BUILD_TYPE to Debug or Release. Same for CMAKE_CONFIGURATION_TYPES.
  5. configure ogre the way you want but you can take the defaults for the most part.
  6. generate your debug or release version of OGRE.SLN.
  7. start OGRE.SLN and rebuild the CMakePredefinedTargets->INSTALL.

creadmefford avatar Jun 13 '22 15:06 creadmefford

tested this yesterday with cmake 3.23.2 and ogre 13.4.0. (despite the screenshot saying 3.23.1)

creadmefford avatar Jun 13 '22 15:06 creadmefford

use cmd like follow :

"C:\Program Files\CMake\bin\cmake.exe" -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=Debug -DOGRE_BUILD_RENDERSYSTEM_D3D9=OFF -DOGRE_BUILD_RENDERSYSTEM_TINY=ON -DOGRE_BUILD_RENDERSYSTEM_VULKAN=ON -DFreeImage_INCLUDE_DIR="H:/CodeLib/FreeImage3180/FreeImage/Dist/x64" -DFreeImage_LIBRARY_DBG="H:/CodeLib/FreeImage3180/FreeImage/Dist/x64/FreeImaged.lib" -DFreeImage_LIBRARY_REL="H:/CodeLib/FreeImage3180/FreeImage/Dist/x64/FreeImage.lib" -DCMAKE_CXX_FLAGS="/DWIN32 /D_WINDOWS /W3 /GR /EHsc -I \"h:\VulkanSDK\1.3.243.0\Include\"" -DCMAKE_CONFIGURATION_TYPES="Debug" ..\ogre

cannot work.

and, use :

I use cmake-gui (v 3.23.2+) and build release and debug separately just like paroj recommends above.

1. use github to pull down the tag/version of ogre you want.

2. for debug builds, open a command console window and type: set CMAKE_BUILD_TYPE=Debug.  then from the same command window launch "C:\Program Files\CMake\bin\cmake-gui.exe".  for release builds, just launch cmake-gui.exe from windows desktop / start menu (you don't need to set the environment variable or use the command window)

3. if your ogre source is at d:\source\ogre3d\ogre then place the cmake output at d:\source\ogre3d\ogre\build\debug or d:\source\ogre3d\ogre\build\release.
   ![image](https://user-images.githubusercontent.com/976243/173384681-d688542d-8cd5-4edd-92ac-088332bb3e47.png)

4. hit configure in cmake and set CMAKE_BUILD_TYPE to Debug or Release.  Same for CMAKE_CONFIGURATION_TYPES.

5. configure ogre the way you want but you can take the defaults for the most part.

6. generate your debug or release version of OGRE.SLN.

7. start OGRE.SLN and rebuild the CMakePredefinedTargets->INSTALL.

also cannot work.

.

it always build with "RelWithDebugInfo" mode. how can i build in Debug mode ?

CMake v3.26.0

@paroj

Lyoko-Jeremie avatar Apr 17 '23 07:04 Lyoko-Jeremie