When I try (via autoconf) to create a simple test binary using icc, the generated call to ld inserts 32 bit files, even tho the call to icc specifies "-m64" as in:
icc -m64 -i-static -Wl,-melf_x86_64 -v --sysroot=/project/sprelcot/build/rcotTicca/tools/x86_linux_2/amd64_redhat_6.0.0/bosdeps/redhat/6.5.0 -isystem/project/sprelcot/build/rcotTicca/tools/x86_linux_2/amd64_redhat_6.0.0/bosdeps/redhat/6.5.0/usr/include -I/project/sprelcot/build/rcotTicca/export/amd64_redhat_6.0.0/usr/include -I/project/sprelcot/build/rcotTicca/export/amd64_redhat_6.0.0/usr/include/sysfs -finline-limit=65536 -axAVX -ip -D__PE__ -D__LINUX__ -D__linux__ -DMPICH_DEFINE_2COMPLEX -DFORTRAN_BACKWARD_BINCOMPAT -L/project/sprelcot/build/rcotTicca/export/amd64_redhat_6.0.0/usr/lib64 -lpami -lpthread -lrt -Wl,-melf_x86_64 --sysroot=/project/sprelcot/build/rcotTicca/tools/x86_linux_2/amd64_redhat_6.0.0/bosdeps/redhat/6.5.0 -Wl,-rpath=/opt/ibmhpc/pe13010/ppe.pami/intel/lib64/pami64 -Wl,-rpath=/opt/ibmhpc/pe13010/mpich2/intel/lib64 -Wl,--enable-new-dtags -i-static conftest.c >&5
ld /project/sprelcot/build/rcotTicca/tools/x86_linux_2/amd64_redhat_6.0.0/bosdeps/redhat/6.5.0/usr/lib/crt1.o /project/sprelcot/build/rcotTicca/tools/x86_linux_2/amd64_redhat_6.0.0/bosdeps/redhat/6.5.0/usr/lib/crti.o
The above glibc files are 32bit, but icc is invoked with the "-m64" flag. I did NOT install the 32bit version of icc. Is there some way to override this behavior? How does the intel compiler determine where the files crt1.o and crti.o and crtn.o come from?
This is for a customer using icc 12.1.5; that is the version used to produce the above error....
Ed, first of all you don't need the -m64 if you're invoking the 64 bit icc and the compiler will look for libraries under /usr/lib64. Also, it'll look for any additional system libs and headers as per the "%gcc -print-search-dirs" search paths from the invocation. That said, you have changed the system root path from what's on the system to your own path such as: "--sysroot=/project/sprelcot/build/rcotTicca/tools/x86_linux_2/amd64_redhat_6.0.0/bosdeps/redhat/6.5.0". So, ICC will look for usr/lib64 under the path you indicated in sysroot. Now, looks like it didn't find lib64 under that path may be? Of course, it still shouldn't be using usr/lib/ for the 64 bit compile but again the compiler 12.X is an old version and I don't know if a bug was fixed in later versions.
Try to make sure you create a usr/lib64 under the system root path you want and ensure all the libraries are found in there and it should then work. Make sure you've sourced the compiler environment by sourcing compilervars.sh file under the bin directory before execution so it sets the correct compiler environment. Also executing %icc -V will output the compiler version and build details so you can see if it's a 32 or a 64 bit compiler. Additionally, the compiler uses the normal system include paths and libs like /usr/lib64 if sysroot is not set as per the search path list you get when executing the %gcc -print-search-dirs as stated earlier. BTW, you don't need -melf_x86_64 as well since it automatically generates the debug code for that format as well.