11/28 On an HP-UX system, how do I make a shared library? I tried the
procedure I normally use with other systems, but it fails. Here's
what happens:
gcc -c -fPIC a.c
[no errors]
gcc -shared -o a.so a.o
And I get this error message:
/usr/ccs/bin/ld: DP relative code in file /var/tmp/ccmAcwPp.o - shared
library must be position independent. Use +z or +Z to recompile.
collect2: ld returned 1 exit status
Neither +z nor +Z appear to be options for gcc though.
\_ gcc has always had broken so support for hpux. you may either need
to upgrade or give up (read the release notes for gcc to find out
which). you might have better luck with -fpic instead of -fPIC. -ali
\_ Check how your gcc was built. The *.a files there (libg2c.a,
libstdc++.a, libgcc.a etc.) probably have position dependent
code in them. --dim
\_ libc has nothingto do with making a .so. there is no check for
libc inthis step.
\_ Not sure if this is what you're asking for, but try:
ar -q library.a objectfile.o
\_ (S)he said shared
\_ *
\_ On a platform I don't know, I usually snag some random library
(say gnu readline) and run ./configure on it, then read the Makefile
(or just run make and see what the shlib link line looks like)
\_ *
\_ those branded with * are morons
\_ *
\_ * |