Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: von.hake on February 02, 2012, 12:06:46 pm

Title: switching between different versions of GCC when using custom Makefile
Post by: von.hake on February 02, 2012, 12:06:46 pm
Hi!

I have two different versions of GCC installed on my Debian Linux.

I just noticed that when I run the Makefile from inside Code::Blocks, other version of GCC is being used than when I run the same Makefile from the terminal.
Normally I switch between the GCC versions by specifying PATH and LD_LIBRARY_PATH variables in .bashrc.
But how do I change the version of the compiler when running the custom Makefile from Code-Blocks?
Title: Re: switching between different versions of GCC when using custom Makefile
Post by: oBFusCATed on February 02, 2012, 12:14:42 pm
You can probably use the envvar plugin to specify the PATH/LD_LIBRARY_PATH variables.
Title: Re: switching between different versions of GCC when using custom Makefile
Post by: von.hake on February 02, 2012, 03:55:09 pm
Thanks for the suggestion. I played with envvar plugin and figured out that it really matters. For some reason however I get the PATH variable modified somehow else.
So, basically, I set PATH in envvar as
Code
/opt/zombo:/opt/gcc-4.4.3/bin:$PATH

then in Makefile after echo $(PATH) I get
Code
/opt/gcc-4.2.1/bin:/opt/zombo:/opt/gcc-4.4.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

Thus I assume someone really wants to use gcc 4.2.1.
Could anyone explain this?
Title: Re: switching between different versions of GCC when using custom Makefile
Post by: Jenna on February 02, 2012, 07:56:00 pm
I guees the compiler you have set for your project (most likely default compiler) has /opt/gcc-4.2.1 as masterpath.
If the project/target is build, the masterpath with a trailing bin will prepended to the existing path.

We don't need this for custom makefile projects, because the makefiles normally setup the compiler themselves.

I will see if it is easy to change this behaviour for custom makefile projects.
Title: Re: switching between different versions of GCC when using custom Makefile
Post by: von.hake on February 03, 2012, 10:25:44 am
Thanks for the explanation, Jens.
I resolved the issue by changing GCC's Compiler's installation directory in Settings->Compiler&Debugger->Global compiler settings->Toolchain executables.