You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by ka...@gnu.org on 2000/10/28 18:17:59 UTC
mod_perl + mod_ssl __eprintf failure and fix
Dear mod_perl and mod_ssl folks,
(I'd like to send this to apache folks too but www.apache.org seems to
be down and I can't find an email address for bug reports.)
I recently had occasion to try to build an apache with mod_perl
statically linked, and mod_ssl (and all other modules) dynamically
linked.
I needed to do this because mod_perl warned me that linking dynamically
would cause problems with my perl, because I had used the perl malloc
library (how depressing). Unfortunately it was impractical for me to
recompile the perl being used on all the machines where the apache
binary needs to be used.
There are conflicting instructions in mod_perl and mod_ssl for how to do
both of them together, and neither anticipates linking the one
statically and the other dynamically. I include the commands I ran
below, for whatever benefit they may be to others.
Unfortunately, a change to someone's source is required to make it
work. Attempting to start up the resulting apache (for example, via the
make test command in mod_perl) resulted in:
Cannot load /src/mod_perl-1.24_01/t/../../apache_1.3.14/src/modules/ssl/libssl.so into server: ld.so.1: ../apache_1.3.14/src/httpd: fatal: relocation error: file /src/mod_perl-1.24_01/t/../../apache_1.3.14/src/modules/ssl/libssl.so: symbol __eprintf: referenced symbol not found
Well. __eprintf, as you probably know, is part of libgcc.a, but it does
not exist in any dynamic library. Therefore it won't be found by the
dynamic loader.
The only solution I could see to this was to force __eprintf to be
included in the static link. I did this by adding the following two
lines to the apache/src/buildmark.c, but some mod_perl C file would be a
(much) better place:
extern void __eprintf ();
static void (*horrible) () = __eprintf;
It also obviously needs some #ifdef's to avoid losing if it's compiled
under some other compile which does not define __eprintf.
If you could deal with this in some future release(s), that would be
great. If we could just eliminate __eprintf forever, that would be the
best of all :). Anyway, I hope this will at least help someone avoid
the same struggle I went through. I found nothing especially relevant
on the web or dejanews. If there's a better way, I'd appreciate knowing
about it.
Thanks,
karl@gnu.org
Environment info:
apache 1.3.14
mod_ssl 2.7.1-1.3.14
mod_perl 1.24_01
perl 5.005_03
openssl 0.9.6
Build commands:
# openssl is first.
http://www.openssl.org/source/openssl-0.9.6.tar.gz
./config --prefix=/usr/local/openssl-096 --openssldir=/usr/local/openssl-096
make
make test
make install
make clean
# get clean distribution of apache; don't configure or build it, just unpack.
http://httpd.apache.org/dist/apache_1.3.14.tar.gz
tar xzf apache*.tar.gz
# get distribution of mod_ssl
http://www.modssl.org/source/mod_ssl-2.7.1-1.3.14.tar.gz
tar xzf mod_ssl*.tar.gz
# configure in mod_ssl
cd mod_ssl-*
configure --with-apache=../apache_1.3.14
cd ..
# get distribution of mod_perl
http://perl.apache.org/dist/mod_perl-1.24.tar.gz
tar xzf mod_perl*.tar.gz
# in apache/src/buildmark.c, add two lines after the #include's.
# otherwise, get __eprintf undefined when httpd starts up.
extern void __eprintf ();
static void (*horrible) () = __eprintf;
# configure in mod_perl
# we must link mod_perl statically to avoid runtime malloc bugs in
# perl malloc, or so mod_perl says.
cd mod_perl-*
perl Makefile.PL USE_APACI=1 EVERYTHING=1 SSL_BASE=/usr/local/openssl APACHE_PREFIX=/l/apache-1.3.14-`date +%Y%m%d` APACI_ARGS=--with-layout=Apache,--enable-module=all,--enable-shared=max,--disable-module=auth_db,--disable-shared=perl
# make and test, including httpd startup (still in mod_perl)
make test
----
Full output of perl -V:
Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
Platform:
osname=solaris, osvers=2.7, archname=sun4-solaris
uname='sunos rocks.f7.net 5.7 generic sun4u sparc '
hint=previous, useposix=true, d_sigaction=define
usethreads=undef useperlio=undef d_sfio=undef
Compiler:
cc='cc', optimize='-g', gccversion=2.8.1
cppflags='-DDEBUGGING'
ccflags ='-DDEBUGGING'
stdchar='char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
alignbytes=8, usemymalloc=y, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -ldb -ldl -lm -lc -lcrypt
libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: DEBUGGING
Built under solaris
Compiled at Jun 6 1999 18:55:00
@INC:
/usr/local/lib/perl5/5.00503/sun4-solaris
/usr/local/lib/perl5/5.00503
/usr/local/lib/perl5/site_perl/5.005/sun4-solaris
/usr/local/lib/perl5/site_perl/5.005
.