4

I know we can always use eselect to change the compiler version. My question is that possible to bind different version to different users. For example, I would like root to use stable version for sure. and meanwhile, I would like my normal user to use some edge-cutting version.

I expect some clean solution instead of switch manually by using eselect

Thanks

Yan Zhu
  • 4,036
  • 3
  • 21
  • 37
  • The Gentoo forum might be a better place to ask this question. That or Serverfault/SuperUser. – paul Mar 13 '12 at 17:13

2 Answers2

5

I really hope you're not using eselect for this. eselect-compiler was killed off years ago because it was experimental and had many problems. gcc-config is what you should be using. Unfortunately it doesn't have per-user support like we have for Java. You can always call the specific version explicitly (e.g. gcc-4.6.2 instead of just gcc). If you're building software with autotools then you can do it with...

CC=gcc-4.6.2 ./configure
make
Chewi
  • 530
  • 3
  • 4
0

You can use gcc-config to print the environment variables necessary to use a specific GCC version. For example, to use gcc-7.2.0 for the remainder of your shell session:

eval "$(gcc-config --print-environ x86_64-pc-linux-gnu-7.2.0)"
wrtlprnft
  • 128
  • 1
  • 4