Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

378
Vistas
apxs apache module creator compile libraries into shared object linux/unix

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?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

acos() is a function of libm. You have to specify, that your shared library also needs to link libm to satisfies its requirements.

Try compiling this way:

apxs -i -c mod_anastasia.c ana_browsegrove.c libtcl8.4.a -lm

This should fix your undefined symbol issue.

For the other warning: You could also try to link the shared version of the tcl library instead by replacing libtcl8.4.a by -ltcl8.4 (if the corresponding tcl library is installed correctly in the system). Linking static libraries to a shared library can be problematic and should be avoided.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda