Problems on compiling DEAL.II using pgcc/pgCC???

I am trying to compile a finite element library (DEAL.II) using pgcc/pgCC version 6.2 on 64bit linux.
But it seems that there are many compiling warnings and link warnings when I compile the shared library file. When I compile the example files in this library I got the following errors:

pgCC-Warning-Unknown switch: -rdynamic
/scratch/xub/dealii/lib/ undefined reference to `__builtin_expect’

After that, I add a compiler option -shared , this time I can compile the example file, but I got a run-time error:

[xub@matrix step-1]$ ./step-1
Segmentation fault

However, I can compile this library sucessfully with gcc/g++ compiler.
Could anyone help me ??
The deal.ii library can be downloaded from :

Thank you.

__builtin_expect is a GCC extension to tell the compiler what you expect a branch result to be. I have had this problem when using pthreads.h. It looks like there are only a couple source files that have it, so you can use something like the following

#ifdef __PGI
#define __builtin_expect(a,b) (a)

You may also write the maintainer of that source code and suggest he change the test for __builtin_expect to AC_TRY_LINK instead of AC_TRY_COMPILE. PGI C++ compiler will compile the code, but linking fails.

Hi Cobin,

Another work-around is to comment out line 203 of “base/include/base/config.h”


I was able to build and run the examples when I made this change. A few of the examples didn’t run becasuse I didn’t build PetSC. Also, step-4 aborts with a runtime error which I’ll need to investigate further.

Hope this helps,

I commentd the followings:
It works except for step-4…:)

Now, I will trying to link it with petsc using pgcc/pgCC to see what happens…
By the way, did you notice the link warnings:
pgCC-Warning-Unknown switch: -rdynamic

Thank you

I still got the compile warning when bulid deal.II by pgCC/pgcc:
Do you know how to correct it??

type qualifier on return type is meaningless
operator const Mat () const;

“/scratch/xub/dealii/lac/include/lac/petsc_precondition.h”, line 74: warning #815-D:
type qualifier on return type is meaningless
operator const Mat () const;

“/scratch/xub/dealii/lac/include/lac/petsc_matrix_base.h”, line 766: warning #815-D:
type qualifier on return type is meaningless
operator const Mat () const;

Hi Cobin,

The warning is correct, but can be safely ignored. Type qualifiers, such as const, have no meaning and thus ignored when applied to function return types.

  • Mat


When I link dealii with petsc, which is also compiled with pgcc/pgf90, the compilation is successful. But when I run example files, I got runtime errors:
C++ runtime abort: internal error: static object marked for destruction more than once

Originally, if I did not link dealii with petsc, I can run ./step-1.
By the way, there are three library on my system I will use:
HP-MPI (set up by PGI compilers)
Petsc (compiled by mpicc/mpiCC/mpif90)
Deal.II (I want to compile with mpicc/mpiCC/mpif90, but still have problems!!)

Thank you very much.