public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Creating shared library...
@ 1999-05-19 16:34 Alan Burlison
  1999-05-31 21:36 ` Alan Burlison
  0 siblings, 1 reply; 14+ messages in thread
From: Alan Burlison @ 1999-05-19 16:34 UTC (permalink / raw)
  To: Ernie Billing, egcs

Hi,

I was browsing the egcs web archives looking for a solution to *my*
problem when I saw your post. One question - have you got Solaris
patchid 107058-01 installed?  If you have, it's the cause of your
problems - it breaks the linker.  Remove it, relink your stuff and you
should be OK.

Alan Burlison

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Creating shared library...
  1999-05-19 16:34 Creating shared library Alan Burlison
@ 1999-05-31 21:36 ` Alan Burlison
  0 siblings, 0 replies; 14+ messages in thread
From: Alan Burlison @ 1999-05-31 21:36 UTC (permalink / raw)
  To: Ernie Billing, egcs

Hi,

I was browsing the egcs web archives looking for a solution to *my*
problem when I saw your post. One question - have you got Solaris
patchid 107058-01 installed?  If you have, it's the cause of your
problems - it breaks the linker.  Remove it, relink your stuff and you
should be OK.

Alan Burlison

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: Creating shared library...
  1999-05-13 10:59 Ernie Billing
  1999-05-17  1:15 ` Alexandre Oliva
@ 1999-05-31 21:36 ` Ernie Billing
  1 sibling, 0 replies; 14+ messages in thread
From: Ernie Billing @ 1999-05-31 21:36 UTC (permalink / raw)
  To: 'Richard Henderson',
	Ernie Billing, 'egcs@egcs.cygnus.com'
  Cc: Tony Orling

Alright, this cleaned up my problems building my library with the -shared
option, but the program still crashes on the first call into the shared
library.

I've put together a small test program that demonstrates a different
problem: looks like the global destructor in the dynamic library is broken -
it seg faults.  Every thing works fine with a static library.

--- dll.h
class CDll
{
    public :
    CDll();
    virtual ~CDll();
};
--- dll.cpp
#include "dll.h"
CDll::CDll() {}
CDll::~CDll() {}
--- test.cpp
#include "dll.h"
CDll g_obDll;
int main( int argc, char ** argv )
{
    CDll * pobDll;
    pobDll = new CDll;
    delete pobDll;
    return 0;
}
--- Makefile
CXXFLAGS=-g -O -fPIC
CXX=g++
BUILDDLL=$(CXX) -shared
BUILDEXE=$(CXX) $(LDFLAGS)
BUILDARCHIVE=ar -r
EXESRCS = test.cpp
EXEOBJS = $(subst .cpp,.o,$(EXESRCS))
EXE = tst
LIBSRCS = dll.cpp
LIBOBJS = $(subst .cpp,.o,$(LIBSRCS))
DLL = libdll.so
LIB = libdll.a
all: $(EXE)

$(DLL): $(LIBOBJS)
	$(BUILDDLL) -o $(DLL) -fPIC $(LIBOBJS)

$(LIB): $(LIBOBJS)
	$(BUILDARCHIVE) $(LIB) $(LIBOBJS)

$(EXE): $(EXEOBJS) $(DLL)
	$(BUILDEXE) -o $(EXE) -fPIC $(EXEOBJS) -ldll
--- end Makefile

EB


> -----Original Message-----
> From: Richard Henderson [ mailto:rth@cygnus.com ]
> Sent: Tuesday, May 11, 1999 10:28 PM
> To: Ernie Billing; 'egcs@egcs.cygnus.com'
> Subject: Re: Creating shared library...
> 
> 
> On Tue, May 11, 1999 at 10:11:16AM -0700, Ernie Billing wrote:
> > If I create the library following the FAQ with g++ -shared 
> -o libmine.o
> > -fPIC [all the .o's] the link blows up with a whole bunch of unknown
> > references to /usr/local/lib/libstdc++.a and the message "ld: fatal:
> > relocations remain against allocatable but non-writable sections"
> 
> You need to configure egcs with --enable-shared to produce libstdc++
> as a shared library.  Or build it with -fPIC as well.
> 
> 
> r~
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Creating shared library...
  1999-05-17 10:35 ` Alexandre Oliva
@ 1999-05-31 21:36   ` Alexandre Oliva
  0 siblings, 0 replies; 14+ messages in thread
From: Alexandre Oliva @ 1999-05-31 21:36 UTC (permalink / raw)
  To: Ernie Billing
  Cc: 'Richard Henderson', 'egcs@egcs.cygnus.com', Tony Orling

On May 17, 1999, Ernie Billing <Ernie.Billing@NSMG.Seagatesoftware.com> wrote:

> Eric Mouw suggested using GNU libtool - I'm going to look into this.

That's an excellent idea!  (In case you don't know, I'm one of the
maintainers of GNU libtool :-)

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
{oliva,Alexandre.Oliva}@dcc.unicamp.br  aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
*** E-mail about software projects will be forwarded to mailing lists

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: Creating shared library...
  1999-05-17 10:27 Ernie Billing
  1999-05-17 10:35 ` Alexandre Oliva
@ 1999-05-31 21:36 ` Ernie Billing
  1 sibling, 0 replies; 14+ messages in thread
From: Ernie Billing @ 1999-05-31 21:36 UTC (permalink / raw)
  To: 'Alexandre Oliva', Ernie Billing
  Cc: 'Richard Henderson', 'egcs@egcs.cygnus.com', Tony Orling

Sorry, I thought the platform information was still in the email:

Sparc Ultra 10, Solaris 5.7, Egcs 1.1.2.

Eric Mouw suggested using GNU libtool - I'm going to look into this.

Thanx to all,

EB

> -----Original Message-----
> From: Alexandre Oliva [ mailto:oliva@dcc.unicamp.br ]
> Sent: Monday, May 17, 1999 1:15 AM
> To: Ernie Billing
> Cc: 'Richard Henderson'; 'egcs@egcs.cygnus.com'; Tony Orling
> Subject: Re: Creating shared library...
> 
> 
> On May 13, 1999, Ernie Billing 
> <Ernie.Billing@NSMG.Seagatesoftware.com> wrote:
> 
> > Alright, this cleaned up my problems building my library 
> with the -shared
> > option, but the program still crashes on the first call 
> into the shared
> > library.
> 
> Since building shared libraries is highly platform-specific, unless
> you tell us which is your target platform, there's not much we can do
> to help.
> 
> -- 
> Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
> {oliva,Alexandre.Oliva}@dcc.unicamp.br  aoliva@{acm.org,computer.org}
> oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
> *** E-mail about software projects will be forwarded to mailing lists
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Creating shared library...
  1999-05-11 10:11 Ernie Billing
  1999-05-11 22:28 ` Richard Henderson
@ 1999-05-31 21:36 ` Ernie Billing
  1 sibling, 0 replies; 14+ messages in thread
From: Ernie Billing @ 1999-05-31 21:36 UTC (permalink / raw)
  To: 'egcs@egcs.cygnus.com'

I'm using egcs 1.1.2 on Solaris 5.7 and trying to create a shared library.  

All .cpp files compiled -fPIC.

If I create the library with g++ -G -o libmine.so [all the .o's] everything
goes fine until the first call into the library.  The program bombs with a
SIG SEGV.

If I create the library following the FAQ with g++ -shared -o libmine.o
-fPIC [all the .o's] the link blows up with a whole bunch of unknown
references to /usr/local/lib/libstdc++.a and the message "ld: fatal:
relocations remain against allocatable but non-writable sections"

Am I missing an option or is this a bug?

Thanx for the help...

Ernie Billing
ebilling@seagatesoftware.com
Principle Software Developer
Seagate Software, NMSG

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Creating shared library...
  1999-05-11 22:28 ` Richard Henderson
@ 1999-05-31 21:36   ` Richard Henderson
  0 siblings, 0 replies; 14+ messages in thread
From: Richard Henderson @ 1999-05-31 21:36 UTC (permalink / raw)
  To: Ernie Billing, 'egcs@egcs.cygnus.com'

On Tue, May 11, 1999 at 10:11:16AM -0700, Ernie Billing wrote:
> If I create the library following the FAQ with g++ -shared -o libmine.o
> -fPIC [all the .o's] the link blows up with a whole bunch of unknown
> references to /usr/local/lib/libstdc++.a and the message "ld: fatal:
> relocations remain against allocatable but non-writable sections"

You need to configure egcs with --enable-shared to produce libstdc++
as a shared library.  Or build it with -fPIC as well.


r~

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Creating shared library...
  1999-05-17  1:15 ` Alexandre Oliva
@ 1999-05-31 21:36   ` Alexandre Oliva
  0 siblings, 0 replies; 14+ messages in thread
From: Alexandre Oliva @ 1999-05-31 21:36 UTC (permalink / raw)
  To: Ernie Billing
  Cc: 'Richard Henderson', 'egcs@egcs.cygnus.com', Tony Orling

On May 13, 1999, Ernie Billing <Ernie.Billing@NSMG.Seagatesoftware.com> wrote:

> Alright, this cleaned up my problems building my library with the -shared
> option, but the program still crashes on the first call into the shared
> library.

Since building shared libraries is highly platform-specific, unless
you tell us which is your target platform, there's not much we can do
to help.

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
{oliva,Alexandre.Oliva}@dcc.unicamp.br  aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
*** E-mail about software projects will be forwarded to mailing lists

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Creating shared library...
  1999-05-17 10:27 Ernie Billing
@ 1999-05-17 10:35 ` Alexandre Oliva
  1999-05-31 21:36   ` Alexandre Oliva
  1999-05-31 21:36 ` Ernie Billing
  1 sibling, 1 reply; 14+ messages in thread
From: Alexandre Oliva @ 1999-05-17 10:35 UTC (permalink / raw)
  To: Ernie Billing
  Cc: 'Richard Henderson', 'egcs@egcs.cygnus.com', Tony Orling

On May 17, 1999, Ernie Billing <Ernie.Billing@NSMG.Seagatesoftware.com> wrote:

> Eric Mouw suggested using GNU libtool - I'm going to look into this.

That's an excellent idea!  (In case you don't know, I'm one of the
maintainers of GNU libtool :-)

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
{oliva,Alexandre.Oliva}@dcc.unicamp.br  aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
*** E-mail about software projects will be forwarded to mailing lists

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: Creating shared library...
@ 1999-05-17 10:27 Ernie Billing
  1999-05-17 10:35 ` Alexandre Oliva
  1999-05-31 21:36 ` Ernie Billing
  0 siblings, 2 replies; 14+ messages in thread
From: Ernie Billing @ 1999-05-17 10:27 UTC (permalink / raw)
  To: 'Alexandre Oliva', Ernie Billing
  Cc: 'Richard Henderson', 'egcs@egcs.cygnus.com', Tony Orling

Sorry, I thought the platform information was still in the email:

Sparc Ultra 10, Solaris 5.7, Egcs 1.1.2.

Eric Mouw suggested using GNU libtool - I'm going to look into this.

Thanx to all,

EB

> -----Original Message-----
> From: Alexandre Oliva [ mailto:oliva@dcc.unicamp.br ]
> Sent: Monday, May 17, 1999 1:15 AM
> To: Ernie Billing
> Cc: 'Richard Henderson'; 'egcs@egcs.cygnus.com'; Tony Orling
> Subject: Re: Creating shared library...
> 
> 
> On May 13, 1999, Ernie Billing 
> <Ernie.Billing@NSMG.Seagatesoftware.com> wrote:
> 
> > Alright, this cleaned up my problems building my library 
> with the -shared
> > option, but the program still crashes on the first call 
> into the shared
> > library.
> 
> Since building shared libraries is highly platform-specific, unless
> you tell us which is your target platform, there's not much we can do
> to help.
> 
> -- 
> Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
> {oliva,Alexandre.Oliva}@dcc.unicamp.br  aoliva@{acm.org,computer.org}
> oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
> *** E-mail about software projects will be forwarded to mailing lists
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Creating shared library...
  1999-05-13 10:59 Ernie Billing
@ 1999-05-17  1:15 ` Alexandre Oliva
  1999-05-31 21:36   ` Alexandre Oliva
  1999-05-31 21:36 ` Ernie Billing
  1 sibling, 1 reply; 14+ messages in thread
From: Alexandre Oliva @ 1999-05-17  1:15 UTC (permalink / raw)
  To: Ernie Billing
  Cc: 'Richard Henderson', 'egcs@egcs.cygnus.com', Tony Orling

On May 13, 1999, Ernie Billing <Ernie.Billing@NSMG.Seagatesoftware.com> wrote:

> Alright, this cleaned up my problems building my library with the -shared
> option, but the program still crashes on the first call into the shared
> library.

Since building shared libraries is highly platform-specific, unless
you tell us which is your target platform, there's not much we can do
to help.

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
{oliva,Alexandre.Oliva}@dcc.unicamp.br  aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
*** E-mail about software projects will be forwarded to mailing lists

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: Creating shared library...
@ 1999-05-13 10:59 Ernie Billing
  1999-05-17  1:15 ` Alexandre Oliva
  1999-05-31 21:36 ` Ernie Billing
  0 siblings, 2 replies; 14+ messages in thread
From: Ernie Billing @ 1999-05-13 10:59 UTC (permalink / raw)
  To: 'Richard Henderson',
	Ernie Billing, 'egcs@egcs.cygnus.com'
  Cc: Tony Orling

Alright, this cleaned up my problems building my library with the -shared
option, but the program still crashes on the first call into the shared
library.

I've put together a small test program that demonstrates a different
problem: looks like the global destructor in the dynamic library is broken -
it seg faults.  Every thing works fine with a static library.

--- dll.h
class CDll
{
    public :
    CDll();
    virtual ~CDll();
};
--- dll.cpp
#include "dll.h"
CDll::CDll() {}
CDll::~CDll() {}
--- test.cpp
#include "dll.h"
CDll g_obDll;
int main( int argc, char ** argv )
{
    CDll * pobDll;
    pobDll = new CDll;
    delete pobDll;
    return 0;
}
--- Makefile
CXXFLAGS=-g -O -fPIC
CXX=g++
BUILDDLL=$(CXX) -shared
BUILDEXE=$(CXX) $(LDFLAGS)
BUILDARCHIVE=ar -r
EXESRCS = test.cpp
EXEOBJS = $(subst .cpp,.o,$(EXESRCS))
EXE = tst
LIBSRCS = dll.cpp
LIBOBJS = $(subst .cpp,.o,$(LIBSRCS))
DLL = libdll.so
LIB = libdll.a
all: $(EXE)

$(DLL): $(LIBOBJS)
	$(BUILDDLL) -o $(DLL) -fPIC $(LIBOBJS)

$(LIB): $(LIBOBJS)
	$(BUILDARCHIVE) $(LIB) $(LIBOBJS)

$(EXE): $(EXEOBJS) $(DLL)
	$(BUILDEXE) -o $(EXE) -fPIC $(EXEOBJS) -ldll
--- end Makefile

EB


> -----Original Message-----
> From: Richard Henderson [ mailto:rth@cygnus.com ]
> Sent: Tuesday, May 11, 1999 10:28 PM
> To: Ernie Billing; 'egcs@egcs.cygnus.com'
> Subject: Re: Creating shared library...
> 
> 
> On Tue, May 11, 1999 at 10:11:16AM -0700, Ernie Billing wrote:
> > If I create the library following the FAQ with g++ -shared 
> -o libmine.o
> > -fPIC [all the .o's] the link blows up with a whole bunch of unknown
> > references to /usr/local/lib/libstdc++.a and the message "ld: fatal:
> > relocations remain against allocatable but non-writable sections"
> 
> You need to configure egcs with --enable-shared to produce libstdc++
> as a shared library.  Or build it with -fPIC as well.
> 
> 
> r~
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Creating shared library...
  1999-05-11 10:11 Ernie Billing
@ 1999-05-11 22:28 ` Richard Henderson
  1999-05-31 21:36   ` Richard Henderson
  1999-05-31 21:36 ` Ernie Billing
  1 sibling, 1 reply; 14+ messages in thread
From: Richard Henderson @ 1999-05-11 22:28 UTC (permalink / raw)
  To: Ernie Billing, 'egcs@egcs.cygnus.com'

On Tue, May 11, 1999 at 10:11:16AM -0700, Ernie Billing wrote:
> If I create the library following the FAQ with g++ -shared -o libmine.o
> -fPIC [all the .o's] the link blows up with a whole bunch of unknown
> references to /usr/local/lib/libstdc++.a and the message "ld: fatal:
> relocations remain against allocatable but non-writable sections"

You need to configure egcs with --enable-shared to produce libstdc++
as a shared library.  Or build it with -fPIC as well.


r~

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Creating shared library...
@ 1999-05-11 10:11 Ernie Billing
  1999-05-11 22:28 ` Richard Henderson
  1999-05-31 21:36 ` Ernie Billing
  0 siblings, 2 replies; 14+ messages in thread
From: Ernie Billing @ 1999-05-11 10:11 UTC (permalink / raw)
  To: 'egcs@egcs.cygnus.com'

I'm using egcs 1.1.2 on Solaris 5.7 and trying to create a shared library.  

All .cpp files compiled -fPIC.

If I create the library with g++ -G -o libmine.so [all the .o's] everything
goes fine until the first call into the library.  The program bombs with a
SIG SEGV.

If I create the library following the FAQ with g++ -shared -o libmine.o
-fPIC [all the .o's] the link blows up with a whole bunch of unknown
references to /usr/local/lib/libstdc++.a and the message "ld: fatal:
relocations remain against allocatable but non-writable sections"

Am I missing an option or is this a bug?

Thanx for the help...

Ernie Billing
ebilling@seagatesoftware.com
Principle Software Developer
Seagate Software, NMSG

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~1999-05-31 21:36 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-05-19 16:34 Creating shared library Alan Burlison
1999-05-31 21:36 ` Alan Burlison
  -- strict thread matches above, loose matches on Subject: below --
1999-05-17 10:27 Ernie Billing
1999-05-17 10:35 ` Alexandre Oliva
1999-05-31 21:36   ` Alexandre Oliva
1999-05-31 21:36 ` Ernie Billing
1999-05-13 10:59 Ernie Billing
1999-05-17  1:15 ` Alexandre Oliva
1999-05-31 21:36   ` Alexandre Oliva
1999-05-31 21:36 ` Ernie Billing
1999-05-11 10:11 Ernie Billing
1999-05-11 22:28 ` Richard Henderson
1999-05-31 21:36   ` Richard Henderson
1999-05-31 21:36 ` Ernie Billing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).