On Sun, May 3, 2026 at 7:49 PM Jun Omae <[email protected]> wrote: > > Hi, > > On 2026/04/30 0:02, Timofei Zhakov wrote: > > Hello all, > > > > There is a somewhat minimal untested support for compiling the modules > > for Apache Httpd in cmake. However, I found that the Unix version > > works in a fundamentally different way than Windows (that I was > > testing on initially); It appears there is no libhttpd in its package. > > > > The recommended way to compile is to use the apxs tool [1]. 'make' > > does just call it. We could use it in cmake as well, but I believe it > > wouldn't be the optimal way in cmake. It would not respect the user > > specified compiler and other configurations. I rather think we should > > work around it and link all the required libs manually. > > > > Does anyone know where (and why) it puts all that code from libhttpd > > on a Unix build? I'm confused a little bit... > > > > [1] https://httpd.apache.org/docs/2.4/programs/apxs.html > > Could you please try attached patch for building Apache modules using > apxs via cmake?
I can confirm that it works. I see that you used it to get the flags rather than to let it build the module. Because this was what made me confused in the first place. The documentation mentions that you can call it like 'apxs -i -a -c mod_foo.c' so it makes a freshly built mod with everything set up. Slight note about this... [[[ + find_program(APXS_EXECUTABLE + NAMES apxs2 apxs + PATH /usr/local/apache2/bin /usr/local/apache/bin /usr/bin /usr/sbin) ]]] ...it doesn't really make that much of a difference but I think it's more prefered to rely on cmake's standard paths (like let it search in $PATH and other system specific places). There is also a PATH_SUFFIXES variable for find_program to customise unusual locations like /usr/local/apache/bin. Although in this exact case it wouldn't work because it's not under <prefix>/<bin>. Basically because cmake searches many potential places for programs to be (see NO_DEFAULT_PATH section of find_program documentation), the '/usr/bin /usr/sbin' part is extra. Or I guess if this part is taken from autoconf it's fine... Also have you tested the Mac OS case? Can it by any chance work out-of-box with apxs settings or the "-Wl,-undefined,dynamic_lookup" flags are mandatory? I don't have an environment to test it. It would be great if somebody who does could take a look at it. > I think it is needed to use add_library(... INTERFACE ...) for the Apache > modules. I confirmed quickly that the built modules work with Apache on > Ubuntu and Windows. Yes, I think this would be more precise. > Also, I'd suggest to use LF rather than CRLF for newlines in > build/cmake/FindHttpd.cmake. Perhaps this file is missing svn:eol-style that's why... > -- > Jun Omae <[email protected]> (大前 潤) I think now I get more understanding about how it resolves runtime libraries... I checked the compiled object and the default modules I have installed on my system with 'ld' and it shows a bunch of 'undefined reference' errors. Which means that httpd deals with resolving those functions and symbols at runtime when the DSO is loaded. It's possible that they all are defined in the service binary itself. -- Timofei Zhakov

