简体   繁体   中英

Linking a static library to an Apache module

I am experimenting with Apache module development and therefore I'd like to know how to link a static library to a module (if it is even possible).

Naturally it compiles and installs nicely and Apache fails when the module is loaded. The message is:

Cannot load /usr/lib/apache2/modules/mod_example.so into server: /usr/lib/apache2/modules/mod_example.so: undefined symbol: zmq_socket

The library I want to link is zeromq, I am using the makefile generated by apxs2 . Here I added -lzmq . If I remove zmq related code, the module runs fine.

My platform is Ubuntu 12.04 64 bit, gcc4.6.3.

well, apparently the generated makefile is not a good idea. I replaced the makefile references with basic compilation commands, eg:

apxs2 -c -lzmq mod_example.c

alk's suggestion in the comment of the question would also work (adding library location to LD_LIBRARY_PATH ), since I was linking another apache-related library (apreq), which linked without any problems.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM