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.