Quantcast
Channel: Intel® Fortran Compiler for Linux* and macOS*
Viewing all articles
Browse latest Browse all 2583

distributable OSX binary

$
0
0

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.

  1. 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.
  2. 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)
  3. 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?)
  4. 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.)

Viewing all articles
Browse latest Browse all 2583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>