Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: ModPerl

Perlbrew + mod_perl2 + libapreq2

 

 

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded


moseley at hank

Jul 29, 2012, 7:55 AM

Post #1 of 3 (558 views)
Permalink
Perlbrew + mod_perl2 + libapreq2

My goal is from a Perlbrew (per-user Perl) environment install mod_perl2
and libapreq2 from CPAN either directly using tools like "cpan" and
"cpanm", or automatically as dependencies listed in other CPAN
distributions. The reason for this goal is to allow multiple developers
on a single machine to work in their own development environment and
possibly different versions of Perl. Perlbrew solves this.

It's not a strict requirement, but I'd prefer to use the system-installed
Apache. What that means is that mod_perl.so and mod_apreq2.so would be
installed per-user and not installed in the system Apache modules
directory. Then LoadModule would have to point to these two locally
installed modules.

Anyone have experience doing this?



Here's the details on where I've gotten so far:

1) mod_perl:

Building, testing, and installing mod_perl2 is reasonably easy. The only
trick is setting MP_AP_DESTDIR so that "make install" installs mod_perl.so
(and headers) local to the user. For example:

$ cd mod_perl-2.0.7
$ perl Makefile.PL MP_AP_DESTDIR=~/mp2 && make test && make install
(But, see notes [1],[2] )


Of course, it would be easier if MB_AP_DESTIR could be passed as an
environment variable because that could be set before running "cpan" or
"cpanm" and have mod_perl use that.


2) libapreq2:

The harder problem is libapreq2. I have not found how to set a DESTDIR
type of parameter for libapreq2's Makefile.PL as above. I can build with
./configure --prefix, but that's doesn't get me toward my goal of using
cpan to install.

Then the next problem is the libapreq2 unit tests fail because libapreq2
expects mod_perl.so to be installed in the Apache modules directory. I
can get the tests to pass [2] if I modify glue/perl/t/conf/httpd.conf to
use $HOME/mp2/usr/lib64/httpd/modules/mod_perl.so, for example.

But even with the --prefix set then running "make install" fails because
the libapreq2 installation code attempts to relink libapreq2 using libtool
and I end up with:

libtool: install: warning: relinking `mod_apreq2.la'
(cd /home/bill/libapreq2-2.13/module/apache2; /bin/sh ../../libtool
--tag=CC --mode=relink gcc -g -O2 -export-dynamic -module -avoid-version
/home/bill/libapreq2-2.13/library/libapreq2.la -lpthread -ldl -lexpat
-ldb-4.8 /usr/lib64/libapr-1.la /usr/lib64/libaprutil-1.la -o
mod_apreq2.la-rpath /usr/lib64/httpd/modules handle.lo filter.lo )
gcc -shared .libs/handle.o .libs/filter.o -Wl,--rpath -Wl,/usr/lib64
-L/usr/lib -lapreq2 -lpthread -ldl -lexpat -ldb-4.8 -L/usr/lib64 -lapr-1
-laprutil-1 -Wl,-soname -Wl,mod_apreq2.so -o .libs/mod_apreq2.so
*/usr/bin/ld: cannot find -lapreq2*

I had no luck setting LD_LIBRARY_PATH, although adding -L$HOME/apr2/lib
(which is $prefix/lib) to the above command will work.


So, this is about as far as I got. It's close, but libapreq2 requires
quite a few hacks to make happen. Anyone been through this process before?



[1] Except for t/api/server_const.t which apparently is a known failing
test on Fedora.

[2] When running make test for either mod_perl or libapreq2 I see warnings
because the tests are loading /etc/httpd/conf/httpd.conf which loads
/etc/httpd/conf.d/ that has includes our configs that point to non-existent
directories. Why is the system-installed /etc/httpd/conf/httpd.conf used
when running tests?

--
Bill Moseley
moseley [at] hank


aw at ice-sa

Jul 29, 2012, 8:23 AM

Post #2 of 3 (535 views)
Permalink
Re: Perlbrew + mod_perl2 + libapreq2 [In reply to]

Bill Moseley wrote:
> My goal is from a Perlbrew (per-user Perl) environment install mod_perl2
> and libapreq2 from CPAN either directly using tools like "cpan" and
> "cpanm", or automatically as dependencies listed in other CPAN
> distributions. The reason for this goal is to allow multiple developers
> on a single machine to work in their own development environment and
> possibly different versions of Perl. Perlbrew solves this.
>
> It's not a strict requirement, but I'd prefer to use the system-installed
> Apache. What that means is that mod_perl.so and mod_apreq2.so would be
> installed per-user and not installed in the system Apache modules
> directory. Then LoadModule would have to point to these two locally
> installed modules.
>
> Anyone have experience doing this?
>

Considering the amount of work you seem to have already done for this, I hate to say this,
but I think that you are on the wrong track here.
I don't see how you could achieve what you seem to want without having one distinct Apache
instance (and probably even installation) for each user.

The whole point of mod_perl is to have a perl interpreter loaded and embedded at startup
into the loaded and running Apache server code, so I cannot imagine how you could switch
this at run-time to a user-specific set.
(a side-question being how you decide which user to switch to).

You could run several instances of Apache under different user-id's, on different ports,
with a different configuration, pointing to different directories to load their modules
from however.


moseley at hank

Jul 29, 2012, 8:57 AM

Post #3 of 3 (535 views)
Permalink
Re: Perlbrew + mod_perl2 + libapreq2 [In reply to]

On Sun, Jul 29, 2012 at 8:23 AM, André Warnier <aw [at] ice-sa> wrote:

>
> Considering the amount of work you seem to have already done for this, I
> hate to say this, but I think that you are on the wrong track here.
>

I don't doubt that.


> I don't see how you could achieve what you seem to want without having one
> distinct Apache instance (and probably even installation) for each user.
>
> The whole point of mod_perl is to have a perl interpreter loaded and
> embedded at startup into the loaded and running Apache server code, so I
> cannot imagine how you could switch this at run-time to a user-specific set.
> (a side-question being how you decide which user to switch to).
>

Imagine you mod_perl developer. You can compile mod_perl (generate
mod_perl.so that Apache can load). You can copy that file anyplace and
have LoadModule point to it. Then you recompile mod_perl to test some
optimizations and put that mod_perl.so someplace else. You have have
another httpd.conf point to this and then run two httpd binaries using
different versions of mod_perl. That's clear, right?

You can do the same thing with which Perl you link with.

When mod_perl.so is compiled it's linked with Perl. Typically, that's
with the system-installed Perl, but there's nothing requiring that. In
other words, mod_perl.so can be built with any installed Perl -- even
different versions of Perl or per-user Perl installations.

So, the thing to imagine again is each user with their own httpd.conf that
points to their locally-built mod_perl.so and mod_apreq2.so files.

Yes, that means each user would need to run their own httpd binary, but
doesn't mean each user would need to install their own version of Apache
(because LoadModule can be used to point to different mod_perl.so
libraries).



--
Bill Moseley
moseley [at] hank

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.