Caphyon / clang-power-tools

Bringing clang-tidy magic to Visual Studio C++ developers.
http://www.clangpowertools.com
Apache License 2.0
472 stars 57 forks source link

Compilation fails when include paths contain spaces #1314

Open akbyrd opened 10 months ago

akbyrd commented 10 months ago

I'm attempting to use CPT with an Unreal codebase. It ends up failing due to spaces in include paths. Snippet:

Cannot get all active documents, close all tabs and try again
PROJECT: D:\perforce\...\Engine\Intermediate\ProjectFiles\...vcxproj [DebugGame_Editor|x64]
1: D:\perforce\....cpp

...

clang++: error: no such file or directory: 'Studio\2022\Professional\VC\Tools\MSVC\14.37.32822\include -isystemC:\Program'
clang++: error: no such file or directory: 'Files\Microsoft'
clang++: error: no such file or directory: 'Visual'
clang++: error: no such file or directory: 'Studio\2022\Professional\VC\Tools\MSVC\14.37.32822\atlmfc\include -isystemC:\Program'

It looks like CPT is reading the vcxproj and isn't always escaping paths as expected when translating the msvc commands to clang commands.

mariru27 commented 10 months ago

Hi @akbyrd,

Thank you for reporting this problem.

For better understanding, can you give me the element that contains "include paths" in .vcxproj file?

Kind regards, Marina

mariru27 commented 10 months ago

Also @akbyrd, can you give us the full output log? (set verbosity level to 2 from Settings -> Compile)

mariru27 commented 9 months ago

Hi @akbyrd,

Can you set verbosity level to maximum and give us full verbose log? From Settings -> Compile -> Verbosity level

Kind regards, Marina

akbyrd commented 9 months ago

Apologies for the delay. I've truncated the log once the errors start repeating. Quite a lot more of them end up being emitted but they're duplicates.

CPT Log Verbosity 2.txt

For some additional context:

Unreal has a bit of a unique setup. The .vcxproj file is not actually used to compile directly. The project is configured with NMake commands that invoke an Unreal batch script. The script invokes a program called UnrealBuildTool that in turn invokes the compiler.

UnrealBuildTool can also emit compile_commands.json files for clang.

It's unclear to me if CPT is scraping what it can from vcxproj or doing something else. I don't necessarily expect CPT is actually going to be able to compile the project due to the custom build tool (though it would be awesome if it ended up working out that way), but I would expect it to be failing somewhere other than include paths.

mariru27 commented 9 months ago

Hi @akbyrd,

Try to update Clang Power Tools to v2023.9.0 Let me know if you still have the same issue

Kind regards, Marina