Yan Zhu
Yan Zhu

Reputation: 4356

multiple-version gcc management in gentoo system

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

Upvotes: 4

Views: 2535

Answers (2)

wrtlprnft
wrtlprnft

Reputation: 138

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)"

Upvotes: 0

Chewi
Chewi

Reputation: 530

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

Upvotes: 5

Related Questions