Linking problem with -m32 option in the Update 2 of Intel® C++ Composer XE 2013 SP1and workaround provided

1.   Problem Description :

Using -m32 option causes "ld: skipping incompatible intel64/libirc.a when searching for -lirc"  related warnings

2.   Details to demonstate and workaround :

$ source /opt/intel/composerxe/bin/compilervars.sh intel64

$ echo $LIBRARY_PATH
/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/ipp/../compiler/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/ipp/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64:/opt/intel/composer_xe_2013_sp1.2.144/tbb/lib/intel64/gcc4.4

$ icc qa.cpp -static -gcc-name=/opt/gcc/gcc-4.8.1/bin/g++ -m32 -v

--------------------
ld .....-L/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/ia32

--------------------
ld: skipping incompatible /opt/intel/composer_xe_2013_sp1.2.144/ipp/../compiler/lib/intel64/libsvml.a when searching for -lsvml
ld: skipping incompatible /opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/libsvml.a when searching for -lsvml
ld: skipping incompatible /opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/libirc_s.a when searching for -lirc_s
ld: skipping incompatible /opt/intel/composer_xe_2013_sp1.2.144/ipp/../compiler/lib/intel64/libirc_s.a when searching for -lirc_s
ld: skipping incompatible /opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/libirc_s.a when searching for -lirc_s
--------------------Compilation Fails.

$ cat qa.cpp
#include <iostream>
int main(int argc, char *argv[])
{
    int foo = 5;
    foo+=5;
    int bar = foo;

    std::cout <<"Hello World!" << std::endl;
}

Workaround for this problem is

1)   adding one more explicit option '-L/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/ia32' at the end when compiles ,although you can observe that implicit option '-L/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/ia32' has been added by compiler/linker's driver above.

OR

2)   unsetting the LIBRARY_PATH environment setting

$ export LIBRARY_PATH=

$ icc qa.cpp -static -gcc-name=/opt/gcc/gcc-4.8.1/bin/g++ -m32  //This would compiles successfully without linking warnings and linkage abortion.

3.   Short explanation :

The Intel compiler driver automatically sets the Intel specific library directory depending on target architecture as long as the compiler is run from an expected installed directory structure.

Intel64 specific directory is being added to LIBRARY_PATH in the vars scripts. Any external setting of values like LIBRARY_PATH take precedence over internal settings done by the driver.

The above workaround can do by not setting LIBRARY_PATH to contain the Intel specific directories in the vars files for the product, since the driver should be able to find this information. Period.

 

 

 

For more complete information about compiler optimizations, see our Optimization Notice.

Comments

Yes ,but -m32 should work as

There have two customers reported this problem ,-m32 is a justifiable user behavior no matter in ia32 setting or intel64 setting.

Yes ,but -m32 should work as defined like gcc even after sourcing intel64 ,which tells the compiler to generate code for IA-32 architecture no matter whether compiler and libraries are for IA-32 or Intel64 architecture .


Hi,

Hi,

To tell the truth, I do not fully understand the problem background. Why is it impossible to use the ia32 version of the compiler?

source /opt/intel/composerxe/bin/compilervars.sh ia32

Regards, Alex