Linking library compiled by pgc++ with application compiled by gcc

The link error I’m getting is mpi/libMavMpiWork.a(MavMpiWorkerNull.o):(.data+0x8): undefined reference to __pgdbg_stub’`. Based on other posts, I think I’m not linking pgc++ support libraries, but which ones?

My pgc++ and gcc versions are

pgc++ 16.4-0 64-bit target on x86-64 Linux -tp nehalem

gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23)

Thanks for any help.

Hi kmccall,

The pgdbg stub symbol is located in the PGI C runtime libraries, libpgc and libnspgc. Though, pgc++ includes both of these libraries on the link line by default so I’m assuming you’re using gcc to link?

.A handy flag is “-dryrun” which will show you what commands the compiler driver is making, without actually performing them. So if you need to know what libraries pgc++ would add if it were being used to link, you can run the command to see the link command:

% pgc++ -dryrun x.o
.. cut ..
Export PGI=/proj/pgi

 /usr/bin/ld /usr/lib/x86_64-linux-gnu/crt1.o /usr/lib/x86_64-linux-gnu/crti.o /proj/pgi/linux86-64/16.4/lib/trace_init.o /usr/lib/gcc/x86_64-linux-gnu/7/crtbegin.o /proj/pgi/linux86-64/16.4/lib/initmp.o --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ /proj/pgi/linux86-64/16.4/lib/pgi.ld -L/proj/pgi/linux86-64/16.4/lib -L/usr/lib64 -L/usr/lib/gcc/x86_64-linux-gnu/7 x.o -rpath /proj/pgi/linux86-64/16.4/lib -L/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib64 --eh-frame-hdr -lpgatm -lgcc -lgcc_s -lstdc++ -lpgmp -lnuma -lpthread -lnspgc -lpgc -lm -lgcc -lc -lgcc -lgcc_s /usr/lib/gcc/x86_64-linux-gnu/7/crtend.o /usr/lib/x86_64-linux-gnu/crtn.o

Hope this helps,