Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: ollydbg on September 28, 2025, 06:14:40 am

Title: The library search path is not included in the PATH in the compilergcc plugin
Post by: ollydbg on September 28, 2025, 06:14:40 am
Hi, I just build C::B trunk yesterday, and I found that if I link to a dll file directly, and the dll file is in the library search path. The old C::B can run the executable. But the latest failed, because it said the exe can't find the dll file.

Which means the PATH is not including the library search path?

I looked at the change history of the compiler gcc folder, and still not sure which commit cause this issue. The old C::B I'm using is built from 2025-02.
Title: Re: The library search path is not included in the PATH in the compilergcc plugin
Post by: Miguel Gimenez on September 28, 2025, 09:26:32 am
I would bet r13731 (https://sourceforge.net/p/codeblocks/code/13731/) (Running compiled program fails because of wrong PATH) is related.
Title: Re: The library search path is not included in the PATH in the compilergcc plugin
Post by: ollydbg on September 28, 2025, 04:13:15 pm
I would bet r13731 (https://sourceforge.net/p/codeblocks/code/13731/) (Running compiled program fails because of wrong PATH) is related.

Thanks.

Yes, I think this is related.

Especially here:

Code
@@ -1445,8 +1453,10 @@ int CompilerGCC::DoRunQueue()
     else
         m_timerIdleWakeUp.Start(100);
 
-    // restore dynamic linker path
+    // restore old dynamic linker path
     wxSetEnv(CB_LIBRARY_ENVVAR, oldLibPath);
+    // restore old PATH environment
+    wxSetEnv("PATH", oldPath);
 
     delete cmd;
     return DoRunQueue();

The old "PATH" get restored.

I think when we click the "run" button on the toolbar, we should also set the PATH, and when run finished, we should restore the PATH.

Hi, Morten, can you have a look?