PhysX icon indicating copy to clipboard operation
PhysX copied to clipboard

[help] MDd_DynamicDebug' doesn't match value 'MD_DynamicRelease'

Open UnidayStudio opened this issue 5 years ago • 7 comments

I'm trying to build PhysX with my app following this guide, but I'm getting the following errors when I compile my project:

1>FastEngine.lib(PhysicsSystem.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in main.obj
1>FastEngine.lib(PhysicsSystem.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MD_DynamicRelease' in main.obj

I don't know exactly what I missed but looks like PhysX keeps compiling something in debug mode

My project solutions and PhysX where compiled in Release x64 mode and the runtime library is set to Multi-threaded DLL (/MD).

Here is the config XML file that I used to generate the solution:

<?xml version="1.0" encoding="utf-8"?>
<preset name="vc15win64" comment="VC15 Win64 PhysX general settings">
  <platform targetPlatform="win64" compiler="vc15" />
  <CMakeSwitches>
    <cmakeSwitch name="PX_BUILDSNIPPETS" value="True" comment="Generate the snippets" />
    <cmakeSwitch name="PX_BUILDPUBLICSAMPLES" value="False" comment="Generate the samples projects" />
    <cmakeSwitch name="PX_GENERATE_STATIC_LIBRARIES" value="False" comment="Generate static libraries" />
    <cmakeSwitch name="NV_USE_STATIC_WINCRT" value="False" comment="Use the statically linked windows CRT" />
    <cmakeSwitch name="NV_USE_DEBUG_WINCRT" value="False" comment="Use the debug version of the CRT" />
    <cmakeSwitch name="PX_FLOAT_POINT_PRECISE_MATH" value="False" comment="Float point precise math" />
  </CMakeSwitches>
  <CMakeParams>
    <cmakeParam name="CMAKE_INSTALL_PREFIX" value="install/vc15win64/PhysX" comment="Install path relative to PhysX SDK root" />
  </CMakeParams>
</preset>```

Can you help me?

UnidayStudio avatar Sep 06 '19 01:09 UnidayStudio

Hi, not sure how this is related to PhysX compilation? From the link error I dont see anything related to PhysX SDK,

AlesBorovicka avatar Sep 06 '19 06:09 AlesBorovicka

@AlesBorovicka I don't know where to change if I want to build PhysX in MDd_DynamicDebug, MT_StaticRelease or MD_DynamicRelease. If I go to Code Generation > Runtime LIbrary it changes nothing.

UnidayStudio avatar Sep 06 '19 10:09 UnidayStudio

Here you define if debug CRT is used: cmakeSwitch name="NV_USE_DEBUG_WINCRT" value="False" comment="Use the debug version of the CRT" Or static vs dynamic CRT cmakeSwitch name="NV_USE_STATIC_WINCRT" value="False" comment="Use the statically linked windows CRT"

But again, the error has nothing to do with PhysX SDK

AlesBorovicka avatar Sep 06 '19 11:09 AlesBorovicka

Wow. "How to lose a user in 1 comment" - Written and Directed by AlesBorovicka. I have a similar issue and ended up here after a search on the interwebs.

alanjfs avatar Sep 14 '19 13:09 alanjfs

@UnidayStudio You probably solved this by now, but for future readers, I managed to solve this via a related issue here: https://github.com/NVIDIAGameWorks/PhysX/issues/62

In a nutshell, and what Ales was trying to say about was that you can edit the template XML file the generate_projects.bat file uses to build a Dynamic release instead of the default Static.

Set this to False and re-build the solution. The resulting build should say win.x86_64.vc142.md instead of the default win.x86_64.vc142.mt.

alanjfs avatar Sep 16 '19 18:09 alanjfs

Ended up referring back to this issue after having forgotten how to do it. So, for yours and my future selves copy/pasting pleasure:

physx\buildtools\presets\public\vc14win64_mdd.xml

<?xml version="1.0" encoding="utf-8"?>
<preset name="vc14win64_mdd" comment="VC14 Win64 PhysX general settings">
  <platform targetPlatform="win64" compiler="vc14" />
  <CMakeSwitches>
    <cmakeSwitch name="PX_BUILDSNIPPETS" value="False" comment="Generate the snippets" />
    <cmakeSwitch name="PX_BUILDPUBLICSAMPLES" value="False" comment="Generate the samples projects" />
    <cmakeSwitch name="PX_GENERATE_STATIC_LIBRARIES" value="False" comment="Generate static libraries" />
    <cmakeSwitch name="NV_USE_STATIC_WINCRT" value="False" comment="Use the statically linked windows CRT" />
    <cmakeSwitch name="NV_USE_DEBUG_WINCRT" value="True" comment="Use the debug version of the CRT" />
    <cmakeSwitch name="PX_FLOAT_POINT_PRECISE_MATH" value="False" comment="Float point precise math" />
  </CMakeSwitches>
  <CMakeParams>
    <cmakeParam name="CMAKE_INSTALL_PREFIX" value="install/vc14win64_mdd/PhysX" comment="Install path relative to PhysX SDK root" />
  </CMakeParams>
</preset>

Note this also sets examples and snippets to False, to speed up build times.

alanjfs avatar Nov 05 '19 11:11 alanjfs

I'm facing the same problem with static linking https://github.com/NVIDIAGameWorks/PhysX/issues/115#issuecomment-1280115308

Pacheco95 avatar Oct 17 '22 00:10 Pacheco95