intel icc编译linux,How icc/icpc uses GCC on LInux?

Hello, Sergey, Judith.

Thanks for your comments.

@Sergey Kostrov

Sorry I did not get your idea. It seems that you misunderstood the question. The question was not about GCC, but about icc/icpc/ifort (and their relation to GCC.

@Judith Ward

Judith Ward (Intel) wrote:

icc and icpc are only compilers.They use the GNU tools on the system. So for example, they use the GNU header files like stdio.h and GNU linker and libraries. For these reasons the compiler has to be compatible with GNU -- for example if you have GNU version 4.6 on your system, icc/icpc tries to act just like GNU 4.6 (with the same features and bugs).

The Idea in general is clear. But the details are fo interest. For example, when I compiled application with different flags in one case I got compilation error (not linkage) and in other case (i've specified -gcc-name and -gcc-version) I did not get these errors. This means, that compiler behaves differently (treat code differently), when these options are supplied.

So the question is: What exactly changes? Are there some imposed "Defines" or it just parses the code differently or something else?

For example, say, I have two "system" versions of GCC installed on my linux system: GCC 4.4 (standard, current) and GCC3.4 (legacy, compatibility). And I have code, that can be compied with, e.g. 3.4 and cannot be compiled with 4.4. Does it mean, that if I compile the same code with icc, then specifying -gcc-version or -gcc-name (or both) to particular version of GCC, then the behavior will be the same?

Judith Ward (Intel) wrote:

So the compiler will try to figure out which version of GNU you have installed by looking at the gcc or g++ in your PATH. You can override this behaviour by using some of the -gcc switches above.

The cxxlib switches have to do with linking in the GNU C++ library libcxx.

Please read the documentation and if you have a specific question please ask. Do an icpc -help for documentation.

This is another, less general and more technical question: which flags are enough. How icc/icpc searches for GCC (of specific version).

For example, if I do not provide any of those flags, then I guess, gcc will try to find, which executable will be launched if "gcc" command is invoked. Then it tries to figure out its version and enables corresponding "features" (effectively sets -gcc-version to this version).

Again, my guess, that if we set -gcc-name to some specific gcc executable (and not -gcc-version), than icc will try to execute it, find out the version and set corresponding value for -gcc-version. Is it right?

Now let's assume we've set -gcc-version option. Will the compiler search for the GCC of this version or it will just check, that default "gcc" have correct or incorrect version and "fail" if the version is incorrect? If it does search, how it does it? Do it tries to search for the command like "gcc

What will happen if we define both: -gcc-name and -gcc-version, which contradict each other?

Other questions are related to interrelations between gcc and g++:

if we set e.g. -gcc-version to non-default, does it mean that g++ will either be called of this specified versoin?

if we set -gcc-name (and as I guessed before compiler understand, that it have non-default -gcc-version) which version of c++ will be used?

Why there is no -gxx-version option? (by analogy with -gcc-version), or if we gan use -gcc-version when compiling C++, why there is -gxx-name (why cannot we just use gcc-name? or we can?).

What will happen if we define -gcc-name and -gxx-name and they point to executables from different GCC versions?

And questions about linkage:

What is the impact of -cxx-lib=dir? Why it points to the directory, not to the file?

Does it only have impact on link time or on compile time either (I mean, if I use -c -cxxlib=dir, will the -cxxlib=dir be ignored or it will influence compilation somehow)?

What is the difference betwen flags -cxxlib-nostd and -no-cxxlib? Are these options intended to be used, when I want to compile/link my application with custom (non-system and may be even non-gcc) standard C++ library line stl-port?

Why there is no such options for standar C library (only for C++)?

I've asked many questions. If at least some of them will get answers I will really appreciate it.

Thanks in advance.

Dmitry.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值