问题描述
我正在编译glibc库。在我这样做之前,我需要运行 configure
。但是,为了编译glibc,我需要使用不是机器上默认编译器的gcc编译器。 说明了以下内容。
运行configure时,在环境
中设置CC和CFLAGS变量也很有用。 CC选择将要使用的C编译器,而CFLAGS
为编译器设置优化选项。
现在我的问题是我没有该机器上的任何管理权限。那么我怎样才能使用不同于默认值的编译器。
在bash中:
export CC =gccCFLAGS = - O3 -Wall
在csh中使用
setenv CCgcc
在这个命令后面的任何程序都会在其环境中有CC变量。 (Env vars被bash,csh或其他shell记住)。您可以将此命令添加到〜/ .bashrc
文件中以使此设置永久。
还有其他方法可以通过CC进行配置。在bash中,可以将环境变量设置为单个命令,无需记住:
CC =gccCFLAGS = - O3 -Wall./configure ...
PS和流行 ./ configure CC = gcc
不是一个环境变量的变化,并且特定于配置实现(但大多数配置都支持这个)
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.
It may also be useful to set the CC and CFLAGS variables in the environment
when running configure. CC selects the C compiler that will be used, and CFLAGS
sets optimization options for the compiler.
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.
On linux anyone can change environment variables of his process; no administrative right are needed.
In bash:
export CC="gcc" CFLAGS="-O3 -Wall"
In csh use
setenv CC "gcc"
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:
CC="gcc" CFLAGS="-O3 -Wall" ./configure ...
PS and popular ./configure CC=gcc
is not an environment variable change and is specific to configure implementation (but most configures support this)
这篇关于在运行configure时配置不同于默认值的编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!