I'm having trouble compiling OpenIFS for OSX, specifically with the optimizations enabled. A "noopt"-build works fine. I'm posting here to document the problem. 

To compile, I followed the steps here:

https://confluence.ecmwf.int/display/OIFS/MacOS+X+known+issues
i.e. add DARWIN to this line of the .cfg file
$OIFS_CCDEFS{?} = BLAS LITTLE LINUX INTEGER_IS_INT _ABI64 DARWIN

With the options for gnu-opt,
$OIFS_FFLAGS{?} = -g -O2 -m64 -fconvert=big-endian -fopenmp
the compilation produces lots of warnings:
ld: warning: object file (oifslib/make/mac_gnu-opt/oifs/lib/liboifs.a(ccetr_mod.o)) was built for newer OSX version (10.12) than being linked (10.11.6)
The code compiles but running fails with "exited on signal 4 (Illegal instruction: 4)."

When compiling without -openmp, i.e.  $OIFS_FFLAGS{?} = -g -O2 -m64 -fconvert=big-endian, the same warnings are produced, but the program works.

Program versions:

OSX 10.11.6 (15G1108) El Capitan
Xcode 8.1 Build version 8B62, same result with Xcode 8.2  Build version 8C38
gcc-6 (Homebrew gcc 6.2.0) 6.2.0 from homebrew

 

Solution

It seems that If I run 

export MACOSX_DEPLOYMENT_TARGET=10.11

before compiling, the ld warnings go away, and the program works, even with the opt settings. It seems the issue is an xcode versioning problem, and is not really openIFS related. 

 

 

1 Comment

  1. Unknown User (nagc)

    Fredrik,

    Thanks for the tip. I guess Xcode 8 has a default deployment for macos sierra (10.12).

    Glenn