Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

379
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!