Linux rdm compile_commands.json

Hey, i am using rdm (with emacs) for my game development. rdm requires a compile_commands.json file which is a file that contains all the the compile commands for the code. I am trying to create one for my game code and for UE4 engine code. usually to generate the compile_commands.json we run “bear” on the compile program, bear expect that the output of the compilation program to be with verbose with all of the command to compile the code but i cant get this from the game compilation.
Is there a way to generate compile_commands.json? Or somehow add --verbose to the clang command?

This was added to UBT in 4.24, the magic incantation is:

 UnrealBuildTool.exe -mode=GenerateClangDatabase -project="YourProject.uproject" -game -engine ProjectName Development Win64 

i.e., add -mode=GenerateClangDatabase to a normal UBT command for your project. The only documentation of this I see is in the 4.24 Release Notes which also mentions a -Filter parameter.

Thank you. I can confirm I have successfully set it up and managed to run it successfully using the following command in powershell: & ‘C:\Program Files\Epic Games\UE_4.24\Engine\Binaries\DotNET\UnrealBuildTool.exe’ -mode=GenerateClangDatabase -project=“ProjectName.uproject” ProjectName Development Win64". This basically created a “compile_commands.json” file in “C:\Program Files\Epic Games\UE_4.24”.

I do all development on Vim so I am trying to use the ccls language server (which uses clangd) to be able to read from the generated compile_commands.json file. The core development is done in WSL Linux (Ubuntu 18), and hence it’s required for the file to be translated such that it can be read with Linux paths namely as the output generated by UnityBuildTool is using Windows paths. It seems that just using this open source python function was able to do the job wsl-compile-commands-converter/ at master · Kazhuu/wsl-compile-commands-converter · GitHub

I am currently still getting syntax error highlights in the file, even though the “go-to-reference” shortcuts still work. For example, I get errors for the object inheritance “Super” reference, however if I hit go-to-reference it still takes me to the respective source code. Have you been able to resolve this?

Hi. Can we generate the clang database on Linux and use clangd there? I would like to develop from emacs(spacemacs) on linux if possible.

Same situation here, not able to use -mode=GenerateClangDatabase it complaints about not finding clang, which is insatlled.

Yeah, ‘-mode=GenerateClangDatabase’ currently doesn’t work on Linux at the moment.

There’s was a pull-request which adds Linux support, but the author has stopped maintaining it.

The author claims that the VSCode project generator creates a usable compile_commands.json, but I can’t figure out how to make that work with ccls.