logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Building & Member Downloads View previous topic :: View next topic
Reply to topic   Topic: How to statically compile modules in Apache 2.2.17 for Win32
Author
marcosessa



Joined: 28 Mar 2011
Posts: 2
Location: Rome

PostPosted: Mon 28 Mar '11 12:26    Post subject: How to statically compile modules in Apache 2.2.17 for Win32 Reply with quote

Hi all,
is it possibile to statically compile modules in apache.exe?

On both linux and mac side I was able to build an apache exec (httpd) stand alone that contains both all deps (apr, apr-util, pcre) and the modules that I needed, but in Windows I was only able to build an apache.exe stand alone (that cointains only apr.dll, apr-util.dll and other deps) without modules. So for example, I cannot be able to use the Order directive in httpd.conf file because the needed module is not included in apache.exe.

I modify a lot of mak files included the httpd.mak file in order to build the apache.exe using link.exe in this way:
link.exe Release\main.obj \
Release\httpd.res \
srclib\apr\Release\libapr.lib \
srclib\pcre\Release\pcre.lib \
srclib\apr-iconv\Release\libapriconv.lib \
Release\my_modules.lib \
Release\libhttpd.lib

every .lib file has all the obj files built statically with lib.exe

Building in this way the "my_modules.lib" seems to be ignored and all the obj module files were not included in the apache.exe (for example mod_authn_file.obj, mod_expires, mod_actions and so on...).

If I add obj files explicitally during build in this way:
link.exe Release\main.obj \
Release\httpd.res \
srclib\apr\Release\libapr.lib \
srclib\pcre\Release\pcre.lib \
srclib\apr-iconv\Release\libapriconv.lib \
Release\libhttpd.lib \
modules\Release\mod_authn_file.obj \
modules\Release\mod_expires.obj \
modules\Release\mod_actions.obj \
...... (other object modules)

the size of apache.exe grow but if I use the command apache.exe -M to see Loaded Modules, I find only:
core_module (static)
win32_module (static)
mpm_winnt_module (static)
http:module (static)
so_module (static)

[that are all modules that aren't included in my_modules.lib]


I hope that someone can help me.
Thanks

Marco
Back to top
marcosessa



Joined: 28 Mar 2011
Posts: 2
Location: Rome

PostPosted: Tue 29 Mar '11 14:36    Post subject: [solved] Reply with quote

I've solved it...

I modified modules.c file in os/win32/ folder in this way:

#undef AP_DECLARE_EXPORT
#define AP_DECLARE_STATIC

#define CORE_PRIVATE
#include "httpd.h"
#include "http_config.h"

extern module core_module;
extern module win32_module;
extern module mpm_winnt_module;
extern module http_module;
extern module so_module;
extern module authn_file_module;
extern module authn_default_module;
extern module authz_host_module;
extern module authz_groupfile_module;
extern module authz_user_module;
extern module authz_default_module;
extern module auth_basic_module;
extern module filter_module;
extern module deflate_module;
extern module log_config_module;
extern module expires_module;
extern module setenvif_module;
extern module version_module;
extern module ssl_module;
extern module mime_module;
extern module status_module;
extern module cgi_module;
extern module dir_module;
extern module actions_module;
extern module alias_module;

AP_DECLARE_DATA module *ap_prelinked_modules[] = {
&core_module,
&win32_module,
&mpm_winnt_module,
&http_module,
&so_module,
&authn_file_module,
&authn_default_module,
&authz_host_module,
&authz_groupfile_module,
&authz_user_module,
&authz_default_module,
&auth_basic_module,
&filter_module,
&deflate_module,
&log_config_module,
&expires_module,
&setenvif_module,
&version_module,
&ssl_module,
&mime_module,
&status_module,
&cgi_module,
&dir_module,
&actions_module,
&alias_module,
NULL
};

ap_module_symbol_t ap_prelinked_module_symbols[] = {
{"core_module", &core_module},
{"win32_module", &win32_module},
{"mpm_winnt_module", &mpm_winnt_module},
{"http_module", &http_module},
{"so_module", &so_module},
{"authn_file_module", &authn_file_module},
{"authn_default_module", &authn_default_module},
{"authz_host_module", &authz_host_module},
{"authz_groupfile_module", &authz_groupfile_module},
{"authz_user_module", &authz_user_module},
{"authz_default_module", &authz_default_module},
{"auth_basic_module", &auth_basic_module},
{"filter_module", &filter_module},
{"deflate_module", &deflate_module},
{"log_config_module", &log_config_module},
{"expires_module", &expires_module},
{"setenvif_module", &setenvif_module},
{"version_module", &version_module},
{"ssl_module", &ssl_module},
{"mime_module", &mime_module},
{"status_module", &status_module},
{"cgi_module", &cgi_module},
{"dir_module", &dir_module},
{"actions_module", &actions_module},
{"alias_module", &alias_module},
{NULL, NULL}
};

AP_DECLARE_DATA module *ap_preloaded_modules[] = {
&core_module,
&win32_module,
&mpm_winnt_module,
&http_module,
&so_module,
&authn_file_module,
&authn_default_module,
&authz_host_module,
&authz_groupfile_module,
&authz_user_module,
&authz_default_module,
&auth_basic_module,
&filter_module,
&deflate_module,
&log_config_module,
&expires_module,
&setenvif_module,
&version_module,
&ssl_module,
&mime_module,
&status_module,
&cgi_module,
&dir_module,
&actions_module,
&alias_module,
NULL
};


then I recompile the modules.obj file with this command:

C:\Documents and Settings\sessa\Desktop\httpd-2.2.17-win32-src\httpd-2.2.17_21>
cl.exe /nologo /MT /W3 /Zi /O2 /Oy- /I "./srclib/pcre" /I "./include" /I "./srclib/apr/include" /I "./srclib/apr-util/include" /I "./server/mpm/winnt" /I "./modules/http" /I "./modules/proxy" /I "./modules/mappers" /I "./server" /I"./modules/generators" /I "./modules/filters" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "AP_DECLARE_STATIC" /D "API_DECLARE_STATIC" /D"APU_DECLARE_STATIC" /D "PCRE_STATIC" /Fo"Release\\" /Fd"Release\modules_sessa" /FD /c ./os/win32/modules.c

then I rebuild apache.exe and execute apache.exe -M:

Loaded Modules:
core_module (static)
win32_module (static)
mpm_winnt_module (static)
http_module (static)
so_module (static)
authn_file_module (static)
authn_default_module (static)
authz_host_module (static)
authz_groupfile_module (static)
authz_user_module (static)
authz_default_module (static)
auth_basic_module (static)
filter_module (static)
log_config_module (static)
expires_module (static)
setenvif_module (static)
version_module (static)
deflate_module (static)
ssl_module (static)
mime_module (static)
status_module (static)
cgi_module (static)
dir_module (static)
actions_module (static)
alias_module (static)
Syntax OK

so in this way I have compiled an apache 2.2.17 statically for win32!
Back to top


Reply to topic   Topic: How to statically compile modules in Apache 2.2.17 for Win32 View previous topic :: View next topic
Post new topic   Forum Index -> Building & Member Downloads