Build with bDebugBuildsActuallyUseDebugCRT

I want to compile the Unreal Engine source to use the CRT Debug feature. But, I cannot.

I’ll explain what I’ve tried.

Engine source version is 4.25.4. I compiled with Debug Editor + Win64(x64) and compile successed.

Now, in order to use CRT Debug, I turned on the bDebugBuildsActuallyUseDebugCRT provided by the engine and built it. ( I wrote bDebugBuildsActuallyUseDebugCRT = true; in UE4Editor.Target.cs )

There are a lot of errors. I will attach the build log at this time. [ 02_UE_4_25_4_Compile_Debug_bDebugBuildsActuallyUseDebugCRT.txt ]

In my opinion, even if compiled with Debug, ThirdParty Library seems to use Release-Lib.
When bDebugBuildsActuallyUseDebugCRT is turned on, it tries to use the debug version lib, and I think that is the cause of the build-error.

For example, looking at CEF3.build.cs


if (Target.Configuration == UnrealTargetConfiguration.Debug && Target.bDebugBuildsActuallyUseDebugCRT)
{
    WrapperLibraryPath += "/Debug";
}
else
{
    WrapperLibraryPath += "/Release";
}

Even if the config is debug, if bDebugBuildsActuallyUseDebugCRT is false, then release is used.

Looking at PhysX, there is no debug version of lib. It had the source so it could be built.
(UE4\Engine\Source\Programs\AutomationTool\Scripts\BuildPhysX.Automation.cs / I remarked all the P4 parts in this file, and compiled with debug-option to create debug-lib.)

And, I built the engine again. I will also attach the build log at this time. [ 03_UE_4_25_4_Compile_Debug_bDBAUDebugCRT_PhyX.txt ]

Most of the errors are 2 below.


1>libgvr.lib(gvr_controller.obj) : error LNK2038: mismatch detected for ‘_ITERATOR_DEBUG_LEVEL’: value ‘0’ doesn’t match value ‘2’ in SharedPCH.UnrealEd.ShadowErrors.h.obj

1>libgvr.lib(gvr_controller.obj) : error LNK2038: mismatch detected for ‘RuntimeLibrary’: value ‘MD_DynamicRelease’ doesn’t match value ‘MDd_DynamicDebug’ in SharedPCH.UnrealEd.ShadowErrors.h.obj


It will be solved by building all of the ThirdParty Libraries with debug. However, we can’t get all the sources from ThirdParty.

I found a way to get around the _ITERATOR_DEBUG_LEVEL and RuntimeLibrary errors.
I tried using _ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH and _ALLOW_RUNTIME_LIBRARY_MISMATCH that I found.

Added 2 things to Project Property → NMake → Preprocessor Definitions. And I built it but it still doesn’t work. Attach log [ 04_UE_4_25_4_Compile_Debug_bDBAUDebugCRT_ALLOW.txt ]

I also added it to ThirdParty’s build.cs. I put the following in GoogleVRController.Build.cs.


if (Target.Platform == UnrealTargetPlatform.Win64)
{
    PublicDefinitions.Add("_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH");
    PublicDefinitions.Add("_ALLOW_RUNTIME_LIBRARY_MISMATCH");
}

It still doesn’t work. Attach log [ 05_UE_4_25_4_Compile_Debug_bDBAUDebugCRT_ALLOW_build_cs.txt ]

===========================

[Summary]

  1. Unreal Engine 4.25.4. I built with Debug Editor + Win64(x64). Success.

  2. Build with bDebugBuildsActuallyUseDebugCRT = true. Failure.

  3. Add _ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH, _ALLOW_RUNTIME_LIBRARY_MISMATCH and build. Failure.

[Conclusion]

  1. I want to build succeeds even if Debug Editor + Win64(x64) and bDebugBuildsActuallyUseDebugCRT = true.

  2. I want to build succeeds with _ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH and _ALLOW_RUNTIME_LIBRARY_MISMATCH.

===========================

Hello,

We’ve made a switch to a new bug reporting method using a more structured form. Please visit the link below for more details and report the issue using the new Bug Submission Form. Feel free to continue to use this thread for community discussion around the issue.

Thanks