Linking problem shared objects SuSE10.2

I’m stuck migrating a larger software project compiled with pgCC from a SUSE 9.3 Linux build platform
to a SUSE 10.2 Linux build platform.

Using the following compiler and linker versions,

pgCC --version
pgCC 7.1-5 64-bit target on x86-64 Linux -tp k8-64e

/usr/bin/ld --version
GNU ld version 2.15.94.0.2.2 20041220 (SuSE Linux)

the old build system pulls through:

################################################################

[… snip…]

pgCC -c -tp x64 -O3 -fPIC -mcmodel=small -Minline=levels:10,size:1000 -fastsse -I…/…/include -I/usr/local/rsi/idl/external/include/ shared_memory.cpp -o shared_memory.o
pgCC -c -tp x64 -O3 -fPIC -mcmodel=small -Minline=levels:10,size:1000 -fastsse -I…/…/include -I/usr/local/rsi/idl/external/include/ OpenMP_controls.cpp -o OpenMP_controls.o
ar -rs libsmtk.a shared_memory.o OpenMP_controls.o
ar: creating libsmtk.a
pgCC -tp x64 -mp -O3 -Mipa=fast -fPIC -mcmodel=small -shared -L…/…/lib -L/usr/local/pgi/linux86-64/7.1-5/lib -Wl,–allow-multiple-definition shared_memory.o -lpgftnrtl -lm -o shared_memory.so
IPA inhibited: no main routine
pgCC -tp x64 -mp -O3 -Mipa=fast -fPIC -mcmodel=small -shared -L…/…/lib -L/usr/local/pgi/linux86-64/7.1-5/lib -Wl,–allow-multiple-definition OpenMP_controls.o -lpgftnrtl -lm -o OpenMP_controls.so

[… snip…]

#################################################################


While the new system using the following compiler versions:

pgCC --version
pgCC 7.1-5 64-bit target on x86-64 Linux -tp core2-64

/usr/bin/ld --version
GNU ld version 2.17.50.0.5 20060927 (SUSE Linux)

Does not link:

################################################################

[… snip…]

pgCC -c -tp x64 -O3 -fPIC -mcmodel=small -Minline=levels:10,size:1000 -fastsse -I…/…/include -I/usr/local/rsi/idl/external/include/ shared_memory.cpp -o shared_memory.o
pgCC -c -tp x64 -O3 -fPIC -mcmodel=small -Minline=levels:10,size:1000 -fastsse -I…/…/include -I/usr/local/rsi/idl/external/include/ OpenMP_controls.cpp -o OpenMP_controls.o
ar -rs libsmtk.a shared_memory.o OpenMP_controls.o
ar: creating libsmtk.a
pgCC -tp x64 -mp -O3 -Mipa=fast -fPIC -mcmodel=small -shared -L…/…/lib -L/usr/local/pgi/linux86-64/7.1-5/lib -Wl,–allow-multiple-definition shared_memory.o -lpgftnrtl -lm -o shared_memory.so
IPA inhibited: no main routine
/usr/bin/ld: /usr/local/pgi/linux86-64/7.1-5/lib/libstd.a(collate.o): relocation R_X86_64_32S against `a local symbol’ can not be used when making a shared object; recompile with -fPIC
/usr/local/pgi/linux86-64/7.1-5/lib/libstd.a: could not read symbols: Bad value
child process exit status 1: /usr/bin/ld
make: *** [shared_memory.so] Error 2

[… snip…]

################################################################

Note that the build compiled on the old platform flawlessly executes on the new platform.
Is this a linker problem specific to SUSE 10.2?

Thanks for any hints.

It looks like you are specifying L/usr/local/pgi/linux86-64/7.1-5/lib and are thus pulling info out of libstd.a. Probably should be pointing to the /usr/local/pgi/linux86-64/7.1-5/libso directory where libstd.so is. It could be that on your other system someone moved some of the .so’s from libso over?

Just in case someone runs into similar problems, here a workaround to my problem.

It looks like you are specifying L/usr/local/pgi/linux86-64/7.1-5/lib and are thus pulling info out of libstd.a. Probably should be pointing to the /usr/local/pgi/linux86-64/7.1-5/libso directory where libstd.so is.

Yes, I have tried meanwhile also this (and many many other things), but to no avail.

Since I’m running out of ideas how to make this library-loader/linker behave and have to move on, I hardcoded the .so path during linking:

CLINKLIBS = -Wl,-Bstatic -lacml_mv -lacml -Wl,-Bdynamic -lm -pgf90libs -Wl,–rpath=/usr/local/pgi_7.1.5/linux86-64/7.1-5/libso

Not nice, but does the trick.