Error when compiling a program

Good morning. I’m kind of new to using Portland Group. I’m trying to compile our in house software consisting of a library and misc binaries. In the final link stage of the library I get this error:

/usr/bin/ld: /usr/pgi/linux86-64/5.2/lib/libstd.a(fstream.o): relocation R_X86_64_32S can not be used when making a shared object; recompile with -fPIC
/usr/pgi/linux86-64/5.2/lib/libstd.a: could not read symbols: Bad value

We are using the 5.2 64bit version on a quad AMD Opteron system.

Hi bigjnsa,

This error typically occurs when you are creating a shared library and are linking in with the non-‘fpic’ versions of our static libraries. Unfortunately, we have only just started to include ‘fpic’ versions of the static libraries with the 6.0 release. (They are located in the “libso” directory). With 5.2 and earlier you’ll need to link with the dynamic libraries.

  • Mat

Thanks for the help. Now I just need to figure out how to tell pgcc to link against the shared library. Will it hurt to move lib out of the way and symlink libso to lib?

The simplest way is to add “-fpic” to the link line. You can also add “-Bdynamic -L/libso”.

  • Mat