httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sorin Manolache" <sor...@gmail.com>
Subject Re: Static compilation of a module
Date Thu, 31 Jul 2008 14:45:50 GMT
On Thu, Jul 31, 2008 at 16:26, lusob <luis.sobrecueva@gmail.com> wrote:

> I'm developing a apache module. This module use the libapreq library, for a
> most simple instalation I would rather install only my module to the
> customer, I would prefer that the customer doesn't have to install the
> libapreq.
> Are there any way to do it? If I perform a static compilation del module
> (mymod.a) how can I load this static module in apache?
> Thanks in advance

I have done a similar thing. Do not compile your module statically,
i.e. do not create mymod.a.

Create a dynamic shared object module, but link libapreq.a _statically_ to it.

g++ -shared -nostdlib /usr/lib/crti.o
/usr/lib/gcc/i486-linux-gnu/4.2.4/crtbeginS.o mymod.o
-Wl,--whole-archive libapreq.a -L/usr/lib/gcc/i486-linux-gnu/4.2.4
-L/usr/lib -lstdc++ -lm -lc -lgcc_s
/usr/lib/gcc/i486-linux-gnu/4.2.4/crtendS.o /usr/lib/crtn.o
-Wl,--as-needed -Wl,-soname -Wl,mod_my.so.1 -o mod_my.so.1.0.0

Thus, all the code of libapreq that is needed by mod_my.so will be
present in the mod_my.so binary. So the client does not have to have
libapreq.a on his/her machine. However, your mod_my.so will still be a
dynamic shared object that will be loaded by apache upon startup.

S

Mime
View raw message