Subject: Re: How to build shared libs ? (was: Problems compiling)
To: None <port-arm32@NetBSD.ORG>
From: paul <pwain@nc.com>
List: port-arm32
Date: 02/07/1998 14:10:40
This is a multi-part message in MIME format.
--------------A419271AD58564BE28EF1EC5
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

1) Compile up all your source files with '-fpic' (-fPIC will not work!)

2) link them together with:

        ld -Bshareable -o libfoo.so.1.1 <object files>

3) You may also want to add the -x flag to the line above or follow it with a:

        strip -x libfoo.so.1.1

    to remove all the Lnnn local symbols that gcc adds (reduces the size quite
nicely).

Peter.Berg@ww.tu-freiberg.de wrote:

> > Finally, I went back to something easier and compiled xsysstats. It compiles
> > and it does work using the 'standard' gcc flags but if I try "-fpic -DPIC" or
> > "-fPIC" it seems to suffer from the same problems as the Lesstif programs
> > (Segmentation fault)... is -fpic working?
> > ld sometimes reports some "RSS relocation of text" (or something like that, I
>
> This (I guess) happens if you link static and dynamic libs together to a
> program. I found this too, but if you read the messages carefully you'll see
> that always something like
>
> 'ld: ./libgFX.a(resize.o): RRS text relocation at 0x2e90 for "___sF"'
>
> is reported, isn't it ?
>
> But this now points me to another problem: How do I build a shared lib ?
> The linux style way doesn't seem to work:
>
> cc -s -shared -Wl,-soname,libgFX.so.0 -o libgFX.so.0 $(LOBJS)
>
> it aborts with
>
> ld: libgFX.so.0: No such file or directory
> *** Error code 1
>
> Any ideas ?
>
> --
> /--------------------------------------------------------------------\
> | Peter Berg            email: Peter.Berg@ww.tu-freiberg.de          |
> |                        http://riscbsd.home.ml.org                  |
> \--------------------------------------------------------------------/



--------------A419271AD58564BE28EF1EC5
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Paul Wain
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Paul Wain
n:              Wain;Paul
org:            Network Computer Inc.
adr:            1000 Bridge Parkway;;;Redwood City;CA;94065;USA
email;internet: pwain@nc.com
title:          OS Development Engr.
tel;work:       +1 650 631 4628
tel;fax:        +1 650 631 4680
tel;home:       +1 415 297 6959 (Mobil)
x-mozilla-cpt:  ;0
x-mozilla-html: FALSE
version:        2.1
end:            vcard


--------------A419271AD58564BE28EF1EC5--