I built OpenMPI 1.5.3 using NAG compiler v 5.2 on a new system running Fedora 15 (with gcc 4.6). OpenMPI can be built successfully, but when I compile a Fortran MPI application I got an error at link stage:

gcc: error: unrecognized option ‘--export-dynamic’

Note that NAG Fortran compiler generates intermediate C code and actually calls gcc to build the application.

GCC 4.6 release note contains the following: "GCC now has stricter checks for invalid command-line options. In particular, when gcc was called to link object files rather than compile source code, it would previously accept and ignore all options starting with --, including linker options such as --as-needed and --export-dynamic, although such options would result in errors if any source code was compiled. Such options, if unknown to the compiler, are now rejected in all cases; if the intent was to pass them to the linker, options such as -Wl,--as-needed should be used."

My next step was to track down where the illegal syntax was generated, using the '-showme' option provided by the OpenMPI compiler wrapper and '-dryrun' option provided by NAG compiler.

[lining@combe pi]$ /home/lining/software/openmpi/1.5.3/nag/bin/mpif90 --showme pi.f90 -o pi.exe_nag
nagfor pi.f90 -o pi.exe_nag -I/home/lining/software/openmpi/1.5.3/nag/include -pthread -I/home/lining/software/openmpi/1.5.3/nag/lib -L/home/lining/software/openmpi/1.5.3/nag/lib -lmpi_f90 -lmpi_f77 -lmpi -lnsl -lutil -lm -ldl -Wl,--export-dynamic -lnsl -lutil -lm -ldl

[lining@combe pi]$ /home/lining/software/openmpi/1.5.3/nag/bin/mpif90 -dryrun pi.f90 -o tpi.exe_nag
NAG Fortran Compiler Release 5.2(721)
Option warning: Unrecognised option -pthread passed to loader
/home/lining/software/NAG_Fortran/lib/forcomp -checkversion 5.2 721 -I/home/lining/software/openmpi/1.5.3/nag/include -I/home/lining/software/openmpi/1.5.3/nag/lib -library /home/lining/software/NAG_Fortran/lib -o /tmp/pi.024444.c pi.f90
/usr/bin/gcc -I/home/lining/software/NAG_Fortran/lib -c -DANSI_C -DINT64=long long -funsigned-char -march=i686 -Wno-pointer-sign -o pi.o /tmp/pi.024444.c
/usr/bin/gcc -o pi.exe_nag /home/lining/software/NAG_Fortran/lib/quickfit.o pi.o -pthread -L/home/lining/software/openmpi/1.5.3/nag/lib -lmpi_f90 -lmpi_f77 -lmpi -lnsl -lutil -lm -ldl -lnsl -lutil -lm -ldl -Wl,-rpath,/home/lining/software/NAG_Fortran/lib /home/lining/software/NAG_Fortran/lib/libf52.so /home/lining/software/NAG_Fortran/lib/libf52.a -lm --export-dynamic

So OpenMPI generates the '-Wl,--export-dynamic' flag. When this is passed to NAG compiler, NAG compiler interprets this as "passing the '--export-dynamic' flag to the linker (gcc)" (which I believe is the correct behaviour). But gcc 4.6 expects to see '-Wl,--export-dynamic'.

My temporary solution as supplied by NAG compiler developers is to edit  share/openmpi/*-wrapper-data.txt and put flag '-Wl,-Wl,,--export-dynamic' there.


Ning Li
Technical Consultant
Numerical Algorithms Group

The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs.