Jorge Handl wrote: > I'm sorry to bother you with this, but I'm in dire need of a helping > hand and don't know who else to ask... > I'm new to linux, cygwin and apache (yes, a newbie!) > > I want to make a module for apache and can't build the .so file. I'm > actually following the steps described in > http://threebit.net/tutorials/apache2_modules/tut1/tutorial1.html. I'm > getting the "undefined reference to `_ap_hook_handler'" message when > make-ing the module. I believe I should add a -l directive for the > linker, pointing to some httpd library, but I can't figure out which > library and where to insert that directive. > > Could you please point me in the right direction? I've tried to > understand the thread in > http://sourceware.org/ml/cygwin/2004-09/msg01200.html but it's way over > my head...
In the future please send questions to the Cygwin mailing list, that way they will be archived and others can comment as well. First of all, you didn't state what version of Apache or what module you're trying to compile. Apache 2.x and 1.x are significantly different. I've no experience building DSOs with 2.x, and I suspect that it will not compile under Cygwin without some patching and porting. The thread you refer to was in reference to building mod_php for apache 1.x, and if that's not what you're trying to do then ignore it completely. I don't know off the top of my head where the symbol ap_hook_handler lives but I suspect it's in the main -lhttp module. Unfortunately the 1.3 Apache package in Cygwin does not include the import library for this module, so you have to change your link command line to link explicitly /usr/bin/libhttp.dll, which is also named wrong. If the packaging were correct, this file would be /usr/bin/cyghttpd.dll and there would be a /usr/lib/libhttp.dll.a which would cause "-lhttp" to work properly. (Insert grumble about Apache package problems here.) However, the build system should add this -lhttp for you to the link command line, which normally results in an error about not being able to find the library, which apparently you are not getting, so I suspect it's something else. A common problem of porting to Cygwin is the fact that there can be no "lazy" symbol resolution, everything must be accounted for at link time. Because of this you often have to do something like LDFLAGS="-Wl,-no-undefined" when configuring, or patching the makefile.{am,in} to accomplish the same thing. Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/