How to debug and fix build problems?

Hello,

I’ve wrote small plugin and trying to build game with this plugin.
I’ve faced with link time problems: unresolved externals etc…

The question is: How can I debug building process ?
I saw files with externsion: Build.cs, and it’s clearly that they are executing during build…
How can I set breakpoints to these files ? Or see which include paths corresponding to projects, what static libraries are linking etc…
Because now it’s like a black box - and no way to diagnose build problem…

Thanks in advance,
Oleksandr “loopzilla” Maniliuk.

Hi, if you have full source code you can just debug UnrealBuildTool with the following command line (right click on UnrealBuildTool project → properties → Debug → Start Options) set in Visual Studio:

TargetName Platform Configuration

So assuming your game editor target name is MyGameEditor:

MyGameEditor Win64 Debug

Then just set UnrealBuildTool as your startup project in VS and Debug. All breakpoints set in you build.cs file should just work.

1 Like

Thanks for the answer !

But it doesn’t work :frowning:
I’ve set UnrealBuildTool of my project as startup,
chaned command line in Start options to: MyGameEditor Win64 Debug
Working dir by default is empty…
Set breakpoints into all funcitons in build.cs files. No breakpoints are trigered during run :frowning:

Thanks in advance,
Oleksandr

Does setting any breakpoints inside of UBT work? For example in UnrealBuiltTool.cs, private static int Main(string[] Arguments)?

Yes, in this file breakpoint works.

Ok, I tried that with a project created from a template ‘basic code’, and there should be one more parameter in that command line (path to the uproj file of the project you want to compile).

MyBasicCodeProjEditor Win64 Development “C:\Users\user.name\Documents\Unreal Projects\MyBasicCodeProj\MyBasicCodeProj.uproject”

I added a brakpoint inside MyBasicCodeProjEditorTarget constructor and it worked fine.

1 Like

Thank you,

All works fine - it really helped.

Best regards,
loopzilla

Good. Now how do you do it from the command line on linux?

Just spent a couple hours wondering why this wasn’t working, so hopefully this helps someone.

You will not be able to debug your project’s Build.cs files if your UnrealBuildTool's configuration is set to Development. Set it to Debug to make sure your project’s symbols get loaded.

The command-line arguments for the UnrealBuildTool should match the names of your target files. So for instance, if your game’s name is MyGame and you’re building your server, your configuration is DebugGame and your architecture is Win64, your arguments would be:

MyGameServer Win64 DebugGame D:\Path\To\Project\MyGame.uproject

Hope this helps.