moseley at hank
Jul 29, 2012, 7:55 AM
Post #1 of 3
My goal is from a Perlbrew (per-user Perl) environment install mod_perl2
Perlbrew + mod_perl2 + libapreq2
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
Anyone have experience doing this?
Here's the details on where I've gotten so far:
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 , )
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.
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  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?
 Except for t/api/server_const.t which apparently is a known failing
test on Fedora.
 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?
moseley [at] hank