HPUX - "-fpic" and "Shared Library must be Position-Independent"

HPUX - "-fpic" and "Shared Library must be Position-Independent"

Post by Ronan Jameso » Wed, 14 Jan 1998 04:00:00



Folks, again....

I know there's some kind of issue regarding using linkers on HPUX with GNU
GCC - particularly when creating shared-object libraries.
Despite the fact that I've "-fpic" on the compile line for the one-and-only
C file I still get the following....

asterion:34,SOL-Test: make.dhp9000.old
/usr/local/GNU/bin/make
/usr/local/GNU/bin/gcc
gcc -c -fpic -I. -DQHP9000 -DQUNIX -o
dhp9000/LibA.o -Wall -IUtils -g -DQDEBUG LibA.c
gcc -g -shared -nostdlib -o dhp9000/libLibA.sl dhp9000/LibA.o
/bin/ld: DP-Relative Code in file /var/tmp/cca25759.o - Shared Library must
be Position-Independent
collect2: ld returned 1 exit status
make: *** [dhp9000/libLibA.sl] Error 1
asterion:35,SOL-Test:

GCC is gcc-2.7.2.3 and I'm using the GNU assembler (version 2.8.1).
"ld" is complaining - the GNU BinUtils bundle does not come with an "ld" for
HPUX either so I guess I have to use the system one ?
Why is my linking stage complaining about not having PIC code - my "-fpic"
is very much present !

Any ideas ? Solaris and DigitialUnix work fine...HPUX is beginning to annoy
me !

Many thanks,
Ronan Jameson,
CSK Software, Dublin.