building shared libs with g++ 2.95.2 on HP-UX 11

Martin Sebor
Sat Sep 9 16:35:00 GMT 2000


I'm wondering if anyone knows how to prevent the linker errors (shown
below) I'm getting when building shared libs on HP-UX 11 (I know it's
not a supported platform).

Compiling and linking in the same step seems to work but I'd prefer not
to have to do that.

Thanks in advance

$ echo "void foo () { }" > t.cpp ; gcc -c -fPIC t.cpp && gcc t.o -shared
/usr/bin/ld: DP relative code in file /var/tmp/ccyhoDuR.o - shared
library must be position
    independent.  Use +z or +Z to recompile.
collect2: ld returned 1 exit status

More information about the Gcc-bugs mailing list