Skip to content
Advertisement

Configuring for a compiler different than the default while running configure

I am compiling the glibc library. Before I could do that, I need to run configure. However, for compiling glibc, I need to use the gcc compiler which is not the default compiler on the machine. The manual says the following.

JavaScript

Now my problem is that I don’t have any administrative rights on that machine. So how can I use a compiler different than the default.

Advertisement

Answer

On linux anyone can change environment variables of their process and no admin rights are needed.

In bash:

JavaScript

In csh use

JavaScript

Any program started in this shell after such command will have CC variable in its environment. (Env vars are remembered by bash, csh or other shell). You can add this command to your ~/.bashrc file to make this setting permanent.

There are other ways to pass CC to configure too, e.g. in bash it is possible to set environment variable to single command, without remembering:

JavaScript

PS and popular ./configure CC=gcc is not an environment variable change and is specific to configure implementation (but most configures support this)

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement