Linking a shared object with static libraries for RPM/64-bit

Hello -

I’d like to provide a Linux RPM for the x86_64 (64-bit) architecture for the software I’m working on. The Portland compilers work great when compiling for source - but for the RPM I need to be able to create a shared object that is statically linked with Portland libraries (i.e. libpgc.a) so that users don’t need libpgc.so on their system.

The current error I get when I try to link directly with libpgc.a is

/usr/bin/ld: /usr/local/pgi/linux86-64/5.2/lib/libpgc.a(va_arg.o): relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC

Is there a way to get the static pgcc libraries compiled with fPIC? Or any other advice on how I can link the static libraries with my shared object? I can’t use the portability package since it is not yet available for 64-bit architectures.

Thanks in advance.

Todd

I have this same problem. I am unable to build 64-bit shared libraries on x86_64 platform. In all (three) of the cases i’ve tried, it’s been a GPL licensed package configured with libtool. Are you using GNU libtool, automake, etc? There seems to be a problem with libtool and x86_64.

I am using libtool/automake. I was able to create a shared library when I used the pgcc shared objects (libpgc.so, etc), but not when linking with the static ones necessary for RPM.

Hi Todd,


In the small memory model, this should work. However, the relocation error your getting is because your using the medium memory model (-mcmodel=medium). Currently you cannot statically link objects using the medium memory model. (See the PGI release notes http://www.pgroup.com/support/new_rel.htm for more information)

Unfortunately, you’ll need to include libpgc.so. The good news however, is that there is only one version for all x86_64 systems (and why there isn’t a portability package), so you can redistribute the version you have.

Hope this helped!
Mat