Prelink error and templates in pgCC

Dear PGI users and developers:

I tried to use pgCC-5.2 to compile a finite element library (libmesh from sourceforge) in a linux cluster. The compilation halted and reported error during prelink:

Linking /home/m254/minxu/libmesh/lib/i686-pc-linux-gnu_opt/libmesh.so
C++ prelinker: executing: /usr/pgi/linux86/5.2/bin/pgCC -DNDEBUG -O2 --no_using_std --instantiate=none --one_instantiation_per_object --prelink_objects -DPETSC_USE_DYNAMIC_LIBRARIES -I/home/m254/minxu/libmesh/include/base -I/home/m254/minxu/libmesh/include/enums -I/home/m254/minxu/libmesh/include/fe -I/home/m254/minxu/libmesh/include/geom -I/home/m254/minxu/libmesh/include/mesh -I/home/m254/minxu/libmesh/include/numerics -I/home/m254/minxu/libmesh/include/partitioning -I/home/m254/minxu/libmesh/include/quadrature -I/home/m254/minxu/libmesh/include/solvers -I/home/m254/minxu/libmesh/include/utils -I/home/m254/minxu/libmesh/contrib/boost -I/home/m254/minxu/libmesh/contrib/laspack -I/home/m254/minxu/libmesh/contrib/parmetis/Lib -I/home/m254/minxu/libmesh/contrib/metis/Lib -I/home/m254/minxu/libmesh/contrib/sfcurves -I/home/m254/minxu/libmesh/contrib/tecplot/include -I/home/m254/minxu/libmesh/contrib/tetgen -I/home/m254/minxu/libmesh/contrib/triangle -I/home/m254/minxu/petsc-2.3.0/include -I/home/m254/minxu/petsc-2.3.0/bmake/linux-gnu -o src/base/dof_map.i686-pc-linux-gnu.opt.o -c src/base/dof_map.C
unlink failed: Bad address
rename failed: Bad address
C++ prelinker: error: “std::basic_string<char, std::char_traits, std::allocator> Utility::enum_to_string(T1) [with T1=libMeshEnums::Order]” has been referenced as both an explicit specialization and a generated instantiation
C++ prelinker: error: “std::basic_string<char, std::char_traits, std::allocator> Utility::enum_to_string(T1) [with T1=libMeshEnums::FEFamily]” has been referenced as both an explicit specialization and a generated instantiation
C++ prelinker: error: “double FE<N1, N2>::shape(const Elem *, libMeshEnums::Order, unsigned int, const Point &) [with N1=(unsigned int)2, N2=(libMeshEnums::FEFamily)4]” has been referenced as both an explicit specialization and a generated instantiation
C++ prelinker: error: “double FE<N1, N2>::shape(const Elem *, libMeshEnums::Order, unsigned int, const Point &) [with N1=(unsigned int)2, N2=(libMeshEnums::FEFamily)1]” has been referenced as both an explicit specialization and a generated instantiation
C++ prelinker: error: “double FE<N1, N2>::shape(const Elem *, libMeshEnums::Order, unsigned int, const Point &) [with N1=(unsigned int)3, N2=(libMeshEnums::FEFamily)3]” has been referenced as both an explicit specialization and a generated instantiation
C++ prelinker: error: “double FE<N1, N2>::shape(const Elem *, libMeshEnums::Order, unsigned int, const Point &) [with N1=(unsigned int)2, N2=(libMeshEnums::FEFamily)3]” has been referenced as both an explicit specialization and a generated instantiation
make: *** [/home/m254/minxu/libmesh/lib/i686-pc-linux-gnu_opt/libmesh.so] Error 2

The same code has been compiled without error using gnu g+±3.4 and g+±4.0. The options used for pgCC are: -O2 --no_using_std --instantiate=none --one_instantiation_per_object --prelink_objects.

Questions:
(1) What is the error causing “unlink failed: Bad address
rename failed: Bad address”?

(2) What is the error for “both an explicit specialization and a generated instantiation”?

(3) How to fix?

Thanks for your help.

Michael

Michael-

I suspect that you are using the specialized template:

std::basic_string<char, std::char_traits, std::allocator>
Utility::enum_to_string(T1) [with T1=libMeshEnums::Order]"

Without a declaration of that specialized template in the file in which it is used.

This is a violation of the standard that Gnu compilers do not catch. We are
looking into relaxing this requirement, but for now, you’ll need to declare the specializations
where you use them.

Note the “unlink failed” will go away when pgprelink executes without failure.