The original issue I encountered:
https://forums.codeblocks.org/index.php/topic,24967.0.html
I found that the CodeCompletion plugin cause this issue, if I disable the plugin, there's no missing cygwin dll error anymore.
Looking into the source, the plugin only brings in the master path of the compiler, but not the extra path.
In NativeParser::AddCompilerIncludeDirsToParser:
// find out which compiler, if gnu, do the special trick
// to find it's internal include paths
// but do only once per C::B session, thus cache for later calls
if (compiler->GetID().Contains(_T("gcc")))
AddGCCCompilerDirs(compiler->GetMasterPath(), compiler->GetPrograms().CPP, parser);
So when I set the Cygwin dll path to the "Additional Paths" in Global Compiler Setting UI, the plugin will not use it.
Maybe it should handle the path setting like the Compiler plugin?
In CompilerGCC::SetupEnvironment, it brings in both master & extra path when setting PATH environment variable.
So, you mean the fix could be just adding the extra path of the compiler plugin?
Yes, I think that should fix the issue.
Also note that there might be multiple places to add the extra path, since I got the missing dll error message at least 4 times when I load first project after launching codeblocks.
Hi, I looked at this issue today. The actual command to run the gcc is in this function:
Here, I don't see the CodeCompletion plugin has to tweak the
PATH
environment variable. It just call the command.Now, to handle this issue, I have two solutions, but both of those two solutions are not related to CodeCompletion plugin.
1, you can use the
Environment variable
plugin to add the extra path of your GCC path to thePATH
.2, you can tweak some compiler plugin source code to add the extra path to your
PATH
.For me, I think the first solution is simple.
Last edit: ollydbg 2022-12-13
So the extra path was not designed to be applied when executing compiler executable?
I made a patch to CoceCompletion plugin for this issue. I have test it on my project, no missing dll error appeared.
Hi, @zetab007, thanks for the patch.
I just looked at the patch, and I see that you have add the extra path when running the command, so you are correct. I was wrong that I said CodeCompletion plugin did not tweak the PATH variable.
In-fact, it adds the master path temperately, and later reset the
PATH
.You patch just adding extra path to the
PATH
variable.Hi @ollydbg,
I'm not very familiar with CodeCompletion plugin, just made a quick modification to fix the issue. So if you find any inappropriate change, you could correct it.
Another thing, I also found some very similar functions in clangd_client plugin when I was searching in the source tree, but I didn't touch them. Maybe that plugin will have similar issue.
I think I will commit your patch to the SVN.
I don't have cygwin, but I see the patch is correct.
I fix a build error
compiler->GetExtraPaths
should becompiler->GetExtraPaths()
, and add a doxygen document aboutSafeExecute
function.It is fixed in r13117 now.
Now, I guess the clangd_client plugin also need such fix.
Let's ask @pecan, what's your opinion?