You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Christiaan Lamprecht <ch...@googlemail.com> on 2006/11/03 15:50:16 UTC

[users@httpd] Linking to a Shared Object

Hi all,

The idea:
So the idea is to install mod_assl (a module I wrote) in Apache as an
DSO object. This works fine but I now need mod_assl to use functions
in assl.c (also my code), and these assl.c functions should also be
available to external programs such as application.c (which has it's
own main method).

Setting the scene:
I have written a module (mod_assl.c) which uses functions in assl.c
(there's also an assl.h - both mine). I've also written an application
application.c which also calls functions in assl.c. They are all in
the same directory $HOME/ApacheSource/httpd-2.2.3/modules/ssl/ (in the
source tree)

The problem:
I compiled the assl.c code:
libtool --mode=compile gcc -fPIC -DSHARED_MODULE -D_LARGEFILE64_SOURCE
-I$HOME/ApacheSource/httpd-2.2.3/include/
-I$HOME/ApacheSource/httpd-2.2.3/srclib/apr/include/
-I$HOME/ApacheSource/httpd-2.2.3/srclib/apr-util/include/
-I$HOME/ApacheSource/httpd-2.2.3/server/mpm/prefork/
-I$HOME/ApacheSource/httpd-2.2.3/os/unix/ -c assl.c

which creates:
assl.o
assl.lo

I then compiled my mod_ssl.c module into Apache2:
./sbin/apxs -i -a -c
../ApacheSource/httpd-2.2.3/modules/ssl/mod_assl.c
../ApacheSource/httpd-2.2.3/modules/ssl/assl.lo

to create: (in $HOME/Apache2/libexec)
mod_assl.so

Then compiled the application.c: (probably don't need all the -I)
libtool --mode=compile gcc -fPIC -DSHARED_MODULE -D_LARGEFILE64_SOURCE
-I$HOME/ApacheSource/httpd-2.2.3/include/
-I$HOME/ApacheSource/httpd-2.2.3/srclib/apr/include/
-I$HOME/ApacheSource/httpd-2.2.3/srclib/apr-util/include/
-I$HOME/ApacheSource/httpd-2.2.3/server/mpm/prefork/
-I$HOME/ApacheSource/httpd-2.2.3/os/unix/ -c application.c

which creates:
application.o
application.lo

Now I need to create an executable (test):
libtool --mode=link gcc -g -O -o test application.lo
$HOME/Apache2/libexec/mod_assl.so $HOME/Apache2/lib/libapr-1.so
$HOME/Apache2/lib/libaprutil-1.so
$HOME/OpenSSLsource/openssl-0.9.8d/libssl.a
$HOME/OpenSSLsource/openssl-0.9.8d/libcrypto.a -rpath
$HOME/Apache2/libexec

But I get:
gcc -g -O -o test .libs/application.o
$HOME/Apache2/libexec/mod_assl.so $HOME/Apache2/lib/libapr-1.so
$HOME/Apache2/lib/libaprutil-1.so
$HOME/OpenSSLsource/openssl-0.9.8d/libssl.a
$HOME/OpenSSLsource/openssl-0.9.8d/libcrypto.a  -Wl,--rpath
-Wl,$HOME/Apache2/libexec
$HOME/Apache2/libexec/mod_assl.so: undefined reference to `ap_log_rerror'
$HOME/Apache2/libexec/mod_assl.so: undefined reference to `ssl_var_lookup'
$HOME/Apache2/libexec/mod_assl.so: undefined reference to `ssl_expr_exec'
$HOME/Apache2/libexec/mod_assl.so: undefined reference to `ssl_module'
$HOME/Apache2/libexec/mod_assl.so: undefined reference to
`ap_hook_pre_connection'
$HOME/Apache2/libexec/mod_assl.so: undefined reference to `ssl_expr_comp'
$HOME/Apache2/libexec/mod_assl.so: undefined reference to `ap_log_error'
$HOME/Apache2/libexec/mod_assl.so: undefined reference to
`ap_hook_access_checker'
$HOME/Apache2/libexec/mod_assl.so: undefined reference to `ap_hook_pre_config'
$HOME/Apache2/libexec/mod_assl.so: undefined reference to `ssl_log_ssl_error'
$HOME/Apache2/libexec/mod_assl.so: undefined reference to `ap_log_cerror'
$HOME/Apache2/libexec/mod_assl.so: undefined reference to `ssl_io_buffer_fill'
collect2: ld returned 1 exit status

Which library am I missing? Surely it should have complained when I
created mod_assl.so in the first place?

I've tried MANY things but nothing seems to work. Anyone see a problem?

Many many thanks in advance
Christiaan

PS:
Currently using:
Apache2
httpd-2.2.3

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org