# pgc++ not finding libstdc++

**URL:** <https://forums.developer.nvidia.com/t/pgc-not-finding-libstdc/134906>\
**Category:** Legacy PGI Compilers (archived)\
**Created:** [April 25, 2016, 3:22pm UTC](https://forums.developer.nvidia.com/t/pgc-not-finding-libstdc/134906 "2016-04-25T15:22:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mboisson](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@mboisson](https://forums.developer.nvidia.com/u/mboisson)\
**Post date:** [April 25, 2016, 3:22pm UTC](https://forums.developer.nvidia.com/t/pgc-not-finding-libstdc/134906/1 "2016-04-25T15:22:30Z")

</div>

Hi,  
I am trying to compile an OpenACC code on a cluster. On this cluster, the GCC compilers is not installed in the default location. More specifically:

[mboisson@helios1 cpp]$ which g++  
/software6/compilers/gcc/4.8/bin/g++  
[mboisson@helios1 cpp]$ find ${LIBRARY\_PATH//:/ } -name ‘libstdc++.so’  
find: “/software-gpu/compilers/pgi/15.10/linux86-64/15.10/libso”: Aucun fichier ou dossier de ce type  
/software6/compilers/gcc/4.8/lib64/libstdc++.so  
/software6/compilers/gcc/4.8/lib/libstdc++.so  
/software6/compilers/gcc/4.6/lib64/libstdc++.so  
/software6/compilers/gcc/4.6/lib/libstdc++.so

So, the libstdc++.so is within the LIBRARY\_PATH.

Yet, when I compile the code, I get the following:  
pgc++ main.o -o cg.x -fast  
/software6/apps/buildtools/20150928/bin/ld: ne peut trouver -lstdc++  
Makefile:6 : la recette pour la cible « cg.x » a échouée

The linker cannot find the stdc++ library.  
Yet, if I compile it with g++ in the same environment, the linker has no trouble finding the stdc++ library:

[mboisson@helios1 cpp]$ g++ -O3 -c -o main.o main.cpp  
[mboisson@helios1 cpp]$ g++ main.o -o cg.x -O3 -fopenmp  
[mboisson@helios1 cpp]$  
  
  
Any idea what’s going on ?

---

<div class="post-metadata">

**Author:** ![tull](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@tull](https://forums.developer.nvidia.com/u/tull)\
**Post date:** [April 25, 2016, 4:38pm UTC](https://forums.developer.nvidia.com/t/pgc-not-finding-libstdc/134906/2 "2016-04-25T16:38:12Z")

</div>

My guess is the default g++ in your $PATH is not the same as the  
g++ which the PGI compilers were installed under.

pgc++ -dryrun x.C

and see which version of gcc/g++ libs and headers pgc++ is using.

If they are different, either change your path, or reinstall the compilers  
under the gcc/g++ compiler in your PATH.

Very difficult to run dynamically linked executables on systems where the  
gcc/g++ shared libs are not present.

Typically, link with  
-Bstatic\_pgi

so that only the gcc/g++/system libs are dynamically linked, where they  
are present.

btw - the definition of ‘cluster’ means all the nodes are running  
the same Linux version and gcc/g++ versions. Having a heterogenous  
collection of platforms, and calling it a cluster, can lead to problems.  
But it also might work.

dave

---

<div class="post-metadata">

**Author:** ![mboisson](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@mboisson](https://forums.developer.nvidia.com/u/mboisson)\
**Post date:** [April 25, 2016, 4:46pm UTC](https://forums.developer.nvidia.com/t/pgc-not-finding-libstdc/134906/3 "2016-04-25T16:46:06Z")

</div>

> My guess is the default g++ in your $PATH is not the same as the  
> g++ which the PGI compilers were installed under.

It was installed with the same GCC in the path.

> pgc++ -dryrun x.C

Here is the output… although I’m not sure how to interpret it.

[mboisson@helios1 cpp]$ pgc++ -dryrun x.CReading rcfile /software-gpu/compilers/pgi/15.10/linux86-64/15.10/bin/.pgc++rcReading rcfile /software-gpu/compilers/pgi/15.10/linux86-64/15.10/bin/nativercReading rcfile /software-gpu/compilers/pgi/15.10/linux86-64/15.10/bin/fnativerc  
Reading rcfile /software-gpu/compilers/pgi/15.10/linux86-64/15.10/bin/ccrc  
Reading rcfile /software-gpu/compilers/pgi/15.10/linux86-64/15.10/bin/cpprc  
Reading rcfile /software-gpu/compilers/pgi/15.10/linux86-64/15.10/bin/cppcurc  
Reading rcfile /software-gpu/compilers/pgi/15.10/linux86-64/15.10/bin/x86rc  
Reading rcfile /software-gpu/compilers/pgi/15.10/linux86-64/15.10/bin/x8664rc  
Reading rcfile /software-gpu/compilers/pgi/15.10/linux86-64/15.10/bin/lin86rc  
Reading rcfile /software-gpu/compilers/pgi/15.10/linux86-64/15.10/bin/lin8664rc  
Reading rcfile /software-gpu/compilers/pgi/15.10/linux86-64/15.10/bin/iparc  
Reading rcfile /software-gpu/compilers/pgi/15.10/linux86-64/15.10/bin/acc1rc  
Reading rcfile /software-gpu/compilers/pgi/15.10/linux86-64/15.10/bin/acclin8664rc  
Reading rcfile /software-gpu/compilers/pgi/15.10/linux86-64/15.10/bin/c++rc  
Reading rcfile /software-gpu/compilers/pgi/15.10/linux86-64/15.10/bin/localrc  
Skipping localrc.helios1 (not found)  
Skipping siterc (not found)  
Skipping siterc.helios1 (not found)  
Skipping .mypgirc (not found)  
Skipping .mypgcpprc (not found)  
Skipping $MYLOCALRC (not found)  
Export PGI=/software-gpu/compilers/pgi/15.10

/software-gpu/compilers/pgi/15.10/linux86-64/15.10/bin/pggpp1 --llalign -Dunix -D\_\_unix -D\_\_unix\_\_ -Dlinux -D\_\_linux -D\_\_linux\_\_ -D\_\_NO\_MATH\_INLINES -D\_\_LP64\_\_ -D\_\_x86\_64 -D\_\_x86\_64\_\_ -D\_\_LONG\_MAX\_\_=9223372036854775807L ‘-D\_\_SIZE\_TYPE\_\_=unsigned long int’ ‘-D\_\_PTRDIFF\_TYPE\_\_=long int’ -D\_\_THROW= -D\_\_extension\_\_= -D\_\_amd\_64\_\_amd64\_\_ -D\_\_k8 -D\_\_k8\_\_ -D\_\_SSE\_\_ -D\_\_MMX\_\_ -D\_\_SSE2\_\_ -D\_\_SSE3\_\_ -D\_\_SSSE3\_\_ -D\_\_PGI -D\_GNU\_SOURCE -D\_PGCG\_SOURCE -I- -I/software-gpu/compilers/pgi/15.10/linux86-64/15.10/include-gcc44 -I/software-gpu/compilers/pgi/15.10/linux86-64/15.10/include -I/software6/compilers/gcc/4.8/include -I/software6/compilers/gcc/4.6.4/include/c++/4.6.4 -I/software6/compilers/gcc/4.6.4/include/c++/4.6.4/x86\_64-unknown-linux-gnu -I/software6/compilers/gcc/4.6.4/include/c++/4.6.4/backward -I/software6/compilers/gcc/4.6.4/lib/gcc/x86\_64-unknown-linux-gnu/4.6.4/include -I/usr/local/include -I/software6/compilers/gcc/4.6.4/include -I/software6/compilers/gcc/4.6.4/lib/gcc/x86\_64-unknown-linux-gnu/4.6.4/include-fixed -I/usr/include --zc\_eh --gnu\_version=40407 -D\_\_pgnu\_vsn=40407 --preinclude stdarg.h --preinclude\_macros \_cplus\_macros.h -q -o x.il x.C

/software-gpu/compilers/pgi/15.10/linux86-64/15.10/bin/pggpp2 x.C -opt 1 -terse 1 -inform warn -x 119 0xa10000 -x 122 0x40 -x 123 0x1000 -x 127 4 -x 127 17 -x 19 0x400000 -x 28 0x40000 -x 120 0x10000000 -x 70 0x8000 -x 122 1 -x 125 0x20000 -x 117 0x1000 -quad -x 59 4 -tp sandybridge -x 120 0x1000 -astype 0 -fn x.C -il x.il -x 117 0x600 -x 123 0x80000000 -x 123 4 -x 119 0x20 -def \_\_pgnu\_vsn=40407 -alwaysinline /software-gpu/compilers/pgi/15.10/linux86-64/15.10/lib/libintrinsics.il 4 -x 120 0x200000 -x 70 0x40000000 -y 163 0xc0000000 -x 189 0x10 -y 189 0x4000000 -x 198 0x40000 -gnuvsn 40407 -x 69 0x200 -asm x.s

/software6/apps/buildtools/20150928/bin/as x.s -o x.o  
Action(ReadTIFile(./x.ti))

/software6/apps/buildtools/20150928/bin/ld /usr/lib64/crt1.o /usr/lib64/crti.o /software-gpu/compilers/pgi/15.10/linux86-64/15.10/lib/trace\_init.o /usr/lib/gcc/x86\_64-redhat-linux/4.4.7/crtbegin.o /software-gpu/compilers/pgi/15.10/linux86-64/15.10/lib/initmp.o --eh-frame-hdr -m elf\_x86\_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /software-gpu/compilers/pgi/15.10/linux86-64/15.10/lib/pgi.ld -L/software-gpu/compilers/pgi/15.10/linux86-64/15.10/lib -L/usr/lib64 -L/usr/lib/gcc/x86\_64-redhat-linux/4.4.7 x.o -rpath /software-gpu/compilers/pgi/15.10/linux86-64/15.10/lib -L/usr/lib/gcc/x86\_64-redhat-linux/4.4.7/…/…/…/…/lib64 --eh-frame-hdr -lpgatm -lgcc -lgcc\_s -lstdc++ -lpgmp -lnuma -lpthread -lnspgc -lpgc -lm -lgcc -lc -lgcc /usr/lib/gcc/x86\_64-redhat-linux/4.4.7/crtend.o /usr/lib64/crtn.o  
Keeping ./x.dbg

> Very difficult to run dynamically linked executables on systems where the  
> gcc/g++ shared libs are not present.

But they ARE present. PG simply does not find them for some reason. Other compilers work just fine.

> btw - the definition of ‘cluster’ means all the nodes are running  
> the same Linux version and gcc/g++ versions. Having a heterogenous  
> collection of platforms, and calling it a cluster, can lead to problems.  
> But it also might work.

Indeed, and this is the case. Why you imply that it is not the case here ?  
  
  
Maxime[/quote]

---

<div class="post-metadata">

**Author:** ![tull](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@tull](https://forums.developer.nvidia.com/u/tull)\
**Post date:** [April 28, 2016, 4:48pm UTC](https://forums.developer.nvidia.com/t/pgc-not-finding-libstdc/134906/4 "2016-04-28T16:48:55Z")

</div>

If you look at the output of an executable with ldd  
ldd foo

on your build machine, you should see where it finds the  
gcc libraries. If the slave nodes are the same OS and gcc versions,  
ldd foo  
on each of the slave nodes should indicate the same locations  
for gcc libs. If the gcc libs are on the slave nodes but in different places, how  
can this be? - it’s a cluster, and everything is the same!

Any paths that are different on the slave nodes, should be added  
to $LD\_LIBRARY\_PATH.

dave
