Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
46 Views

Cross compiler for intel64 on 32-bit Linux

I have recently downloaded an evaluation copy of the 11.1 C/C++ compiler.

icc -V returns:
$ icc -v
Version 11.1
$ icc -V
Intel C Compiler Professional for applications running on IA-32, Version 11.1 Build 20100414 Package ID: l_cproc_p_11.1.072
Copyright (C) 1985-2010 Intel Corporation. All rights reserved.
30 DAY EVALUATION LICENSE

icc: NOTE: The evaluation period for this product ends on 10-jul-2010 UTC.


this is installed on a Linux box running 32-bit RHEL5

$ uname -a
Linux bldlnx33.ppd.pok.ibm.com 2.6.18-92.el5PAE #1 SMP Tue Apr 29 13:31:02 EDT 2008 i686

Can I create 64-bit output (intel64) using this configuration? Under my install location, I see only a single intel64 directory (./tbb/intel64).

If I source iccvars.sh intel64, I do not get an error, but nothing in my environment changes. The 32bit compilation seems to be fine.... If I try to use the -m64 flag, I get:

icc -v -m64 -c cfoo.c -o cfoo.o
Unsupported machine model: GLOB_MACHINE_MODEL_EFI2
compilation aborted for cfoo.c (code 1)


Did I download the wrong product?

Is there some install-time option to enable cross-compilation for intel64?

Is it possible to generate 64bit output using this compiler running on a 32-bit machine?

Do I need separate versions of the Intel compiler, or perhaps a 64bit machine to install the 64-bit version of the compiler and then cross compile for 32-bit output?

This is the manner in which I use gcc - install a 32-bit version, use it to generate both 32-bit and 64-bit cross compiled output.

Any help is greatly appreciated.
0 Kudos
7 Replies
Highlighted
Black Belt
46 Views

The only supported way to install and run the intel64 compiler is on top of an x86_64 linux installation of g++. You would require such an OS anyway to test your build. The -m64 switch is not accepted by the 32-bit compiler, as you saw; the ia32 compiler is the right one to make builds to run on your 32-bit linux.
I haven't heard of anyone successfully coming up with a method to install and run the past versions of the intel64 compiler on a 32-bit system, which would involve making use of a complete g++ cross compiler installation (also not supported by Red Hat, to my knowledge). The slim potential possibility of doing so will go away in future releases of icc for intel64.
0 Kudos
Highlighted
Employee
46 Views

The Intel c++ compiler 11.1 for ia32 can compile and generate objects using -m64 compiler option. I can link using gcc/g++.

$ icc -V

Intel C Compiler Professional for applications running on IA-32, Version 11.1 Build 20100203 Package ID: l_cproc_p_11.1.069

Copyright (C) 1985-2010 Intel Corporation. All rights reserved.

$ icc -c -m64 main.cxx pHello.cxx

$ g++ main.o pHello.o -L/opt/intel/compilerpro/lib/intel64/ -lirc -o phello

$ ./phello

./phello: error while loading shared libraries: libirc.so: wrong ELF class: ELFCLASS32

$ uname -a

Linux maya11 2.6.29.4-167.fc11.x86_64 #1 SMP Wed May 27 17:27:08 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

I can run the binary if we set suitable environment for the shared objects.

-----------------------------------

$ icc -V

Intel C Intel 64 Compiler Professional for applications running on Intel 64, Version 11.1 Build 20100203 Package ID: l_cproc_p_11.1.069

Copyright (C) 1985-2010 Intel Corporation. All rights reserved.

$ ./phello

Hello

------------------------------------

I am using Intel 64 box with FC11 and icc ia32 and Intel64 installed.

0 Kudos
Highlighted
Employee
46 Views

I am providing the code sample that I used.

$ cat main.cxx

void pHello();

int main() { pHello() ; return 0 ; }

$ cat pHello.cxx

#include

void pHello(){

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

0 Kudos
Highlighted
Black Belt
46 Views

OP wants to cross-compile on 32-bit Red-Hat, targeting 64-bit Linux. In your reply the tests were compiled and run on a 64-bit system.
0 Kudos
Highlighted
Beginner
46 Views

It would appear that the difference is that I am running on a 32-bit OS, while you are running a 64bit OS.

Can you tell me if the Intel64 flavor of c11, running on a 64bit OS, is capable of generating 32bit objects; i.e. accepts the -m32 flag?

Thanks.
0 Kudos
Highlighted
Black Belt
46 Views

You require a 32-bit compiler to generate 32-bit objects. After you install the 32-bit g++ development system on x86_64, you can install the Intel ia32 compiler, which is selected by the ia32 option in the environment setup script. The non-support of -m32 switch doesn't mean the compiler doesn't work when used as directed.
g++ -m32 doesn't cause the 64-bit compiler to generate 32-bit code; it switches you over to the 32-bit compiler (if installed).
0 Kudos
Highlighted
Black Belt
46 Views

Tim18's answers are comprehensive and cover this question. To reinforce what he said:

[bash]~/LANG> uname -a
Linux NSWolfdale 2.6.27.45-0.1-default #1 SMP 2010-02-22 16:49:47 +0100 x86_64 x86_64 x86_64 GNU/Linux

~/LANG> icc -V
Intel C Intel 64 Compiler Professional for applications running on Intel 64, Version 11.1    Build 20100203 Package ID: l_cproc_p_11.1.069
Copyright (C) 1985-2010 Intel Corporation.  All rights reserved.
FOR NON-COMMERCIAL USE ONLY

~/LANG> icc -m32 bug.cpp
catastrophic error: Compiler configuration problem encountered.  The expected target architecture compiler is missing (11.1-ia32 != 11.1-intel64)
compilation aborted for bug.cpp (code 1)

~/LANG> icc bug.cpp
~/LANG> [/bash]
0 Kudos