pgc++ linker error with dynamic libraries

Hello,

I have a problem with pgc++ and creating a dynamically linked library using -fPIC. I was wondering if anyone has had similar problems any maybe found a solution?

This is the code:

– test.cpp
#include
int main() {
std::string s(“hello”);
std::string t = s + “world”;
return 0;
}

If I do

pgc++ test.cpp

it compiles and runs. If I enable position-independent code I get


pgc++ -fPIC test.cpp
/tmp/pgc++d3ohj3kJ-KD0.o: In function std::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*)': test.cpp:(.gnu.linkonce.t._ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_ERKS6_PKS3_+0x48): undefined reference to __catch_clause_number’
test.cpp:(.gnu.linkonce.t.ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_ERKS6_PKS3+0x52):
undefined reference to `__caught_object_address’

The same with GCC (g++ -fPIC test.cpp) works, so this seems to be a pgc++ problem. Unfortunately this means pgc++ cannot be used at all to generate dynamically linked libraries, which seems quite a substantial bug.

Here is the version information:

gcc version 4.1.2 20080704 (Red Hat 4.1.2-51)
pgc++ 13.3-0 64-bit target on x86-64 Linux -tp nehalem
Copyright 1989-2000, The Portland Group, Inc. All Rights Reserved.
Copyright 2000-2013, STMicroelectronics, Inc. All Rights Reserved.

Jan

Thanks Jan. I appears the PGI Customer Service has already filed this issue as TPR#19228 and is waiting for engineering to investigate.

  • Mat

Thanks, I already got a friendly message from support (thanks again!) but was wondering if anyone had found a workaround.

Hi Jan,

I talked with the compiler engineer who’s working on this. Unfortunately, there isn’t a work around since it has to do with how exception handling is done between static and PIC versions on the code. She’s working on a fix now but doesn’t think it will make the cut off for the 13.4 release. Most likely, 13.5.

Thanks again,
Mat