From mboxrd@z Thu Jan 1 00:00:00 1970 From: Manfred Hollstein To: law@cygnus.com Cc: ram@netcom.com, egcs@cygnus.com Subject: Re: SunOS shared libs ? Date: Thu, 11 Jun 1998 11:04:00 -0000 Message-id: <13696.5586.399913.956667@saturn.hollstein.net> References: <13694.39488.317757.302619@slsvhmt> <14600.897495645@hurl.cygnus.com> X-SW-Source: 1998-06/msg00441.html On Wed, 10 June 1998, 10:20:45, law@hurl.cygnus.com wrote: > > In message < 13694.39488.317757.302619@slsvhmt >you write: > > > Ok, thanks that seems to have fixed the problem. I'd strongly > > > suggest adding this to the FAQ. > > > > Jeff Law, do you think it's worthwhile? > It's probably a reasonable thing to do. > > jeff How about this? diff -rupN -x CVS wwwdocs.orig/htdocs/faq.html wwwdocs/htdocs/faq.html --- wwwdocs.orig/htdocs/faq.html Tue May 19 22:24:19 1998 +++ wwwdocs/htdocs/faq.html Thu Jun 11 19:34:37 1998 @@ -40,6 +40,7 @@
  • Using egcs with GNAT/Ada
  • Using egcs with GNU Pascal
  • Using CVS to download snapshots +
  • `assert pure-text failed:' - Why can't I build a shared library?
    @@ -607,8 +608,27 @@ the form "egcs_ss_". The latest o tag "egcs_latest_snapshot".
    +

    `assert pure-text failed:' - Why can't I build a shared library?

    +

    This kind of error occurs when you've failed to provide proper flags +to gcc how to produce position independent code (PIC). + +

    How comes this? I only want to link my various .o files into one shared library! +This is due to gcc's collect2 program generating a small .c file which is responsible for +e.g. calling static CTOR/DTORs. This file will be silently compiled and linked with +your own .o files. Make sure to specify -fPIC or -fpic (whatever +you've used for compiling your .o files) even when linking: + +

    +	gcc -c -fPIC myfile.c
    +	gcc -shared -o libmyfile.so -fPIC myfile.o
    +
    + +

    This kind of error will most likely be seen on SunOS and HP-UX and when using +their native binutils, i.e. no GNU as and/or ld. + +


    Return to the egcs home page -

    Last modified: May 9, 1998 +

    Last modified: June 11, 1998 manfred