I am trying to create a new Apache 2 module, to hold a complex piece of software. The code consists of my own C files, which compile into .o files and are then linked into a .so file. The problem is that my code uses tcl to handle scripting. Up to now, I have compiled the tcl (version 8.4.13 -- yes, it is that old) into a .a archive and linked it to the .o files to create a single .so file, which Apache loads as a module and all works. I found this tricky on the Mac BSD-based system, but was able finally to make it work by: 1. Compiling tcl with --enable-threads --disable-shared --disable-corefoundation options 2. Link the .o files from my code to the tcl library with this:
gcc -DSHARED_MODULE -bundle -undefined suppress -flat_namespace -o mod_anastasia.so Release/*.o libtcl8.5.a
This works for BSD/Mac. So now I need to compile this module for a Linux server. Here is the apxs command which should (in theory) work:
apxs -i -c mod_anastasia.c ana_browsegrove.c libtcl8.4.a
This gives the following warning:
* Warning: Linking the shared library mod_anastasia.la against the static library libtcl8.4.a is not portable!*
And sure enough when I try to load the .so file created into Apache, I get this error:
httpd: Syntax error on line 156 of /usr/local/apache2/conf/httpd.conf: Cannot load modules/mod_anastasia.so into server: /usr/local/apache2/modules/mod_anastasia.so: undefined symbol: acos
So my question... does anyone know the magic formula for compiling a .a file so that Apache can link it to .o files made by apxs?