pgfortran crashes at link-time on Linux

Hi all,

I am having problems when trying to link an executable composed from several static libraries and Intel MKL on Linux. I am using PGI version 17.4. on Linux Mint 18.2 .

The link line is produced by cmake and is as follows:

/opt/pgi/linux86-64/17.4/bin/pgfortran    -#   -Mpreprocess -Kieee -mp -Mpreprocess -c  -IEDO_academy//bin/Utilities/mod -IEDO_academy/bin/EDO_SP/mod -IEDO_academy/bin/GMRESlib/mod -g -O0 -Mbounds CMakeFiles/EDO_academy.dir/precision_example.f90.o CMakeFiles/EDO_academy.dir/TestFunc.f90.o CMakeFiles/EDO_academy.dir/main.f90.o CMakeFiles/EDO_academy.dir/OperatorValidation.f90.o CMakeFiles/EDO_academy.dir/GmresLaplaceCorrection.f90.o CMakeFiles/EDO_academy.dir/GmressDirectCorrection.f90.o CMakeFiles/EDO_academy.dir/GmresPressureCorrection.f90.o CMakeFiles/EDO_academy.dir/IrregularGridGeneration.f90.o CMakeFiles/EDO_academy.dir/x64/Debug/printhelp__genmod.f90.o CMakeFiles/EDO_academy.dir/DIffusion.f90.o CMakeFiles/EDO_academy.dir/InheritanceExample.f90.o  -o EDO_academy Utilities/libUtilities.a EDO_SP/libEDO_SP.a GMRESlib/libGMRESlib.a -Wl,--start-group /opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/lib/intel64/libmkl_intel_ilp64.a /opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/lib/intel64/libmkl_sequential.a /opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/lib/intel64/libmkl_core.a -Wl,--end-group -ldl Utilities/libUtilities.a

Essentially the same link line (except for compiler-specific flags) works fine for both gfortran and ifort.

The pgfortran compiler outputs only

Export PGI=/opt/pgi

and crashes without returning any error codes or producing any output.

Any help would be greatly appreciated.

Boštjan

Have you looked at https://www.pgroup.com/support/faq.htm#mkl ?

In essence, you either pass f77 ‘call by reference’ type arguments
that usually work, or you use interface records after having
compiled the MKL interface records, and make sure they work
correctly.

dave

I checked out the FAQ and it seems to be outdated, since the current version of MKL (2018.0) does not provide any PGI-specific libraries. I did however remove some inconsistencies in the link line and compiler flags to produce the link line that is suggested by the MKL Link Line Advisor.

The result is the following link line, which aims to link the sequential version of the MKL to remove possible problems with OMP. The link with -liomp5 is still needed to handle some direct calls to OMP routines in the rest of the code.

/opt/pgi/linux86-64/17.4/bin/pgfortran    -#    -Mpreprocess -Kieee -i8 -Mpreprocess -c   -IEDO_academy/bin/Utilities/mod -IEDO_academy/bin/EDO_SP/mod -IEDO_academy/bin/GMRESlib/mod -traceback -Minfo CMakeFiles/EDO_academy.dir/precision_example.f90.o CMakeFiles/EDO_academy.dir/TestFunc.f90.o CMakeFiles/EDO_academy.dir/main.f90.o CMakeFiles/EDO_academy.dir/OperatorValidation.f90.o CMakeFiles/EDO_academy.dir/GmresLaplaceCorrection.f90.o CMakeFiles/EDO_academy.dir/GmressDirectCorrection.f90.o CMakeFiles/EDO_academy.dir/GmresPressureCorrection.f90.o CMakeFiles/EDO_academy.dir/IrregularGridGeneration.f90.o CMakeFiles/EDO_academy.dir/x64/Debug/printhelp__genmod.f90.o CMakeFiles/EDO_academy.dir/DIffusion.f90.o CMakeFiles/EDO_academy.dir/InheritanceExample.f90.o  -o EDO_academy Utilities/libUtilities.a EDO_SP/libEDO_SP.a GMRESlib/libGMRESlib.a -Wl,--start-group /opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/lib/intel64/libmkl_intel_ilp64.a /opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/lib/intel64/libmkl_sequential.a /opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm -liomp5 -ldl Utilities/libUtilities.a

The code uses f77 interfaces to invoke the lapack/blas routines in the MKL but I do not think that they are causing problems. The compilation of all the source code is successful without any warnings about undefined interfaces.