Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: Wkerry on April 24, 2025, 04:42:48 am

Title: ClangD causing cc1plus.exe error pop up dialog on Windows
Post by: Wkerry on April 24, 2025, 04:42:48 am
Finally got some time to look into the pop up error below that I ported in March and found that if I disable the clangd plugin the error does to occur, but I cannot get the

---------------------------
cc1plus.exe - System Error
---------------------------
The code execution cannot proceed because libmpc-3.dll was not found. Reinstalling the program may fix this problem.
---------------------------
OK   
---------------------------

I have the clangd exe configured as:
C:\msys64\mingw64\bin\clangd.exe

The following command
C:\msys64\clang64\bin>C:\msys64\mingw64\bin\clangd.exe --version
clangd version 20.1.2
Features: windows
Platform: x86_64-w64-windows-gnu

I have the compiler default set to GNU GCC MSYS MingW64 with the install directory set to C:\msys64\mingw64

I get the following gcc version:
C:\msys64\mingw64\bin\gcc.exe --version
gcc.exe (Rev3, Built by MSYS2 project) 14.2.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


There is nothing logged in the debug log even after adding the following parameters when I start C::B from the C:\Program Files\CodeBlocks directory
codeblocks.exe /d /v

I am using C::B 2025.3 64 bit without the Winlib compiler

Any ideas where to look or what to check or what to change to get rid of the error dialog?
Title: Re: ClangD causing cc1plus.exe error pop up dialog on Windows
Post by: stahta01 on April 24, 2025, 05:23:40 am
I would try installing the dll that it claims to be missing.

Code
pacman -S mingw-w64-x86_64-mpc
Title: Re: ClangD causing cc1plus.exe error pop up dialog on Windows
Post by: stahta01 on April 24, 2025, 05:30:20 am
PLEASE do not mix two mingw environments under MSys2 and think it will work!!!!

Code
C:\msys64\clang64\bin>C:\msys64\mingw64\bin\clangd.exe --version
Code
C:\msys64\mingw64\bin\gcc.exe --version

Mixing MINGW64 and CLANG64 will not work very well and will result in weird errors!!!!!

Tim S.
Title: Re: ClangD causing cc1plus.exe error pop up dialog on Windows
Post by: Wkerry on April 24, 2025, 06:05:37 am
I am not mixing MINGW64 and CLANG64. Clangd client is doing the "mixing", but I cannot figure out the mixing it is doing.

I have the compiler default set to GNU GCC MSYS MingW64 with the install directory set to C:\msys64\mingw64

The clangd plugin is configured for the clangd exe as:
    C:\msys64\mingw64\bin\clangd.exe

The --version shows that the gcc.exe and clangd.exe work correctly if they are used, so some other gcc.exe or clangd.exe is being called. I will rename the MSYS\*.32 directories and see if this helps.
Title: Re: ClangD causing cc1plus.exe error pop up dialog on Windows
Post by: Wkerry on April 24, 2025, 06:08:27 am
If I rename the C:\msys64\mingw32 directory to C:\msys64\mingw32.test I do not get the error pop up.
Title: Re: ClangD causing cc1plus.exe error pop up dialog on Windows
Post by: gd_on on April 24, 2025, 12:11:16 pm
Your installation look strange. If your rename solves the problem, it's probably because you use something inside mingw32, so you mix 32 and 64 bits exes. Check the paths and their order.
I use also msys2 distribution, also with clangd which is inside c:\msys64\mingw64\bin (as installed by mingw-w64-x86_64-clang-tools-extra msys2 package). As I use only 64 bits, all folders like C:\msys64\mingw32, C:\msys64\clang32 or C:\msys64\clang64 contain only empty folders, so for me, no way to use something there.
Title: Re: ClangD causing cc1plus.exe error pop up dialog on Windows
Post by: stahta01 on April 24, 2025, 03:52:02 pm
Somewhere there is a setting for which clangd is used by Code::Blocks check that is correct.

Edit: Best guess "settings->Editor"

To devs: Feature request that the setting of "$(TARGET_COMPILER_DIR)\bin\clangd.exe" works for clangd plugin; the clang plugin already has the code; but, the value  of $(TARGET_COMPILER_DIR) is not know at the point in time; might not be possible for it to be known

Edit2: Looks like code is too complex for me to understand ClgdCompletion::OnAppStartupDone

Tim S.
Title: Re: ClangD causing cc1plus.exe error pop up dialog on Windows
Post by: stahta01 on April 24, 2025, 05:47:43 pm
Possible work around what I am guessing is the cause.

A. Add Global var of "MSYS2_MINGW64" set base to "C:\msys64\mingw64"
1. Settings -> global variables
2. Add Global var of "MSYS2_MINGW64"
3. Set base to correct location ex. "C:\msys64\mingw64"

B. Set path of clang exec to use to "$(#MSYS2_MINGW64)\bin\clangd.exe"
1. Settings -> Editor
2. Select clangd_client from left pane
3. Tab "C/C++ parser"
4. Set exec to use to "$(#MSYS2_MINGW64)\bin\clangd.exe"

Tim S.

Title: Re: ClangD causing cc1plus.exe error pop up dialog on Windows
Post by: Pecan on April 24, 2025, 06:41:28 pm
Somewhere there is a setting for which clangd is used by Code::Blocks check that is correct.

Edit: Best guess "settings->Editor"

To devs: Feature request that the setting of "$(TARGET_COMPILER_DIR)\bin\clangd.exe" works for clangd plugin; the clang plugin already has the code; but, the value  of $(TARGET_COMPILER_DIR) is not know at the point in time; might not be possible for it to be known

Edit2: Looks like code is too complex for me to understand ClgdCompletion::OnAppStartupDone

Tim S.

I'll look to see if this is workable.
I vaguely remember that I tried this, but the needed macros were unknown at project load which is where the clangd.exe needs to be set.
But I'll look at it again anyway.
Title: Re: ClangD causing cc1plus.exe error pop up dialog on Windows
Post by: stahta01 on April 24, 2025, 07:04:39 pm
Somewhere there is a setting for which clangd is used by Code::Blocks check that is correct.

Edit: Best guess "settings->Editor"

To devs: Feature request that the setting of "$(TARGET_COMPILER_DIR)\bin\clangd.exe" works for clangd plugin; the clang plugin already has the code; but, the value  of $(TARGET_COMPILER_DIR) is not know at the point in time; might not be possible for it to be known

Edit2: Looks like code is too complex for me to understand ClgdCompletion::OnAppStartupDone

Tim S.

I'll look to see if this is workable.
I vaguely remember that I tried this, but the needed macros were unknown at project load which is where the clangd.exe needs to be set.
But I'll look at it again anyway.

It does replace with global variable which means you are likely right and the value is empty at that time.

Edit: A more important related bug is it fails to find the clangd.exe in the MINGW installation folder of an CB installed with Mingw compiler.
Title: Re: ClangD causing cc1plus.exe error pop up dialog on Windows
Post by: Wkerry on April 25, 2025, 03:57:46 am
More info:

If I change the "GNU GCC Compiler" installation directory from C:\msys64\mingw32 to C:\msys64\mingw64 the error goes away.
I have the "GNU GCC MSYS MinGW64 Compiler" compiler setup as default.

The CC_ProxyProject.cbp has the <Option compiler="gcc" /> which when I load it and look at which compiler it is using it is the "GNU GCC Compiler" compiler. It looks like "GNU GCC Compiler" has at some stage has detected the compiler in the C:\msys64\mingw32 directory.

I did configure MSYS2 for both 32 and 64 bit originally as I had to support some 32 bit XP apps, but I have not used the 32 bit tool-chain for a few years.
Title: Re: ClangD causing cc1plus.exe error pop up dialog on Windows
Post by: Pecan on April 27, 2025, 08:04:02 pm
[Edit: A more important related bug is it fails to find the clangd.exe in the MINGW installation folder of an CB installed with Mingw compiler.

How did clangd.exe get installed with MINGW?
None of my Mingw folders contains clang.exe along with any of it's resources.

Do you mean the ...\msys64_18.1.8\mingw64\ folder? (or similar versions)?
Title: Re: ClangD causing cc1plus.exe error pop up dialog on Windows
Post by: stahta01 on April 27, 2025, 10:43:09 pm
[Edit: A more important related bug is it fails to find the clangd.exe in the MINGW installation folder of an CB installed with Mingw compiler.

How did clangd.exe get installed with MINGW?
None of my Mingw folders contains clang.exe along with any of it's resources.

Do you mean the ...\msys64_18.1.8\mingw64\ folder? (or similar versions)?

On Windows using the CB25.03 installer with MINGW GCC compiler it also has the clangd.exe and other clang stuff installed.
The auto detection does not find it.

Edit:
Code
$(CodeBlocks)\MinGW\bin\clangd.exe

Tim S.
Title: Re: ClangD causing cc1plus.exe error pop up dialog on Windows
Post by: Pecan on May 03, 2025, 05:32:56 pm
[Edit: A more important related bug is it fails to find the clangd.exe in the MINGW installation folder of an CB installed with Mingw compiler.

How did clangd.exe get installed with MINGW?
None of my Mingw folders contains clang.exe along with any of it's resources.

Do you mean the ...\msys64_18.1.8\mingw64\ folder? (or similar versions)?

On Windows using the CB25.03 installer with MINGW GCC compiler it also has the clangd.exe and other clang stuff installed.
The auto detection does not find it.

Edit:
Code
$(CodeBlocks)\MinGW\bin\clangd.exe

Tim S.

The installer does not install a clangd.exe that supports Mingw.
The clangd included in those binaries is for the clang compiler only.
Using the clangd.exe included in those binaries with Mingw will cause spurious (incorrect) error messages.

If you're using Mingw, use the Msys2 Mingw64/bin/clangd.exe instead.

Do not mix the clang compiler clangd with the Mingw clangd.
Title: Re: ClangD causing cc1plus.exe error pop up dialog on Windows
Post by: stahta01 on May 03, 2025, 07:18:01 pm
[Edit: A more important related bug is it fails to find the clangd.exe in the MINGW installation folder of an CB installed with Mingw compiler.

How did clangd.exe get installed with MINGW?
None of my Mingw folders contains clang.exe along with any of it's resources.

Do you mean the ...\msys64_18.1.8\mingw64\ folder? (or similar versions)?

On Windows using the CB25.03 installer with MINGW GCC compiler it also has the clangd.exe and other clang stuff installed.
The auto detection does not find it.

Edit:
Code
$(CodeBlocks)\MinGW\bin\clangd.exe

Tim S.

The installer does not install a clangd.exe that supports Mingw.
The clangd included in those binaries is for the clang compiler only.
Using the clangd.exe included in those binaries with Mingw will cause spurious (incorrect) error messages.

If you're using Mingw, use the Msys2 Mingw64/bin/clangd.exe instead.

Do not mix the clang compiler clangd with the Mingw clangd.

okay