Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

ifort architecture error on OSX

James_T_4
Beginner
393 Views

Dear all,

I'm currently using ifort (16.0.3) on OSX El Capitan to install an old piece of software which previously installed fine (prior to the Yosemite update). The error I'm getting during compilation is specifically: 

ifort: command line warning #10006: ignoring unknown option '-static'
Undefined symbols for architecture x86_64:
  "_inclandata_mp_erflag_", referenced from:
      _haverr_ in inclan.a(util.o)
      _seterr_ in inclan.a(util.o)
      _inclan_ in inclan.a(inclan.o)
      _putlin_ in inclan.a(putlin.o)
      _putstr_ in inclan.a(putlin.o)

From googling, I thought the problem was related to the relatively recent changes in OSX to the default  c++ library (libc++ is now default over libstdc++) so, I changed the make config file to:

#SYSTEM      = intel
#COMMENT     = Intel Fortran compiler
#FC          = ifort
#FFLAGS      = -w
#FFLAGS2     = -w
#CC          = gcc
#FORK        = g77fork.o
#LDFLAGS     = -staticlib

...where it once had -static instead of -staticlib. I now no longer get any error message during compilation, but the final files are not executable. I've also tried the LDFLAG "-cxxlib" and "-cxxlib -L /opt/local/lib/gcc47" that I found in the ifort help list, but I get the same original message with both. Have I changed the clib incorrectly? Otherwise I'm stumped now for troubleshooting.

If it matters I'm sourcing ifort with:

source /opt/intel/compilers_and_libraries_2016.3.170/mac/bin/ifortvars.csh intel64

Many thanks for any help, it's very much appreciated!

0 Kudos
2 Replies
Kevin_D_Intel
Employee
393 Views

I do not believe (but don't have a reproducer) the undefined symbols relate to the -static error and you perhaps could drop that option or replace it with two options: -intel-static -static-libstdc++

You would not want to replace -static with -staticlib. The -staticlib is creating a static library which is not an executable but rather a collection of object files used for subsequent linking; thus not what you want.

I'm guessing yours is a mixed language app. I can’t reproduce the undefined symbols yet to know about a certain resolution. Maybe a combination of replacing -staticlib as I noted above with what you’ve done with the -cxxlib might resolve the symbols.

0 Kudos
James_T_4
Beginner
393 Views

Thank you for your reply. Unfortunately the -intel-static -static-libstdc++ flags (and many variants thereof  - including -cxxlib) didn't work for me. But for what it's worth, I've managed to get the program to compile and run correctly. In my troubleshooting I ended up changing lots of things, so I can't say for sure if any one thing did the trick. However the main things I recall are, selecting my proper gcc installation (from macports) to be the default gcc:

sudo port select --set gcc mp-gcc47

and then being sure to prepend my $PATH with '/opt/local/bin' so the correct gcc symlink was chosen before that of Apple's (which actually links to clang). Finally after trying lots of combinations of various flags, I found the below Makefile on a relevant message board and it worked fine: 

#SYSTEM     = intel-fast
#COMMENT    = Intel Fortran compiler
#FC         = ifort -m64
#FFLAGS     = -w -O3 -xP -fno-common
#FFLAGS2    = -w -O3 -xP -fno-common
#CC         = gcc -m64
#FORK       = g77fork.o
#LDFLAGS    = -O3 -xP -static
#DEFS       = -Dintel -Dintel_fast

I have no idea why this worked over the other ones (any idea's?), but I thought I'd include it as it may be useful to someone else. 

Thanks!

0 Kudos
Reply