Author Topic: switching between different versions of GCC when using custom Makefile  (Read 5727 times)

Offline von.hake

  • Multiple posting newcomer
  • *
  • Posts: 16
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?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: switching between different versions of GCC when using custom Makefile
« Reply #1 on: February 02, 2012, 12:14:42 pm »
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!]

Offline von.hake

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: switching between different versions of GCC when using custom Makefile
« Reply #2 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?

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: switching between different versions of GCC when using custom Makefile
« Reply #3 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.

Offline von.hake

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: switching between different versions of GCC when using custom Makefile
« Reply #4 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.