Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

382
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda