gcc version compatibility on osx, correct usage of gcc-name ?

gcc version compatibility on osx, correct usage of gcc-name ?

Hello,

I have had some issues with icpc (18.0.0) and gcc version compatibility on osx. I have things working now, but the output warnings from the compiler is confusing and I'm not sure if I'm doing something the "wrong" way.

Specifically, I have some code that does not compile using icpc without additional flags on osx, but works fine on linux. I isolated the cause to be gcc compatibility, and the fact that a header-only template library I am using requires advanced features. Using icpc normally results in various errors when compiling the code. This is the version and gcc compatibility:

$ icpc -v -c
icpc version 18.0.0 (gcc version 4.9.0 compatibility)

If I only select a different gcc-name, it makes no difference, and I still get errors when compiling my code:

$ icpc -v -gcc-name=gcc-7 -c
icpc: command line warning #10006: ignoring unknown option '-gcc-name=gcc-7'
icpc version 18.0.0 (gcc version 4.9.0 compatibility)

If I also use the flag -no-use-clang-env, then I obtain:

$ icpc -v -no-use-clang-env -gcc-name=gcc-7 -c
icpc: command line warning #10006: ignoring unknown option '-no-use-clang-env'
icpc: command line warning #10006: ignoring unknown option '-gcc-name=gcc-7'
icpc: warning #10376: '-stdlib=libc++' is only supported in the Clang environment (-use-clang-env)
icpc version 18.0.0 (gcc version 7.2.0 compatibility)

This is quite confusing since it says it is ignoring unknown options but they are not completely ignored. In fact, my code compiles with these flags but the linker then fails to find various variables, as one might expect from warning #10376. In order to get the linker to work I must also link with the flags

-L/usr/local/Cellar/gcc/7.2.0/lib/gcc/7/ -lstdc++

where you can see that my gcc-7.2.0 is from homebrew. It is possible to avoid icpc warning #10376 by using the flag -stdlib=libstdc++ when compiling, but the line above is still required to link properly.

Is this the right way to go about things?

On a different but related note, on linux when using the flag '-gcc-name=gcc-7' there is no warning but the output is a little confusing:

$ icpc -v -gcc-name=gcc-7 -c
icpc version 18.0.0 (gcc version 7.0.0 compatibility)

even though my gcc-7 is version 7.2.0. Everything seems to work just fine, however.

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Menlo; color: #f4f4f4; background-color: #000000; background-color: rgba(0, 0, 0, 0.9)}
span.s1 {font-variant-ligatures: no-common-ligatures}

1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.