On Jul 31, 2008, at 11:16 AM, lusob wrote:
Ok, I'm going to try it, thanks!!

At work we have moved away from using static libraries to shared libraries because of duplicate symbols issues.

If your client loads your module as well as some module that uses apreq (say mod_perl or something else) there will be duplicate symbols loaded. Say a bug is found in libapreq and they upgrade their version of the shared library, they may or may not pick up the fix depending on how modules are loaded. If you module is loaded first, it will use your apreq symbols instead of a shared version loaded later. If your module is loaded second, they you will be using the shared library version and not yours (and your module will use the shared version as well).

Granted most of time we were running into duplicate symbols with binary incompatibles and I would hope apreq wouldn't have this problem, but it still something to keep in mind.

Brian






Sorin Manolache wrote:

On Thu, Jul 31, 2008 at 16:26, lusob <[EMAIL PROTECTED]> 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



--
View this message in context: 
http://www.nabble.com/Static-compilation-of-a-module-tp18755821p18756871.html
Sent from the Apache HTTP Server - Module Writers mailing list archive at Nabble.com.


Reply via email to