Compiling Perl + mod_perl on 64-bit linux

Compiling Perl + mod_perl on 64-bit linux

am 26.08.2008 02:11:13 von Dan Axtell

Hi,

I've recently upgraded my main linux machine, but unfortunately the
distribution (OpenSuse 11.0, AMD x86_64) has everything with Perl 5.10. I
have some software that runs under mod_perl that requires Perl 5.8.8. No
problem, I just build 5.8.8, right?

Well, after two days I was able to get Perl and all my modules to build, but
mod_perl won't link with this error:

/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse -linux/bin/ld:
/usr/local/lib/perl5/5.8.8/x86_64-linux/CORE/libperl.a(perl. o): relocation
R_X86_64_32 against `a local symbol' can not be used when making a shared
object; recompilewith -fPIC
/usr/local/lib/perl5/5.8.8/x86_64-linux/CORE/libperl.a: could not read
symbols: Bad value

I'm trying to recompile Perl with -fPIC, but I can't get it to build at all
now. So trying to understand some basics here: what are the Perl
requirements? Should Perl be built with static or dynamic libraries?

Thanks,
Dan

Re: Compiling Perl + mod_perl on 64-bit linux

am 26.08.2008 02:21:08 von Fred Moyer

Dan Axtell wrote:
> Hi,
>
> I've recently upgraded my main linux machine, but unfortunately the
> distribution (OpenSuse 11.0, AMD x86_64) has everything with Perl 5.10. I
> have some software that runs under mod_perl that requires Perl 5.8.8. No
> problem, I just build 5.8.8, right?
>
> Well, after two days I was able to get Perl and all my modules to build, but
> mod_perl won't link with this error:
>
> /usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse -linux/bin/ld:
> /usr/local/lib/perl5/5.8.8/x86_64-linux/CORE/libperl.a(perl. o): relocation
> R_X86_64_32 against `a local symbol' can not be used when making a shared
> object; recompilewith -fPIC
> /usr/local/lib/perl5/5.8.8/x86_64-linux/CORE/libperl.a: could not read
> symbols: Bad value
>
> I'm trying to recompile Perl with -fPIC, but I can't get it to build at all
> now. So trying to understand some basics here: what are the Perl
> requirements? Should Perl be built with static or dynamic libraries?

You will need to compile perl with -fPIC on x86_64, I think I did it with:

ccflags='-fPIC' sh Configure -Dprefix /path to perl

I can't remember _exactly_ if that was it though. The other options
would be to manually the edit the Makefiles but I don't remember having
to do that.


>
> Thanks,
> Dan

Re: Compiling Perl + mod_perl on 64-bit linux

am 26.08.2008 06:13:37 von Dan Axtell

>
> You will need to compile perl with -fPIC on x86_64, I think I did it with:
>
> ccflags='-fPIC' sh Configure -Dprefix /path to perl
>
> I can't remember _exactly_ if that was it though. The other options
> would be to manually the edit the Makefiles but I don't remember having
> to do that.
>

OK, I've gone through the Configure process several times. With the latest,
I'm able to make, test and install Perl but it won't run anything, much less
build mod_perl, as it gives this error:

Attempt to free unreferenced scalar: SV 0xb4e570 at Makefile.PL line 34.
BEGIN failed--compilation aborted at Makefile.PL line 34.

I've built Perl with no threads, dynamic loading, DynaLoader is using
dl_dlopen, -fPIC, and shared libperl.so. I've tried building it without
dynamic loading, but it won't build.

I've tried building Perl with no dynamic loading, same results.

Any ideas?

Re: Compiling Perl + mod_perl on 64-bit linux

am 26.08.2008 06:53:04 von Fred Moyer

Dan Axtell wrote:
>> You will need to compile perl with -fPIC on x86_64, I think I did it with:
>>
>> ccflags='-fPIC' sh Configure -Dprefix /path to perl
>>
>> I can't remember _exactly_ if that was it though. The other options
>> would be to manually the edit the Makefiles but I don't remember having
>> to do that.
>>
>
> OK, I've gone through the Configure process several times. With the latest,
> I'm able to make, test and install Perl but it won't run anything, much less
> build mod_perl, as it gives this error:
>
> Attempt to free unreferenced scalar: SV 0xb4e570 at Makefile.PL line 34.
> BEGIN failed--compilation aborted at Makefile.PL line 34.
>
> I've built Perl with no threads, dynamic loading, DynaLoader is using
> dl_dlopen, -fPIC, and shared libperl.so. I've tried building it without
> dynamic loading, but it won't build.
>
> I've tried building Perl with no dynamic loading, same results.
>
> Any ideas?

Can you post some of the commands you are using? Are you removing the
installed libraries after a failed try (I always nuke the install
directory if it didn't work just so .so's don't hand around and cause
trouble).

Here are my journal notes from a previous install -
http://use.perl.org/~Phred/journal/31581

The line "You have to specify /usr/lib64 as an additional library path
(important!)" seems to indicate an important step, but it has been a while.

On my -fpic install, I did not build libperl.so.

Re: Compiling Perl + mod_perl on 64-bit linux

am 26.08.2008 13:23:03 von Niels Larsen

I had something that sounds the same. Setting CCFLAGS didnt
work, but

sh ./Configure -de -Accflags='-fPIC' (etc)

did give a libperl that worked on AMD x86_64. With 5.10 though.

Niels L

Dan Axtell wrote:
>> You will need to compile perl with -fPIC on x86_64, I think I did it with:
>>
>> ccflags='-fPIC' sh Configure -Dprefix /path to perl
>>
>> I can't remember _exactly_ if that was it though. The other options
>> would be to manually the edit the Makefiles but I don't remember having
>> to do that.
>>

Re: Compiling Perl + mod_perl on 64-bit linux

am 26.08.2008 17:05:06 von Dan Axtell

On Tuesday 26 August 2008 7:14:35 am you wrote:
> I had something that sounds the same. Setting CCFLAGS didnt
> work, but
>
> sh ./Configure -de -Accflags='-fPIC' (etc)
>
> did give a libperl that worked on AMD x86_64. With 5.10 though.
>

OK, I tried this:


sh ./Configure -de -Accflags='-fPIC' -Dprefix=/usr/local \
-Dloclibpth="/usr/lib64"

one peculiarity of my make, gnu make 3.81, is I have to edit the makefile to
comment out all the lines like:
av$(OBJ_EXT):
or it won't work.

So make works, make test works, but gives various warnings like:
makefile:612: target `lib/auto/Encode/Byte/Byte.a' given more than once in the
same rule.
makefile:612: target `lib/auto/Encode/CN/CN.a' given more than once in the
same rule.

After installing, if I try and run a CGI script with /usr/local/bin/perl, from
the command line, I get:
Attempt to free unreferenced scalar: SV 0xda2bf0 at
/usr/local/lib/perl5/site_perl/5.8.8/HTML/Template.pm line 916.
Weak references are not implemented in the version of perl at
/usr/local/lib/perl5/site_perl/5.8.8/CGI/FormBuilder.pm line 15

This script ran yesterday with the Perl 5.8.8 I had build all the modules
with. Trying to run perl -MCPAN also seg faults.

What gives? -fPIC seems to make the interpreter useless, but I can't build
mod_perl without it.

Dan

Re: Compiling Perl + mod_perl on 64-bit linux

am 26.08.2008 20:28:46 von Niels Larsen

I dont have a good answer. But editing the Makefile may hide the real
error .. which error appears when not editing the Makefile, and Google
with that error, no hints? what happens if -Dloclibpth="/usr/lib64"
is omitted? and of curiosity, what was the reason for going back to
perl 5.8 from 5.10? (i feel 5.10 is less stable than 5.8, but doesnt
get in my way).

Niels

>
> OK, I tried this:
>
>
> sh ./Configure -de -Accflags='-fPIC' -Dprefix=/usr/local \
> -Dloclibpth="/usr/lib64"
>
> one peculiarity of my make, gnu make 3.81, is I have to edit the makefile to
> comment out all the lines like:
> av$(OBJ_EXT):
> or it won't work.
>
> So make works, make test works, but gives various warnings like:
> makefile:612: target `lib/auto/Encode/Byte/Byte.a' given more than once in the
> same rule.
> makefile:612: target `lib/auto/Encode/CN/CN.a' given more than once in the
> same rule.
>
> After installing, if I try and run a CGI script with /usr/local/bin/perl, from
> the command line, I get:
> Attempt to free unreferenced scalar: SV 0xda2bf0 at
> /usr/local/lib/perl5/site_perl/5.8.8/HTML/Template.pm line 916.
> Weak references are not implemented in the version of perl at
> /usr/local/lib/perl5/site_perl/5.8.8/CGI/FormBuilder.pm line 15
>
> This script ran yesterday with the Perl 5.8.8 I had build all the modules
> with. Trying to run perl -MCPAN also seg faults.
>
> What gives? -fPIC seems to make the interpreter useless, but I can't build
> mod_perl without it.
>
> Dan
>

Re: Compiling Perl + mod_perl on 64-bit linux

am 26.08.2008 21:01:59 von Dan Axtell

On Tuesday 26 August 2008 2:28:46 pm Niels Larsen wrote:
> I dont have a good answer. But editing the Makefile may hide the real
> error .. which error appears when not editing the Makefile, and Google
> with that error, no hints? what happens if -Dloclibpth="/usr/lib64"
> is omitted? and of curiosity, what was the reason for going back to
> perl 5.8 from 5.10? (i feel 5.10 is less stable than 5.8, but doesnt
> get in my way).
>

I think if I leave out /usr/lib64, perl won't compile. I've tried so many
variations they kind of blend together

The make command gives this error:
make: *** No rule to make target `', needed by `miniperlmain.o'.
Stop

doing make -f Makefile let's perl compile, except for x2p, which gives a
similar error. I've worked around this by taking out lines from the makefile
like:
av$(OBJ_EXT):

The main reason for wanting 5.8.x is I have some legacy apps that use
CGI::Builder, which won't compile under 5.10. At this point I'm going to
focus on getting it to build on 5.10, since that actually has a working
mod_perl binary for my AMD64 box.

Thanks for the help so far.

Re: Compiling Perl + mod_perl on 64-bit linux

am 26.08.2008 21:53:18 von Niels Larsen

Thats what I would do too. The CGI::Builder author seems to be
available to help (http://perl.4pro.net), perhaps for pay, but
maybe he wont charge for compile- and bug-fixing.

Niels

Dan Axtell wrote:
> On Tuesday 26 August 2008 2:28:46 pm Niels Larsen wrote:
>> I dont have a good answer. But editing the Makefile may hide the real
>> error .. which error appears when not editing the Makefile, and Google
>> with that error, no hints? what happens if -Dloclibpth="/usr/lib64"
>> is omitted? and of curiosity, what was the reason for going back to
>> perl 5.8 from 5.10? (i feel 5.10 is less stable than 5.8, but doesnt
>> get in my way).
>>
>
> I think if I leave out /usr/lib64, perl won't compile. I've tried so many
> variations they kind of blend together
>
> The make command gives this error:
> make: *** No rule to make target `', needed by `miniperlmain.o'.
> Stop
>
> doing make -f Makefile let's perl compile, except for x2p, which gives a
> similar error. I've worked around this by taking out lines from the makefile
> like:
> av$(OBJ_EXT):
>
> The main reason for wanting 5.8.x is I have some legacy apps that use
> CGI::Builder, which won't compile under 5.10. At this point I'm going to
> focus on getting it to build on 5.10, since that actually has a working
> mod_perl binary for my AMD64 box.
>
> Thanks for the help so far.
>