[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Combining GNU C++ and Intel Fortran

From: Arjen Markus
Subject: Combining GNU C++ and Intel Fortran
Date: Fri, 17 Jun 2005 09:04:22 +0200


using autoconf 2.59 we have a problem with the combination g++ and ifort
on Red Hat 9.0.
Actually, there are a few problems. Let me explain them one by one -
most we were 
able to solve via specific macros, but one turns out to require editing
the resulting
makefile. As we are not well versed in autoconf, it is very possible we
are overlooking
some possibility. Still, here they are:

The Fortran 90/95 compiler we select is ifort and the programs we want
to create are
a combination of Fortran and C++, but the main program is Fortran.
Because of the use
of C++, we must use the C++ linker, in our case g++, as the various
libraries are 
compiled with g++ (and not with Intel C, which could have been another
solution, if
it were not for compile errors ... well, that is a different story).

* As one of the program is multithreaded we need specific compiler flags
(-reentrancy treaded
  -recursive) but these can not be stored in FFLAGS, as this bites at
the link step.

  So instead we redefine FC.

* To get the Fortran program to link we need to specify an extra object
file (for_main.o from
  the Intel lib directory; for another configuration, using the Lahey
compiler instead
  of Intel, we need to specify "fj90rt.o" from the Lahey lib directory).

  We solve this issue by expanding the list of libraries.

* The macros that recognise the Intel Fortran compiler come up with a
long list of 
  libraries, and some of these bite the g++/ifort combination: we got
strange error
  messages and looking into the problem it became apparent that Intel
C's libcxa.so 
  was loaded which seems to provide exception throwing in Intel C. This
was linked 
  in instead of the proper g++ version.

  We had to manually remove various libraries and replace another one
because of 
  multithreading. So in the edited makefile we have:

  FCLIBS =  -L/opt/intel_fc_80/lib -L/usr/lib -lifport -lifcoremt -limf
-lm -lirc 

  instead of the original:
  FCLIBS =  -L/opt/intel_fc_80/lib -L/usr/lib -lifport -lifcore -limf
-lm -lcxa -lirc -lunwind -lirc_s

  Especially the -lcxa was a nasty one, as it was only by a haphazard
spark of inspiration
  that we decided to check via ldd which shared libraries were being
accessed and then
  saw the unexpected appearance of Intel C libraries. (Yes, I claim that
discovery :))

I thought you might want to know this and so I took the liberty of
sending you this
longish and wordish report.

As for the last issue: is there a way to override the libraries via
configure macros?
(Is the best way redefining FCLIBS?)

Kind regards,

Arjen Markus

reply via email to

[Prev in Thread] Current Thread [Next in Thread]