pgc++ failed to link with GNU MPICH2 library

Hi,
I have a MPICH2 library compiled using GNU compiler. I could use g++ to successfully compile a user MPI program:

[lgl@pexserv02 src]$ g++ hello.cpp -m64 -D__64BIT__ -Wl,–allow-shlib-undefined -Wl,–enable-new-dtags -Wl,-rpath,/opt/ibmhpc/pe1200/mpich2/gnu/lib64 -Wl,-rpath,/opt/ibmhpc/pe1200/pempi/gnu/lib64 -Wl,-rpath,/usr/lib64 -I/opt/ibmhpc/pe1200/mpich2/gnu/include64 -I/opt/ibmhpc/pe1200/ppe.pami/include64 -L/opt/ibmhpc/pe1200/mpich2/gnu/lib64 -lcxxmpich -lmpich -lopa -lmpl -ldl -L/opt/ibmhpc/pe1200/pempi/gnu/lib64 -lpoe -L/usr/lib64 -lpami -lpthread -lrt

But when I tried to use pgc++ instead of g++, I got some errors:
[lgl@pexserv02 src]$ pgc++ hello.cpp -m64 -D__64BIT__ -Wl,–allow-shlib-undefined -Wl,–enable-new-dtags -Wl,-rpath,/opt/ibmhpc/pe1200/mpich2/gnu/lib64 -Wl,-rpath,/opt/ibmhpc/pe1200/pempi/gnu/lib64 -Wl,-rpath,/usr/lib64 -I/opt/ibmhpc/pe1200/mpich2/gnu/include64 -I/opt/ibmhpc/pe1200/ppe.pami/include64 -L/opt/ibmhpc/pe1200/mpich2/gnu/lib64 -lcxxmpich -lmpich -lopa -lmpl -ldl -L/opt/ibmhpc/pe1200/pempi/gnu/lib64 -lpoe -L/usr/lib64 -lpami -lpthread -lrt
NOTE: your trial license will expire in 12 days, 2.97 hours.
/tmp/pgc++YgJgwgS3FrFo.o: In function main': /home/lgl/src/./lgl_mpi.cpp:6: undefined reference to MPI::Init(int &, char **&)’
/home/lgl/src/./lgl_mpi.cpp:6: undefined reference to MPI::COMM_WORLD(void)' /home/lgl/src/./lgl_mpi.cpp:6: undefined reference to MPI::COMM_WORLD(void)’
/home/lgl/src/./lgl_mpi.cpp:6: undefined reference to MPI::Finalize(void)' /tmp/pgc++YgJgwgS3FrFo.o: In function MPI::Status::Is_cancelled( const(void))’:
/opt/ibmhpc/pe1200/mpich2/gnu/include64/mpicxx.h:536: undefined reference to MPI::MPIR_Call_world_errhand(int)' /tmp/pgc++YgJgwgS3FrFo.o: In function MPI::Status::Get_elements( const(MPI::Datatype const &))’:
/opt/ibmhpc/pe1200/mpich2/gnu/include64/mpicxx.h:542: undefined reference to MPI::MPIR_Call_world_errhand(int)' /tmp/pgc++YgJgwgS3FrFo.o: In function MPI::Status::Get_count( const(MPI::Datatype const &))’:
/opt/ibmhpc/pe1200/mpich2/gnu/include64/mpicxx.h:548: undefined reference to MPI::MPIR_Call_world_errhand(int)' /tmp/pgc++YgJgwgS3FrFo.o: In function MPI::Status::Set_cancelled( (bool))’:
/opt/ibmhpc/pe1200/mpich2/gnu/include64/mpicxx.h:555: undefined reference to MPI::MPIR_Call_world_errhand(int)' /tmp/pgc++YgJgwgS3FrFo.o: In function MPI::Status::Set_elements( (MPI::Datatype const &, int))’:
/opt/ibmhpc/pe1200/mpich2/gnu/include64/mpicxx.h:559: undefined reference to `MPI::MPIR_Call_world_errhand(int)’
[lgl@pexserv02 src]$

Is there a way to make pgc++ to link with the GNU library? I searched the man page and tried to use “–gcc” option:
–gcc Generate GNU-compatible C++ code and link with the GNU libraries.

But I got an error of:
pgc+±Error-Unknown switch: --gcc

Thanks in advance for your help

Here is the symbols and libs related to the errors in the link stage:

======/opt/ibmhpc/pe1200/mpich2/gnu/lib64/libcxxmpich.so===========
0000000000015260 T _ZN3MPI23MPIR_Call_world_errhandEi

======/opt/ibmhpc/pe1200/mpich2/gnu/lib64/libcxxmpich.so===========
U MPI_Init
U MPI_Init_thread
U MPI_Initialized
======/opt/ibmhpc/pe1200/mpich2/gnu/lib64/libmpich.so===========
00000000000c1260 W MPI_Init
00000000000c18b0 W MPI_Init_thread
00000000000c11d0 W MPI_Initialized
00000000000c1260 T PMPI_Init
00000000000c18b0 T PMPI_Init_thread
00000000000c11d0 T PMPI_Initialized

Here is some system info:
[root@pexserv02 lib64]# lsb_release -a
LSB Version: :core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 6.0 (Santiago)
Release: 6.0
Codename: Santiago
[root@pexserv02 lib64]# gcc -v
Using built-in specs.
Target: x86_64-redhat-linux

gcc version 4.4.4 20100726 (Red Hat 4.4.4-13) (GCC)

[root@pexserv02 lib64]# pgc++ --version

pgc++ 12.1-0 64-bit target on x86-64 Linux -tp nehalem
Copyright 1989-2000, The Portland Group, Inc. All Rights Reserved.
Copyright 2000-2012, STMicroelectronics, Inc. All Rights Reserved.
[root@pexserv02 lib64]#

We are currently finishing up work on our new g++ compatible compiler. It is due
to be out in the next release or two. It will be called pgc++

Thanks for your reply.
Did you meet the similar issue when using pgc++ to compile a C++ MPI program and linked with 3rd party GNU compiled MPI libraries? I tried using PGI C and Fortran compiler, both works well with our C and Fortran MPI library. So the program I met should be a compatibility between pgc++ and g++, right? Could you please give me some ideas about the approximate available date of the release that has g++ compatible compiler?
Thanks.

Hi guanglei,

I tried using PGI C and Fortran compiler, both works well with our C and Fortran MPI library… So the program I met should be a compatibility between pgc++ and g++, right?

Not yet. The C and F77 are generally compatible but C++ is unique to each compiler implementation. Things like symbol name mangling, templates, and exception handling are usually different making objects created by different compilers incompatible.

Our pgc++ compiler, currently in a early beta, is our attempt to match g++ so that pgc++ compiled C++ objects and libraries will be able to linked and run correctly with GNU C++ compiled objects and libraries. I expect the beta to continue for the next few monthly releases as Deb and her team work out the issues. I’ll ask her to add GNU C++ MPICH2 compiled libraries to her testing.

Best Regards,
Mat