Hi,
I found the following article on compiling universal binaries on Mac OS X with the intel compilers:
http://software.intel.com/sites/products/documentation/doclib/stdxe/2013...
However, when I try to run my executable on another apple machine (which is actually 64 bit, as is the machine on which the binary is built) I am getting an "unknown instruction: 4" error. My sources are in Fortran and C but linked with ifort, since Fortran provides the main program. Here is the script I am currently using to build the binaries:
!/bin/bash # 32 bit icc -W -trace -g -static-intel -static-libgcc -m32 -c a.c ifort -warn -trace -g -static-intel -static-libgcc -m32 - wrap_a.f90 ifort -warn -trace -g -static-intel -static-libgcc -m32 -c b.f90 ifort -warn -trace -g -static-intel -static-libgcc -m32 -c main.f90 ifort -warn -trace -g -static-intel -static-libgcc -m32 -o main_32 main.o b.o wrap_a.o a.o # 64 bit icc -W -trace -g -static-intel -static-libgcc -m64 -c a.c ifort -warn -trace -g -static-intel -static-libgcc -m64 -c wrap_a.f90 ifort -warn -trace -g -static-intel -static-libgcc -m64 -c b.f90 ifort -warn -trace -g -static-intel -static-libgcc -m64 -c main.f90 ifort -warn -trace -g -static-intel -static-libgcc -m64 -o main_64 main.o b.o wrap_a.o a.o # Universal binary lipo -create -arch i386 main_32 -arch x86_64 main_64 -output main
As I said, the program compiles and runs fine on the machine on which it is built.
- Are there any additional flags I need to add? CMake tries to add -arch i386 and -arch x86_64 but at compile time it says that it cannot build with -arch i386.
- Do I need to `source compilervars.sh intel32` before I build the 32 bit binary? Right now I am only `source compilervars.sh intel64` for building both executables (32 and 64 bit)
- XCode and Intel compilers are not installed on the "target" machine, are there any other libraries that I need to statically link against? (Does -static-intel take care of all the Fortran run-time library(ies) stuff?)
- Do I need a specific license/product to achieve this? (This is a hobby project, non-commercial, non-research and I am using the student license for mac os-x as I am a student.)