Works on Ubuntu Linux with apache2. This page is a collection of random thoughts. Read it all, if you want to reproduce this.
The apache daemon loads shared libraries with RTLD_GLOBAL
. That means, that
the global universe variable is shared between modules. Therefore only one
global variable (not hashtable) universe exists and the modules share the
libMulleObjC-standalone.so
loaded by the first extension.
Care must be taken, that classes have differing names.
Build as explained in
Memo: Apache/Libtool/ObjC
then also build the second example in src2 likewise. Also install theobjc_example2.*
files in./apache2
into themods-enabled
folder of/etc/apache2
alongside theobjc_example.*
files.Then check http://localhost/objc-example and http://localhost/objc-example2
This is done in by specifying -DOTHER_CFLAGS=-fobjc-universename=myuniverse
.
- Set
MULLE_CRAFT_MULLE_OBJC_MAKE_FLAGS
to-DSTANDALONE=ON
, so that MulleObjC gets build as a shared library, but not the constituent static libraries. - Specified a craftinfo for MulleObjC so that
OTHER_CFLAGS
is set to-fobjc-universename="vfl1848"
- Otherwise do as explained way below, and don't forget to copy the .so file.
- remove the old stuff with
mulle-sde clean all
- Specified a craftinfo for MulleObjC so that OTHER_CFLAGS is set to
-fobjc-universename="vfl1849"
(a different universename) - Change the soname of the standalone library to
libMulleObjC2-standalone.so
- rename built standalone library to
libMulleObjC2-standalone.so
and copy it to/usr/lib
- Go into src2 and make and make install
See:
mulle-sde environment list
Libtool can not properly deal with the --whole-archive flag as researched by reading this and this mailthread.
This makes it not feasible to link ObjC code statically into a Libtooling environment such as an apache module. But linking a shared library to a C apache module is not a problem.
Build MulleObjC with STANDALONE.
Note: use tweak idea above
mulle-sde -v craft buildorder --release -- -DSTANDALONE=ON
sudo cp -a ../dependency/lib/libMulleObjC-standalone.so /usr/lib
Since we are going to install into /usr/lib
a LD_RUN_PATH
seems pointless.
Now build and install the module:
cd src
make
sudo make install
sudo apache2ctl restart
Again a LD_LIBRARY_PATH
would be pointless, because the apache daemon doesn't seem to pick it up. Or we would have to edit /etc/apache2/envvars
.
This is a partial mulle-sde project.
mulle-sde MulleAPXSExample
Now you can let mulle-sde fetch the required dependencies and build the project for you:
mulle-sde craft buildorder
Venture into the src
directory and run make
.
Read mulle_objc_example.c for more information.
apache2
contains configuration files that need to be added after
sudo make install
How to debug inside the apache.
$ sudo -s
# . /etc/apache2/envvars
# MULLE_SDE_TRACE_UNIVERSE=YES \
MULLE_SDE_TRACE_ENABLED=YES \
gdb /usr/sbin/apache2
gdb> set verbose on
gdb> run -X