pgc++ not finding libstdc++

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 ?

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

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]

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