Closed jahn00 closed 7 months ago
@jahn00 We need more repro info. Can you confirm that it doesn't repro if the "compileCommands" property is commented out? I believe an argument in that compile_commands.json is triggering the issue. If you set C_Cpp.loggingLevel to "Debug" and look at the C++ logging output window you should see some error related to querying of the clang-cl.exe compiler with some particular args which we may not be handling correctly, so if you could provide that logging or let us know which args are triggering the failure then we can fix the issue.
Also, what version of LLVM/clang are you using?
Also, it sounds like the bug doesn't repro with 1.18.5 (i.e. the recommended workaround would be to downgrade to that until we can release a fix).
No repro on previous version, 1.18.5, no repro when commenting out compileCommands
C++ log output after setting to "Debug": https://pastebin.com/H121W2rs
LLVM version 16.0.0, not 17 due to compatibility with intellisense.
FWIW, I'm working in Microsoft Edge/Chromium.
Hi @jahn00 . The C/C++ Extension will attempt to invoke your compiler to auto-detect system include paths and defines. If you look into the log, you'll see some command lines that were attempted. Do these command lines work properly for you, if you execute them manually? If not, you will likely see the same error the extension is encountering.
Running a command line from your log with clang-cl.exe 16, I get the following error:
clang-cl: error: unknown argument ignored in clang-cl: '-instcombine-lower-dbg-declare=0' [-Werror,-Wunknown-argument]
When this type of issue is due to the C/C++ Extension failing to properly parse the original command line or compose a query command line, it's usually straight-forward for us to address that, provided the original command line used for configuration and the logged attempted command line.
Could you provide an example command line from your compile_commands.json
? It's possible there is a transformation occurring from the original command line to the query command line, which is corrupting one of the arguments. Or perhaps you are not using the same version of clang-cl
that the compile_commands.json
command lines were intended to be run against? Does the original command line from compile_commands.json
work properly for you when run directly?
I'm reproing this to - i have to go back to v1.19.2 to have any luck, and am currently using llvm 17 (error: [2/29/2024, 11:32:21 AM] Unable to resolve configuration with compilerPath: "D:\blue\src/third_party/llvm-build/Release+Asserts/bin/clang-cl.exe") when this repros it looks like the extension infinite loops and sucks up memory launching and relaunching clang-cl, which makes vscode almost unusable. { "directory": "D:\blue\src\out\debug_x64", "command": "D:\blue\depot_tools\.cipd_bin\gomacc.exe ..\..\third_party\llvm-build\Release+Asserts\bin\clang-cl.exe /c ../../apps/app_lifetime_monitor.cc /Foobj/apps/apps/app_lifetime_monitor.obj /nologo /showIncludes:user /winsysroot../../third_party/depot_tools/win_toolchain/vs_files/57841fa63e -DDCHECK_ALWAYS_ON=1 -DUSE_AURA=1 \"-DEXCLUDE_FROM_EDGE=@\\"EXCLUDE_FROM_EDGE is not a valid macro. Did you mean EXCLUDED_FROM_EDGE?\\"\" -DMICROSOFT_EDGE_BUILD -DEDGE_HISTORY_JOURNAL_TELEMETRY -DEDGE_THIRD_PARTY_SERP_TELEMETRY -D_HAS_NODISCARD -D_CRT_NONSTDC_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE \"-DCR_CLANG_REVISION=\\"llvmorg-16-edge-init-103681-g10381cb1-1\\"\" -DCOMPONENT_BUILD -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ASSERTIONS_DISABLE_ASSUME -DCR_LIBCXX_REVISION=715a7b8509e789c7cbc32b89800086010cd2c0a9 -DSTD_C -D_CRT_RAND_S -D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_DEPRECATE -D_ATL_NO_OPENGL -D_WINDOWS -DCERT_CHAIN_PARA_HAS_EXTRA_FIELDS -DPSAPI_VERSION=2 -DWIN32 -D_SECURE_ATL -DWRL_DISABLE_STATIC_INITIALIZE -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -DWIN32_LEAN_AND_MEAN -DNOMINMAX -D_UNICODE -DUNICODE -DNTDDI_VERSION=NTDDI_WIN10_NI -D_WIN32_WINNT=0x0A00 -DWINVER=0x0A00 -D_DEBUG -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DSK_ENABLE_SKSL -DSK_UNTIL_CRBUG_1187654_IS_FIXED \"-DSK_USER_CONFIG_HEADER=\\"../../skia/config/SkUserConfig.h\\"\" -DSK_WIN_FONTMGR_NO_SIMULATIONS -DSK_DISABLE_LEGACY_SKSURFACE_METHODS -DSK_DISABLE_LEGACY_GRAPHITE_IMAGE_FACTORIES -DSK_DISABLE_LEGACY_GRAPHITE_IMAGE_METHODS -DSK_DISABLE_LEGACY_SKSURFACE_FACTORIES -DSK_DISABLE_LEGACY_SKSURFACE_FLUSH -DSK_DISABLE_LEGACY_SKSURFACE_AS_IMAGE -DSK_DISABLE_LEGACY_SKSURFACE_DISPLAYLIST -DSK_DISABLE_LEGACY_IMAGE_SUBSET_METHODS -DSK_DISABLE_LEGACY_IMAGE_COLORSPACE_METHODS -DSK_DISABLE_LEGACY_IMAGE_RELEASE_PROCS -DSK_DISABLE_LEGACY_GL_BACKEND_SURFACE -DSK_DISABLE_LEGACY_INIT_DECODERS -DSK_DISABLE_LEGACY_GRDIRECTCONTEXT_FLUSH -DSK_DISABLE_LEGACY_GRDIRECTCONTEXT_BOOLS -DSK_DISABLE_LEGACY_GL_GRDIRECTCONTEXT_FACTORIES -DSK_DISABLE_LEGACY_PNG_WRITEBUFFER -DSK_SLUG_DISABLE_LEGACY_DESERIALIZE -DSK_DISABLE_LEGACY_VK_GRDIRECTCONTEXT_FACTORIES -DSK_DEFAULT_TYPEFACE_IS_EMPTY -DSK_DISABLE_LEGACY_DEFAULT_TYPEFACE -DSK_DISABLE_LEGACY_VULKAN_BACKENDSEMAPHORE -DSK_DISABLE_LEGACY_CREATE_CHARACTERIZATION -DSK_DISABLE_LEGACY_FONTMGR_REFDEFAULT -DSK_DISABLE_LEGACY_FONTMGR_FACTORY -DSK_CODEC_DECODES_JPEG -DSK_ENCODE_JPEG -DSK_ENCODE_PNG -DSK_ENCODE_WEBP -DSKIA_DLL -DSKCMS_API=declspec(dllexport) -DGR_GL_FUNCTION_TYPE=stdcall -DSK_GANESH \"-DSK_GPU_WORKAROUNDS_HEADER=\\"gpu/config/gpu_driver_bug_workaround_autogen.h\\"\" -DSK_GL -DSK_VULKAN=1 -DSK_GRAPHITE -DSK_DAWN -DVK_USE_PLATFORM_WIN32_KHR -DWEBP_EXTERN=extern -DUSE_EGL -DLIBYUV_DISABLE_NEON -D_WTL_NO_AUTOMATIC_NAMESPACE -DTOOLKIT_VIEWS=1 -DON_FOCUS_PING_ENABLED -DABSL_CONSUME_DLL -DBORINGSSL_SHARED_LIBRARY -DGOOGLE_PROTOBUF_NO_RTTI -DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER -DGOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL_INLINE=0 -DPROTOBUF_USE_DLLS -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DUSE_CHROMIUM_ICU=1 -DU_ENABLE_TRACING=1 -DU_ENABLE_RESOURCE_TRACING=0 -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE -DWEBRTC_ENABLE_SYMBOL_EXPORT -DWEBRTC_ENABLE_AVX2 -DRTC_ENABLE_WIN_WGC -DWEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0 -DWEBRTC_CHROMIUM_BUILD -DWEBRTC_WIN -DABSL_ALLOCATOR_NOTHROW=1 -DLOGGING_INSIDE_WEBRTC -DWGPU_SHARED_LIBRARY -DCRASHPAD_ZLIB_SOURCE_EXTERNAL -DLEVELDB_PLATFORM_CHROMIUM=1 -DLEVELDB_SHARED_LIBRARY -DV8_USE_EXTERNAL_STARTUP_DATA -DUSING_V8_SHARED -DUSING_V8_SHARED_PRIVATE -DV8_ENABLE_CHECKS -DV8_COMPRESS_POINTERS -DV8_COMPRESS_POINTERS_IN_SHARED_CAGE -DV8_31BIT_SMIS_ON_64BIT_ARCH -DV8_ENABLE_SANDBOX -DV8_DEPRECATION_WARNINGS -DCPPGC_CAGED_HEAP -DCPPGC_YOUNG_GENERATION -DCPPGC_POINTER_COMPRESSION -DCPPGC_ENABLE_LARGER_CAGE -DCPPGC_SLIM_WRITE_BARRIER -DFLATBUFFERS_LOCALE_INDEPENDENT=0 -I../.. -Igen -I../../buildtools/third_party/libc++ -I../../third_party/perfetto/include -Igen/third_party/perfetto/build_config -Igen/third_party/perfetto -I../../third_party/skia -Igen/third_party/skia -I../../third_party/wuffs/src/release/c -I../../third_party/vulkan/include -I../../third_party/vulkan-deps/vulkan-headers/src/include -Igen/third_party/dawn/include -I../../third_party/dawn/include -I../../third_party/libwebp/src/src -I../../third_party/khronos -I../../gpu -I../../net/third_party/quiche/overrides -I../../net/third_party/quiche/src/quiche/common/platform/default -I../../net/third_party/quiche/src -I../../third_party/libyuv/include -Igen/third_party/private_membership/src -Igen/third_party/shell-encryption/src -Igen/components/policy/proto -I../../third_party/wtl/include -I../../base/allocator/partition_allocator/src -Igen/base/allocator/partition_allocator/src -I../../third_party/abseil-cpp -I../../third_party/boringssl/src/include -I../../third_party/protobuf/src -Igen/protoc_out -I../../third_party/ipcz/include -Igen/net/third_party/quiche/src -I../../third_party/ced/src -I../../third_party/icu/source/common -I../../third_party/icu/source/i18n -I../../third_party/webrtc_overrides -I../../third_party/webrtc -Igen/third_party/webrtc -I../../third_party/crashpad/crashpad -I../../third_party/crashpad/crashpad/compat/win -I../../third_party/zlib -I../../third_party/libwebm/source -I../../third_party/mesa_headers -I../../third_party/leveldatabase -I../../third_party/leveldatabase/src -I../../third_party/leveldatabase/src/include -I../../third_party/libaom/source/libaom -I../../third_party/libaom/source/config/win/x64 -I../../v8/include -I../../third_party/re2/src -I../../third_party/flatbuffers/src/include -I../../third_party/flatbuffers/src/src -I../../third_party/flatbuffers/src -I../../third_party/flatbuffers/generated /W4 -Wimplicit-fallthrough -Wunreachable-code-aggressive -Wunreachable-code-aggressive -Wthread-safety -Wno-missing-field-initializers -Wno-unused-parameter -Wno-psabi -Wloop-analysis -Wno-unneeded-internal-declaration -Wno-nonportable-include-path -Wenum-compare-conditional -Wno-ignored-pragma-optimize -Wno-unqualified-std-cast-call -Wno-deprecated-builtins -Wno-bitfield-constant-conversion -Wno-deprecated-this-capture -Wno-invalid-offsetof -Wno-vla-extension -Wno-thread-safety-reference-return -Wshadow /WX -fno-delete-null-pointer-checks -fno-ident -fcolor-diagnostics -fmerge-all-constants -fcrash-diagnostics-dir=../../tools/clang/crashreports -Xclang -mllvm -Xclang -instcombine-lower-dbg-declare=0 -mllvm -split-threshold-for-reg-with-hint=0 /clang:-ffp-contract=off -fcomplete-member-pointers /Gy /FS /bigobj /utf-8 /Zc:twoPhase -ffile-reproducible /Zc:sizedDealloc- /D__WRL_ENABLE_FUNCTION_STATICS -fmsc-version=1934 /Zc:dllexportInlines- -m64 /Brepro -Wno-builtin-macro-redefined -DDATE= -DTIME= -DTIMESTAMP= -ffile-compilation-dir=. -no-canonical-prefixes -ftrivial-auto-var-init=pattern /Od /Ob0 /GF /Z7 -gcodeview-ghash -Xclang -fuse-ctor-homing /guard:cf,nochecks /MDd -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ref-template-as-trivial-member -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ptr-exclude-path=/third_party/dawn/ -Xclang -plugin-arg-find-bad-constructs -Xclang check-stack-allocated -Xclang -plugin-arg-find-bad-constructs -Xclang check-raw-ptr-to-stack-allocated -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wexit-time-destructors -Wno-redundant-parens -Wno-redundant-parens -Wno-null-pointer-subtraction -DPROTOBUF_ALLOW_DEPRECATED=1 -Wno-constant-conversion -Wno-shorten-64-to-32 -Wno-undefined-bool-conversion -Wno-tautological-undefined-compare /std:c++20 -Wno-trigraphs /TP /GR- -I../../third_party/libc++/src/include /Fd\"obj/apps/apps_cc.pdb\"", "file": "../../apps/app_lifetime_monitor.cc", "output": "obj/apps/apps/app_lifetime_monitor.obj" },
1_19_2.log 1_19_4.log (debug level logs)
@jahn00 Fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/v1.19.5
@sean-mcmanus - I Updated to 1.19.5 and went down from infinite errors to ~56 errors in configuration warnings.
Looking at the debug log, 1_19_5.log it looks like it's still failing multiple times to get the compiler config.
LOL
[3/5/2024, 3:50:47 PM] Unable to resolve configuration with compilerPath "E:\red\src/third_party/llvm-build/Release+Asserts/bin/clang-cl.exe". Using "E:\red\src\out\debug_x64/..\..\third_party\llvm-build\Release+Asserts\bin\clang-cl.exe" instead.
The only difference here is the relative pathing and the "/" vs "\" also looking at my log, it's failing to find include paths from the compiler command line that are relative paths.
snippet:
Compiler query command line: E:\red\src\out\debug_x64/..\..\third_party\llvm-build\Release+Asserts\bin\clang-cl.exe /c /nologo **/winsysroot../../third_party/depot_tools/win_toolchain/vs_files/57841fa63e** /WX -fno-delete-null-pointer-checks -fno-ident -fcolor-diagnostics -fmerge-all-constants -fcrash-diagnostics-dir=../../tools/clang/crashreports -Xclang -mllvm -Xclang -instcombine-lower-dbg-declare=0 -mllvm -split-threshold-for-reg-with-hint=0 /clang:-ffp-contract=off -fcomplete-member-pointers /Gy /bigobj /utf-8 /Zc:twoPhase -ffile-reproducible /Zc:sizedDealloc- -fmsc-version=1934 /Zc:dllexportInlines- -m64 /Brepro -ffile-compilation-dir=. -no-canonical-prefixes -ftrivial-auto-var-init=pattern /Od /Ob0 /GF /Z7 -gcodeview-ghash -Xclang -fuse-ctor-homing /guard:cf,nochecks /MDd /std:c++20 -fsanitize-ignorelist=../../third_party/intune_mamclient/mamsdk-asan-ignorelist.txt /EHsc /GR /clang:-m64 /clang:-v /clang:-E /clang:-dM /TP /clang:-fno-blocks nul
Compiler include path not found: **../../third_party/depot_tools/win_toolchain/vs_files/57841fa63e\DIA SDK\include**
Compiler include path not found: ../../third_party/depot_tools/win_toolchain/vs_files/57841fa63e\VC\Tools\MSVC\14.35.32215\include
Compiler include path not found: ../../third_party/depot_tools/win_toolchain/vs_files/57841fa63e\VC\Tools\MSVC\14.35.32215\atlmfc\include
Compiler include path not found: ../../third_party/depot_tools/win_toolchain/vs_files/57841fa63e\Windows Kits\10\Include\10.0.22621.0\ucrt
Compiler include path not found: ../../third_party/depot_tools/win_toolchain/vs_files/57841fa63e\Windows Kits\10\Include\10.0.22621.0\shared
Compiler include path not found: ../../third_party/depot_tools/win_toolchain/vs_files/57841fa63e\Windows Kits\10\Include\10.0.22621.0\um
Compiler include path not found: ../../third_party/depot_tools/win_toolchain/vs_files/57841fa63e\Windows Kits\10\Include\10.0.22621.0\winrt
Compiler include path not found: ../../third_party/depot_tools/win_toolchain/vs_files/57841fa63e\Windows Kits\10\Include\10.0.22621.0\cppwinrt
Attempting to get defaults from C++ compiler in compile_commands.json file: 'E:\red\src\out\debug_x64/..\..\third_party\llvm-build\Release+Asserts\bin\clang-cl.exe'
Hi @jahn00 . I see this error in your log:
clang-cl: error: no such file or directory: '../../third_party/intune_mamclient/mamsdk-asan-ignorelist.txt'
In 1.19.x, we fixed a bug where the directory
field of the compile_commands.json
entry was not properly being used as the current working directory when evaluating the compiler args. Are you sure this file is accessible using this relative path, from that directory?
I also see the following:
clang-cl: error: -fdelayed-template-parsing is deprecated after C++20 [-Werror,-Wdelayed-template-parsing-in-cxx20]
This is a deprecation message, so I would have assumed it would be a warning. We should probably remove occurrences of /WX
or -Werror
, for the purpose of the compiler query. But wouldn't this cause the original command line to fail in a similar manner?
yes, the directory field is: "E:\red\src\out\debug_x64" and the file is at: e:/red/src/third_party/intune_mamclient/mamsdk-asan-ignorelist.txt
this doesn't repro in 1.19.2
Hi @jahn00 . The fix to properly use the contents of the directory
field as the cwd was made in 1.19.3. I just tried to repro this, and the following scenario worked properly for me with 1.19.5:
I have a test.txt
in Z:\somewhere\
I have a compile_commands.json
with the following:
[
{
"directory": "Z:\\repos",
"command": "\"C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\Llvm\\x64\\bin\\clang-cl.exe\" -fsanitize-ignorelist=../test.txt -c ./test1.cpp",
"file": "test.cpp"
}
]
And the currently open workspace folder is Z:\repos\test
This seems to work as expected. Any changes to that path in the compile_commands.json
results in the warning.
Can you confirm the full path to your workspace folder, to mamsdk-asan-ignorelist.txt
and the contents of the directory
field for the file(s) that refer to it with a that relative path?
Environment
OS and Version: Win 11 Pro 22631.3155
VS Code Version: Version: 1.86.2 (user setup) Commit: 903b1e9d8990623e3d7da1df3d33db3e42d80eda Date: 2024-02-13T19:40:56.878Z Electron: 27.2.3 ElectronBuildId: 26908389 Chromium: 118.0.5993.159 Node.js: 18.17.1 V8: 11.8.172.18-electron.0 OS: Windows_NT x64 10.0.22631
C/C++ Extension Version: 1.19.4
If using SSH remote, specify OS of remote machine:
Bug Summary and Steps to Reproduce
Bug Summary: VSCode C++ extension no longer detecting my C++ compiler
Steps to reproduce:
Expected behavior: No error output on launch.
Configuration and Logs
Other Extensions
No response
Additional context
No response