News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

switching between different versions of GCC when using custom Makefile

Started by von.hake, February 02, 2012, 12:06:46 PM

Previous topic - Next topic

von.hake

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?

oBFusCATed

You can probably use the envvar plugin to specify the PATH/LD_LIBRARY_PATH variables.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

von.hake

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 /opt/zombo:/opt/gcc-4.4.3/bin:$PATH

then in Makefile after echo $(PATH) I get
/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?

Jenna

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.

von.hake

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.