vscode-cmake-tools icon indicating copy to clipboard operation
vscode-cmake-tools copied to clipboard

Long compilation command truncated

Open ibenlayish opened this issue 1 year ago • 2 comments

Brief Issue Summary

I have a C project with compilation database. The project is very complex and has files with thousands of lines of code. When running CMake: Compile Active File, the compilation command is spit into the newly created terminal, and below it a shell prompt with the same compilation command but truncated to 4096 (or 4095) characters. The command fails because it is truncated and gcc cannot find which file to compile (which is.the last argument) Running on vs code remote with ssh to ubuntu 20.04.

CMake Tools Diagnostics

No response

Debug Log

No response

Additional Information

No response

ibenlayish avatar Feb 07 '24 19:02 ibenlayish

@ibenlayish Thanks for the notification.

Compile single file for CMake has always been a tough problem that can often be buggy, however, this issue of compilation commands getting truncated could possibly be affecting other scenarios as well. Thanks for letting us know and we will place it on the backlog.

Until we are able to investigate this, some additional information like a repro project, the output of the CMake Tools diagnostics, and any other helpful information would be very beneficial.

gcampbell-msft avatar Feb 13 '24 14:02 gcampbell-msft

Hi @gcampbell-msft,

Thank you for addressing this.

I am using vs code with the clangd extension. I created a compilation database and disabled the C/C++ extension (which is horribly slow for my big project).

If you create a small project with a single source file, but hundreds of included files, enough to generate a long compilation command line that exceeds 4096 characters, then using CMake: Compile Active File, you will reproduce it. (I might be wrong 🤷‍♂️)

I cannot share any project details, I hope you understand.

Because the full command is printed before it is truncated, there is a manual workaround (copy the command and run it manually).

ibenlayish avatar Feb 13 '24 14:02 ibenlayish