Hi folks,
A user here is having issue linking their code and Im unable to figure out why.
Its a fortran and c++ code with MPI. Using pgc++ to compile all the cpp files into a library which is then used with the fortran source. Compiling and linking the fortran is done with the mpi wrapper compile scripts which use pgf90 as the base compiler.
The c++ routine is trying to use the isfinite() function but at link time I get complaints like
In function std::isfinite(double)': ..../pgi/17.1/linux86-64/17.1/include-gcc48/cmath:667: undefined reference to _pgi_isfinitedd’
there is some difference depending on which gcc library is available at compile time and which gcc library was available at PGI compiler install time.
ie sometimes it gets a complaint about isfinite() from the gnu header files but always about the same function.
this has also been tried with gnu 4.9+ and pgi 17.5 and get the same sort of complaints about isfinite()
The solution is to link the objects including the C++ objects using pgfortran, and make sure any C++ runtime utils are linked as well,
using the pgfortran link switch
pgc++libs
to link the correct PGI C++ libs, in the correct order, in pgfortran.
It may also be necessary to create a wrapper program so that
isfinite_() is mapped to call the isfinite() routine.