What is the difference between these environment variables in terms of gcc. When is setting a path in COMPILER_PATH preferred over PATH ?
根据gcc,这些环境变量之间有什么区别。何时在COMPILER_PATH中设置路径优先于PATH?
1 个解决方案
#1
1
From its GCC documentation, COMPILER_PATH
could be used to help the compiler find the internal programs (like cc1
, cc1plus
, lto1
, collect2
, as
, ld
) needed to compile.
从其GCC文档中,COMPILER_PATH可用于帮助编译器找到编译所需的内部程序(如cc1,cc1plus,lto1,collect2,as,ld)。
You generally don't need to worry about that (I never had myself to set COMPILER_PATH
even when working inside GCC!). The gcc
(or gcc-4.7
) command is finding these internal programs quite well. Pass it the -v
flag to understand what programs it is running. Try for example gcc -Wall -v hello.c -o helloworld
; remember that gcc
is just a driving program; the real work of the compiler is done by cc1
and other internal programs (but you'll never want to run cc1
directly).
你通常不需要担心(即使在GCC内部工作,我也从未设置过COMPILER_PATH!)。 gcc(或gcc-4.7)命令可以很好地找到这些内部程序。将它传递给-v标志以了解它正在运行的程序。试试例如gcc -Wall -v hello.c -o helloworld;记得gcc只是一个驾驶计划;编译器的实际工作由cc1和其他内部程序完成(但你永远不想直接运行cc1)。
A good reading is the environ(7) man page. It explains the (important) role of the PATH
variable, used to find programs. See also the execvp(3) man page.
一个好的阅读是environ(7)手册页。它解释了用于查找程序的PATH变量的(重要)角色。另请参见execvp(3)手册页。
I also suggest to read a good book, like e.g. Advanced Linux Programming.
我还建议读一本好书,例如高级Linux编程。
You could also read Wikipedia's page on GCC.
您还可以在GCC上阅读*的页面。
In practice, don't bother about COMPILER_PATH
but be sure that your PATH
contains the directory containing your gcc
(usually gcc
is /usr/bin/gcc
so you need /usr/bin
early in your PATH
). You might also have gcc
be a symlink to ccache.
在实践中,不要打扰COMPILER_PATH,但要确保你的PATH包含包含你的gcc的目录(通常gcc是/ usr / bin / gcc,所以你需要在PATH的早期使用/ usr / bin)。您可能还有gcc是ccache的符号链接。
#1
1
From its GCC documentation, COMPILER_PATH
could be used to help the compiler find the internal programs (like cc1
, cc1plus
, lto1
, collect2
, as
, ld
) needed to compile.
从其GCC文档中,COMPILER_PATH可用于帮助编译器找到编译所需的内部程序(如cc1,cc1plus,lto1,collect2,as,ld)。
You generally don't need to worry about that (I never had myself to set COMPILER_PATH
even when working inside GCC!). The gcc
(or gcc-4.7
) command is finding these internal programs quite well. Pass it the -v
flag to understand what programs it is running. Try for example gcc -Wall -v hello.c -o helloworld
; remember that gcc
is just a driving program; the real work of the compiler is done by cc1
and other internal programs (but you'll never want to run cc1
directly).
你通常不需要担心(即使在GCC内部工作,我也从未设置过COMPILER_PATH!)。 gcc(或gcc-4.7)命令可以很好地找到这些内部程序。将它传递给-v标志以了解它正在运行的程序。试试例如gcc -Wall -v hello.c -o helloworld;记得gcc只是一个驾驶计划;编译器的实际工作由cc1和其他内部程序完成(但你永远不想直接运行cc1)。
A good reading is the environ(7) man page. It explains the (important) role of the PATH
variable, used to find programs. See also the execvp(3) man page.
一个好的阅读是environ(7)手册页。它解释了用于查找程序的PATH变量的(重要)角色。另请参见execvp(3)手册页。
I also suggest to read a good book, like e.g. Advanced Linux Programming.
我还建议读一本好书,例如高级Linux编程。
You could also read Wikipedia's page on GCC.
您还可以在GCC上阅读*的页面。
In practice, don't bother about COMPILER_PATH
but be sure that your PATH
contains the directory containing your gcc
(usually gcc
is /usr/bin/gcc
so you need /usr/bin
early in your PATH
). You might also have gcc
be a symlink to ccache.
在实践中,不要打扰COMPILER_PATH,但要确保你的PATH包含包含你的gcc的目录(通常gcc是/ usr / bin / gcc,所以你需要在PATH的早期使用/ usr / bin)。您可能还有gcc是ccache的符号链接。