Anyone managed to compile mod_perl as DSO (or have any hints?)

From: Marcin Kasperski (Marcin.Kasperski@softax.com.pl)
Date: Mon Dec 02 2002 - 10:27:16 EST


I've spent two days trying to get working mod_perl compiled as DSO on
Tru64 and still can't succeed. Below I describe what I tried, in case
anyone could suggest something I would be really grateful. I describe
also why such configuration is important for me, in case someone can
suggest alternative solution, I would appreciate it too.

Sideways, I describe minor makefile error which is probably
independent from the whole problem.

*] Background

I have developed some (fairly large) mod_perl application. The
application works perfectly on Tru64 with mod_perl statically linked
with apache (and all other modules as DSO's). It also works perfectly
with fully DSO (with mod_perl.so too) configuration on Debian Gnu
Linux.

I would like to get it working with DSO mod_perl on Tru64 for single
reason: in DSO configuration I can use 'apachectl graceful' to load
the new application version in the matter completely invisible for the
clients (no broken requests, no short period of inavailability). In my
case it would be very demanded feature. At the same time, with
statically linked mod_perl I must use 'apachectl stop; wait a moment;
apachectl start' to load the new version.

It can matter (or not) that my application uses some custom module
implemented in C++ (compiled with Compaq C++ for Tru64) and
referencing 3rd party libraries (interface to some middleware, I'll
not delve into details now but in case you thing they are important
let me know). It could be worth noting that no library mentioned here
links with thread library (so this is not the source of the problem).

*] My attempts

In short: I tried different compilation methods with two possible
outcomes:
a) apache and modperl compile succesfully but I get coredump while the
   application is starting (in all cases SEGVs, in some cases core's
   confused the debugger, in other I managed to notice __at_fork in
   backtrace)
b) everything seem to compile succesfully but I get
   dlopen: /tools/apache/libexec/mod_perl.so: symbol "PL_perl_destruct_level" unresolved
   while the application is starting

As far as I could checked there were no mistakes like 'using one perl
to compile and the other one to run', I always built everything from
scratch and then tested.

Below I describe different variants of compilation of perl and apache,
I tried most of the 'perl this way, apache that way' combinations.

1) Perl compilation (I use 5.6.1)

I used commands like the one below

   sh Configure -des -Dprefix=/tools/perl -Uinstallusrbinperl \
      -Uuseshrplib -Uusemymalloc -Ubincompat5005
   make
   make test
   make install

and also tried all possible combinations of useshrplib and usemymalloc

In all cases perl itself compiled, linked and tested correctly, also
my custom modules compiled and worked)

2) apache (I use 1.3.27) & modperl (I use 1.27)

I tried different combinations described below.

It is worth noting, that whatever method I choosen there was minor
error if I used -Duseshrplib while building perl: while linking
modperl (libperl.so) I got the following error:

ld -shared -expect_unresolved "*" -O4 -msym -std -s -L/usr/local/lib -o libperl.so mod_perl.lo perlxsi.lo perl_config.lo perl_util.lo perlio.lo mod_perl_opmask.lo Apache.lo Constants.lo ModuleConfig.lo Log.lo URI.lo Util.lo Connection.lo Server.lo File.lo Table.lo -Wl,-rpath,/tools/perl/lib/5.6.1/alpha-dec_osf/CORE -L/usr/local/lib /tools/perl/lib/5.6.1/alpha-dec_osf/auto/DynaLoader/DynaLoader.a -L/tools/perl/lib/5.6.1/alpha-dec_osf/CORE -lperl -lm -liconv -lutil
ld:
Invalid flag usage: Wl,-rpath,/tools/perl/lib/5.6.1/alpha-dec_osf/CORE, -Wx,-o
ption must appear after -_SYSTYPE_SVR4
ld: Usage: ld [options] file [...]

Simple change in the Makefile - replacing ld with cc - caused this
command to succeed. So in all the cases when I got this error I
patched the problem this way and proceeded.

So here is what I tried

a) Simultaneous compilation

cd mod_perl-1.27
perl Makefile.PL $PERL_MOD_DBG $PLTRACE \
      APACHE_SRC=../apache_1.3.27/src \
      APACHE_PREFIX=/tools/apache \
      USE_APACI=1 \
      USE_DSO=1 \
      DO_HTTPD=1 \
      ALL_HOOKS=1 \
      EVERYTHING=1 \
      APACI_ARGS="--enable-module=so,\
        --prefix=/tools/apache,\
        --enable-rule=SHARED_CHAIN,\
        --enable-module=access,--enable-shared=access,\
        --enable-module=actions,--enable-shared=actions,\
        --enable-module=alias,--enable-shared=alias,\
        --enable-module=asis,--enable-shared=asis,\
        --enable-module=auth,--enable-shared=auth,\
        --enable-module=auth_anon,--enable-shared=auth_anon,\
        --enable-module=auth_db,--enable-shared=auth_db,\
        --enable-module=auth_dbm,--enable-shared=auth_dbm,\
        --enable-module=autoindex,--enable-shared=autoindex,\
        --enable-module=cern_meta,--enable-shared=cern_meta,\
        --enable-module=cgi,--enable-shared=cgi,\
        --enable-module=digest,--enable-shared=digest,\
        --enable-module=dir,--enable-shared=dir,\
        --enable-module=env,--enable-shared=env,\
        --enable-module=example,--enable-shared=example,\
        --enable-module=expires,--enable-shared=expires,\
        --enable-module=headers,--enable-shared=headers,\
        --enable-module=imap,--enable-shared=imap,\
        --enable-module=include,--enable-shared=include,\
        --enable-module=info,--enable-shared=info,\
        --enable-module=log_agent,--enable-shared=log_agent,\
        --enable-module=log_config,--enable-shared=log_config,\
        --enable-module=log_referer,--enable-shared=log_referer,\
        --enable-module=mime,--enable-shared=mime,\
        --enable-module=mime_magic,--enable-shared=mime_magic,\
        --enable-module=mmap_static,--enable-shared=mmap_static,\
        --enable-module=negotiation,--enable-shared=negotiation,\
        --enable-module=proxy,--enable-shared=proxy,\
        --enable-module=rewrite,--enable-shared=rewrite,\
        --enable-module=setenvif,--enable-shared=setenvif,\
        --enable-module=speling,--enable-shared=speling,\
        --enable-module=status,--enable-shared=status,\
        --enable-module=unique_id,--enable-shared=unique_id,\
        --enable-module=userdir,--enable-shared=userdir,\
        --enable-module=usertrack,--enable-shared=usertrack,\
        --enable-module=vhost_alias,--enable-shared=vhost_alias,\
 "
make
make install

I also tried without SHARED_CHAIN and with additional
--enable-rule=SHARED_CORE.

b) I also tried apxs variant:

cd apache-1.3.27
./configure --enable-module=so \
       --prefix=/tools/apache \
       --enable-rule=SHARED_CHAIN \
       --enable-module=access --enable-shared=access \
       --enable-module=actions --enable-shared=actions \
       --enable-module=alias --enable-shared=alias \
       --enable-module=asis --enable-shared=asis \
       --enable-module=auth --enable-shared=auth \
       --enable-module=auth_anon --enable-shared=auth_anon \
       --enable-module=auth_db --enable-shared=auth_db \
       --enable-module=auth_dbm --enable-shared=auth_dbm \
       --enable-module=autoindex --enable-shared=autoindex \
       --enable-module=cern_meta --enable-shared=cern_meta \
       --enable-module=cgi --enable-shared=cgi \
       --enable-module=digest --enable-shared=digest \
       --enable-module=dir --enable-shared=dir \
       --enable-module=env --enable-shared=env \
       --enable-module=example --enable-shared=example \
       --enable-module=expires --enable-shared=expires \
       --enable-module=headers --enable-shared=headers \
       --enable-module=imap --enable-shared=imap \
       --enable-module=include --enable-shared=include \
       --enable-module=info --enable-shared=info \
       --enable-module=log_agent --enable-shared=log_agent \
       --enable-module=log_config --enable-shared=log_config \
       --enable-module=log_referer --enable-shared=log_referer \
       --enable-module=mime --enable-shared=mime \
       --enable-module=mime_magic --enable-shared=mime_magic \
       --enable-module=mmap_static --enable-shared=mmap_static \
       --enable-module=negotiation --enable-shared=negotiation \
       --enable-module=proxy --enable-shared=proxy \
       --enable-module=rewrite --enable-shared=rewrite \
       --enable-module=setenvif --enable-shared=setenvif \
       --enable-module=speling --enable-shared=speling \
       --enable-module=status --enable-shared=status \
       --enable-module=unique_id --enable-shared=unique_id \
       --enable-module=userdir --enable-shared=userdir \
       --enable-module=usertrack --enable-shared=usertrack \
       --enable-module=vhost_alias --enable-shared=vhost_alias
make
make test
make install

cd mod_perl-1.27
perl Makefile.PL USE_APXS=1 WITH_APXS=/tools/apache/bin/apxs \
   EVERYTHING=1
make
make install
 

Is there anything I could try? Have anyone succeeded in getting such configuration working?



This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 10:49:00 EDT