Thread: Bug in Makefile.shlib

Bug in Makefile.shlib

From
Olivier PRENANT
Date:
Hi,

I think I figured why I can't buil plperl on unixware 711/OpenUnix 800.

It seems Makefile.shlib has changed between 722 and 73 and -z text has
been added. However with this on, it fails to build libperl.so

Maybe I'm wrong, but could someone consider this patch.

Regards,

-- 
Olivier PRENANT             Tel:    +33-5-61-50-97-00 (Work)
Quartier d'Harraud Turrou           +33-5-61-50-97-01 (Fax)
31190 AUTERIVE                      +33-6-07-63-80-64 (GSM)
FRANCE                      Email: ohp@pyrenet.fr
------------------------------------------------------------------------------
Make your life a dream, make your dream a reality. (St Exupery)

Re: Bug in Makefile.shlib

From
"Serguei Mokhov"
Date:
----- Original Message ----- 
From: "Olivier PRENANT" <ohp@pyrenet.fr>
Sent: September 04, 2002 12:18 PM

> I think I figured why I can't buil plperl on unixware 711/OpenUnix 800.
> 
> It seems Makefile.shlib has changed between 722 and 73 and -z text has
> been added. However with this on, it fails to build libperl.so
> 
> Maybe I'm wrong, but could someone consider this patch.

Your patch got it backwards :)

-s


Re: Bug in Makefile.shlib

From
Olivier PRENANT
Date:
Oops...

This one should be all right!!

Sorry

Regards
On Wed, 4 Sep 2002, Serguei Mokhov wrote:

> Date: Wed, 4 Sep 2002 12:23:11 -0400
> From: Serguei Mokhov <mokhov@cs.concordia.ca>
> To: ohp@pyrenet.fr, pgsql-hackers list <pgsql-hackers@postgresql.org>
> Subject: Re: [HACKERS] Bug in Makefile.shlib
> 
> ----- Original Message ----- 
> From: "Olivier PRENANT" <ohp@pyrenet.fr>
> Sent: September 04, 2002 12:18 PM
> 
> > I think I figured why I can't buil plperl on unixware 711/OpenUnix 800.
> > 
> > It seems Makefile.shlib has changed between 722 and 73 and -z text has
> > been added. However with this on, it fails to build libperl.so
> > 
> > Maybe I'm wrong, but could someone consider this patch.
> 
> Your patch got it backwards :)
> 
> -s
> 

-- 
Olivier PRENANT             Tel:    +33-5-61-50-97-00 (Work)
Quartier d'Harraud Turrou           +33-5-61-50-97-01 (Fax)
31190 AUTERIVE                      +33-6-07-63-80-64 (GSM)
FRANCE                      Email: ohp@pyrenet.fr
------------------------------------------------------------------------------
Make your life a dream, make your dream a reality. (St Exupery)

Re: Bug in Makefile.shlib

From
Tom Lane
Date:
Olivier PRENANT <ohp@pyrenet.fr> writes:
> I think I figured why I can't buil plperl on unixware 711/OpenUnix 800.

> It seems Makefile.shlib has changed between 722 and 73 and -z text has
> been added.

Not hardly.  The "-z text" option has been in there since at least 6.4.
6.4's Makefile.shlib has

ifeq ($(PORTNAME), unixware) ... LDFLAGS_SL            := -G -z text ...
endif

which was cribbed from even older shlib support in other files.  We used
that up through 7.0 without any revisions.  In 7.1 Makefile.shlib was
revised pretty heavily; 7.1 has a unixware section that is identical to
current sources, in particular
 LINK.shared        += -Wl,-z,text -Wl,-h,$(soname)

So I think this code is pretty well tested and removing the -z option
is more likely to break things than fix them.

What misbehavior are you seeing exactly?
        regards, tom lane


Re: Bug in Makefile.shlib

From
Larry Rosenman
Date:
On Wed, 2002-09-04 at 12:28, Tom Lane wrote:
> Olivier PRENANT <ohp@pyrenet.fr> writes:
> > I think I figured why I can't buil plperl on unixware 711/OpenUnix 800.
> 
> > It seems Makefile.shlib has changed between 722 and 73 and -z text has
> > been added.
> 
> Not hardly.  The "-z text" option has been in there since at least 6.4.
> 6.4's Makefile.shlib has
> 
> ifeq ($(PORTNAME), unixware)
>   ...
>   LDFLAGS_SL            := -G -z text
>   ...
> endif
> 
> which was cribbed from even older shlib support in other files.  We used
> that up through 7.0 without any revisions.  In 7.1 Makefile.shlib was
> revised pretty heavily; 7.1 has a unixware section that is identical to
> current sources, in particular
> 
>   LINK.shared        += -Wl,-z,text -Wl,-h,$(soname)
> 
> So I think this code is pretty well tested and removing the -z option
> is more likely to break things than fix them.
> 
> What misbehavior are you seeing exactly?
see my post from ~2 weeks ago on -hackers with a 7.2.[12] problem. 

It flat doesn't work. 

I can dig the post up if you want. 


> 
>             regards, tom lane
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
> http://www.postgresql.org/users-lounge/docs/faq.html
> 
-- 
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749



Re: Bug in Makefile.shlib

From
Olivier PRENANT
Date:
Well, Tom and Larry,

I've posted already on -hackers but my posts did'nt semm to get through!

The problem is that at link time, ld complains about text segment beeing
written to in Dynaloader.

The only way was to remove -Wl,-z text.

I agree this sounded stupid. But I can't think of something else.
This is with perl-5.6.1 FWIW

Regards
On 4 Sep 2002, Larry Rosenman wrote:

> Date: 04 Sep 2002 12:37:35 -0500
> From: Larry Rosenman <ler@lerctr.org>
> To: Tom Lane <tgl@sss.pgh.pa.us>
> Cc: ohp@pyrenet.fr, pgsql-hackers list <pgsql-hackers@postgresql.org>
> Subject: Re: [HACKERS] Bug in Makefile.shlib
> 
> On Wed, 2002-09-04 at 12:28, Tom Lane wrote:
> > Olivier PRENANT <ohp@pyrenet.fr> writes:
> > > I think I figured why I can't buil plperl on unixware 711/OpenUnix 800.
> > 
> > > It seems Makefile.shlib has changed between 722 and 73 and -z text has
> > > been added.
> > 
> > Not hardly.  The "-z text" option has been in there since at least 6.4.
> > 6.4's Makefile.shlib has
> > 
> > ifeq ($(PORTNAME), unixware)
> >   ...
> >   LDFLAGS_SL            := -G -z text
> >   ...
> > endif
> > 
> > which was cribbed from even older shlib support in other files.  We used
> > that up through 7.0 without any revisions.  In 7.1 Makefile.shlib was
> > revised pretty heavily; 7.1 has a unixware section that is identical to
> > current sources, in particular
> > 
> >   LINK.shared        += -Wl,-z,text -Wl,-h,$(soname)
> > 
> > So I think this code is pretty well tested and removing the -z option
> > is more likely to break things than fix them.
> > 
> > What misbehavior are you seeing exactly?
> see my post from ~2 weeks ago on -hackers with a 7.2.[12] problem. 
> 
> It flat doesn't work. 
> 
> I can dig the post up if you want. 
> 
> 
> > 
> >             regards, tom lane
> > 
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: Have you checked our extensive FAQ?
> > 
> > http://www.postgresql.org/users-lounge/docs/faq.html
> > 
> 

-- 
Olivier PRENANT             Tel:    +33-5-61-50-97-00 (Work)
Quartier d'Harraud Turrou           +33-5-61-50-97-01 (Fax)
31190 AUTERIVE                      +33-6-07-63-80-64 (GSM)
FRANCE                      Email: ohp@pyrenet.fr
------------------------------------------------------------------------------
Make your life a dream, make your dream a reality. (St Exupery)



Re: Bug in Makefile.shlib

From
Olivier PRENANT
Date:
Me again!!

These are errors I get with orginal Makefile.shlib:

Warning: No bytecode->native mapping for a bytecode
Warning: JIT compiler failed for org/apache/crimson/parser/Parser2.maybeComment(Z)Z
UX:ld: INFO: text relocations referenced from files:
DynaLoader.a(DynaLoader.o)
UX:ld: ERROR: relocations remain against non-writeable, allocatable section .text
gmake[3]: *** [libplperl.so.0.0] Error 1
gmake[2]: *** [all] Error 2
gmake[1]: *** [all] Error 2
gmake: *** [all] Error 2
UX:make: ERROR: fatal error.

Regards,
On 4 Sep 2002, Larry Rosenman wrote:

> Date: 04 Sep 2002 12:37:35 -0500
> From: Larry Rosenman <ler@lerctr.org>
> To: Tom Lane <tgl@sss.pgh.pa.us>
> Cc: ohp@pyrenet.fr, pgsql-hackers list <pgsql-hackers@postgresql.org>
> Subject: Re: [HACKERS] Bug in Makefile.shlib
> 
> On Wed, 2002-09-04 at 12:28, Tom Lane wrote:
> > Olivier PRENANT <ohp@pyrenet.fr> writes:
> > > I think I figured why I can't buil plperl on unixware 711/OpenUnix 800.
> > 
> > > It seems Makefile.shlib has changed between 722 and 73 and -z text has
> > > been added.
> > 
> > Not hardly.  The "-z text" option has been in there since at least 6.4.
> > 6.4's Makefile.shlib has
> > 
> > ifeq ($(PORTNAME), unixware)
> >   ...
> >   LDFLAGS_SL            := -G -z text
> >   ...
> > endif
> > 
> > which was cribbed from even older shlib support in other files.  We used
> > that up through 7.0 without any revisions.  In 7.1 Makefile.shlib was
> > revised pretty heavily; 7.1 has a unixware section that is identical to
> > current sources, in particular
> > 
> >   LINK.shared        += -Wl,-z,text -Wl,-h,$(soname)
> > 
> > So I think this code is pretty well tested and removing the -z option
> > is more likely to break things than fix them.
> > 
> > What misbehavior are you seeing exactly?
> see my post from ~2 weeks ago on -hackers with a 7.2.[12] problem. 
> 
> It flat doesn't work. 
> 
> I can dig the post up if you want. 
> 
> 
> > 
> >             regards, tom lane
> > 
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: Have you checked our extensive FAQ?
> > 
> > http://www.postgresql.org/users-lounge/docs/faq.html
> > 
> 

-- 
Olivier PRENANT             Tel:    +33-5-61-50-97-00 (Work)
Quartier d'Harraud Turrou           +33-5-61-50-97-01 (Fax)
31190 AUTERIVE                      +33-6-07-63-80-64 (GSM)
FRANCE                      Email: ohp@pyrenet.fr
------------------------------------------------------------------------------
Make your life a dream, make your dream a reality. (St Exupery)



Re: Bug in Makefile.shlib

From
Tom Lane
Date:
Olivier PRENANT <ohp@pyrenet.fr> writes:
> The problem is that at link time, ld complains about text segment beeing
> written to in Dynaloader.
> I agree this sounded stupid. But I can't think of something else.
> This is with perl-5.6.1 FWIW

Ah.  This is a bug in Perl's build process: even if you request a shared
library, it builds DynaLoader as static code.  My own notes about
installing perl 5.6.1 on HPUX read:
makefix DynaLoader.o per belowmake testmake install

At least in 5.6.1, even with "build shared" request, DynaLoader.o is not
made with +z, which will cause plperl to fail.  To fix, simply go into
perl-5.6.1/ext/DynaLoader, rm DynaLoader.o, and "make".  I wonder why
toplevel makefile thinks it's okay to build DynaLoader static??


I'm just now in the middle of installing Perl 5.8.0, and it seems that
the oversight has been fixed; DynaLoader is now built sharable:

cc -c   -Ae -D_HPUX_SOURCE -Wl,+vnocompatwarnings -DDEBUGGING -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64-g   -DVERSION=\"1.04\" -DXS_VERSION=\"1.04\" +Z "-I../.."  -DPERL_CORE -DLIBC="/lib/libc.sl"
DynaLoader.c

There seem to be some other problems --- 7.2 plperl dumps core for me
even with the above fix.  Still looking into that (I'm sorta hoping that
5.8.0 will fix it, but won't know for a little while...)
        regards, tom lane


Re: Bug in Makefile.shlib

From
Olivier PRENANT
Date:
Hi Tom,

Thanks fr your reply.. Not sure I understood!
I've tried your hack with no luck. Further more, README in
perl/ext/Dynaloader says it has to be static to be effective.

What concerns me more is that with same perl (5.6.1) it compiles ok with
722.

Regards
On Wed, 4 Sep 2002, Tom Lane wrote:

> Date: Wed, 04 Sep 2002 17:14:13 -0400
> From: Tom Lane <tgl@sss.pgh.pa.us>
> To: ohp@pyrenet.fr
> Cc: Larry Rosenman <ler@lerctr.org>,
>      pgsql-hackers list <pgsql-hackers@postgresql.org>
> Subject: Re: [HACKERS] Bug in Makefile.shlib 
> 
> Olivier PRENANT <ohp@pyrenet.fr> writes:
> > The problem is that at link time, ld complains about text segment beeing
> > written to in Dynaloader.
> > I agree this sounded stupid. But I can't think of something else.
> > This is with perl-5.6.1 FWIW
> 
> Ah.  This is a bug in Perl's build process: even if you request a shared
> library, it builds DynaLoader as static code.  My own notes about
> installing perl 5.6.1 on HPUX read:
> 
>     make
>     fix DynaLoader.o per below
>     make test
>     make install
> 
> At least in 5.6.1, even with "build shared" request, DynaLoader.o is not
> made with +z, which will cause plperl to fail.  To fix, simply go into
> perl-5.6.1/ext/DynaLoader, rm DynaLoader.o, and "make".  I wonder why
> toplevel makefile thinks it's okay to build DynaLoader static??
> 
> 
> I'm just now in the middle of installing Perl 5.8.0, and it seems that
> the oversight has been fixed; DynaLoader is now built sharable:
> 
> cc -c   -Ae -D_HPUX_SOURCE -Wl,+vnocompatwarnings -DDEBUGGING -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64-g   -DVERSION=\"1.04\" -DXS_VERSION=\"1.04\" +Z "-I../.."  -DPERL_CORE -DLIBC="/lib/libc.sl"
DynaLoader.c
> 
> There seem to be some other problems --- 7.2 plperl dumps core for me
> even with the above fix.  Still looking into that (I'm sorta hoping that
> 5.8.0 will fix it, but won't know for a little while...)
> 
>             regards, tom lane
> 

-- 
Olivier PRENANT             Tel:    +33-5-61-50-97-00 (Work)
Quartier d'Harraud Turrou           +33-5-61-50-97-01 (Fax)
31190 AUTERIVE                      +33-6-07-63-80-64 (GSM)
FRANCE                      Email: ohp@pyrenet.fr
------------------------------------------------------------------------------
Make your life a dream, make your dream a reality. (St Exupery)



Re: Bug in Makefile.shlib

From
Tom Lane
Date:
Olivier PRENANT <ohp@pyrenet.fr> writes:
> Thanks fr your reply.. Not sure I understood!
> I've tried your hack with no luck. Further more, README in
> perl/ext/Dynaloader says it has to be static to be effective.

That's talking about whether it's linked into perl, not whether it's
compiled PIC or not.
        regards, tom lane