Chinaunix首页 | 论坛 | 博客
  • 博客访问: 627443
  • 博文数量: 133
  • 博客积分: 1566
  • 博客等级: 上尉
  • 技术积分: 1230
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-01 09:31
文章分类

全部博文(133)

文章存档

2019年(1)

2018年(1)

2017年(8)

2016年(9)

2015年(17)

2014年(4)

2013年(31)

2012年(25)

2011年(36)

2010年(1)

我的朋友

分类: Windows平台

2015-08-07 11:13:46

一、前言
    无论编译Apache还是Subversion,首先要看的是每个项目的每个版本的编译说明文档。
    Apache的编译说明文件是INSTALL文件,该文件在httpd-x.x.xx目录下,在该文件中指明了在windows编译Apache所需要的看的文档,比如本版本中看httpd-x.x.xx\docs\manual\platform\win_compiling.html.en文件,或者。最好看前面这个文件,这个文件是针对该版本的编译说明,后一个文件可以作为参考。
    Subversion的说明文件是INSTALL,该文件在subversion-x.x.x目录下,在该文件中指明了在windows怎么编译Subversion
二、编译环境搭建
    1. Windows环境设置
        1) VS2008(VC9)的环境配置
           通过C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat文件配置VS2008(VC9)的编译环境
        2) Perl/Awk

Several steps recommended here require a perl interpreter during the build preparation process, but it is otherwise not required.

To install Apache within the build system, several files are modified using the awk.exe utility. awk was chosen since it is a very small download (compared with Perl or WSH/VB) and accomplishes the task of modifying configuration files upon installation. Brian Kernighan's~bwk/btl.mirror/ site has a compiled native Win32 binary, ~bwk/btl.mirror/awk95.exe which you must save with the name awk.exe (rather than awk95.exe).

If awk.exe is not found, Makefile.win's install target will not perform substitutions in the installed .conf files. You must manually modify the installed .conf files to allow the server to start. Search and replace all "@token@" tags as appropriate.
The Visual Studio IDE will only find awk.exe from the PATH, or executable path specified in the menu option Tools -> Options -> (Projects ->) Directories. Ensure awk.exe is in your system path.
        3) Python 2.4 or newer ()(Subversion需要)
        If you want to run "make check" or build from the latest source under Unix as described in section II.B and III.D, install Python 2.4 or higher on your system. The majority of the test suite is written in Python, as is part of Subversion's build system.
    2 第三方库
        1) openssl库 (OPTIONAL)

Configuring and building OpenSSL requires perl to be installed.

OpenSSL must be installed into a srclib subdirectory named openssl, obtained from  in order to compile mod_sslor the abs.exe project, which is ab.c with SSL support enabled. To prepare OpenSSL to be linked to Apache mod_ssl or abs.exe, and disable patent encumbered features in OpenSSL, you might use the following build commands:

perl Configure no-rc5 no-idea enable-mdc2 enable-zlib VC-WIN32 -Ipath/to/srclib/zlib -Lpath/to/srclib/zlib
ms\do_masm.bat
nmake -f ms\ntdll.mak

It is not advisable to use zlib-dynamic, as that transfers the cost of deflating SSL streams to the first request which must load the zlib dll. Note the suggested patch enables the -L flag to work with windows builds, corrects the name of zdll.lib and ensures .pdb files are generated for troubleshooting. If the assembler is not installed, you would add no-asm above and use ms\do_ms.bat instead of the ms\do_masm.bat script.
        2) zlib库 (OPTIONAL)
  • Zlib must be installed into a srclib subdirectory named zlib. This must be built in-place. Zlib can be obtained from  themod_deflate is confirmed to work correctly with version 1.2.3.

    nmake -f win32\Makefile.msc
    nmake -f win32\Makefile.msc test

  • [Optional] OpenSSL libraries (for mod_ssl and ab.exe with ssl support)

    The OpenSSL library is cryptographic software. The country in which you currently reside may have restrictions on the import, possession, use, and/or re-export to another country, of encryption software. BEFORE using any encryption software, please check your country's laws, regulations and policies concerning the import, possession, or use, and re-export of encryption software, to see if this is permitted. See more information.

    Configuring and building OpenSSL requires perl to be installed.

    OpenSSL must be installed into a srclib subdirectory named openssl, obtained from  in order to compile mod_sslor the abs.exe project, which is ab.c with SSL support enabled. To prepare OpenSSL to be linked to Apache mod_ssl or abs.exe, and disable patent encumbered features in OpenSSL, you might use the following build commands:

    perl Configure no-rc5 no-idea enable-mdc2 enable-zlib VC-WIN32 -Ipath/to/srclib/zlib -Lpath/to/srclib/zlib
    ms\do_masm.bat
    nmake -f ms\ntdll.mak

    It is not advisable to use zlib-dynamic, as that transfers the cost of deflating SSL streams to the first request which must load the zlib dll. Note the suggested patch enables the -L flag to work with windows builds, corrects the name of zdll.lib and ensures .pdb files are generated for troubleshooting. If the assembler is not installed, you would add no-asm above and use ms\do_ms.bat instead of the ms\do_masm.bat script.
        3) Apache Portable Runtime库(APR,REQUIRED)
        The Apache Portable Runtime (APR) library provides an abstraction of operating-system level services such as file and network I/O, memory management, and so on.  It also provides convenience routines for things like hashtables, checksums, and argument processing.  While it was originally developed for the Apache HTTP server, APR is a standalone library used by Subversion and other products.  It is a critical dependency for all of Subversion; it's the layer that allows Subversion clients and servers to run on different operating systems
        4) Database(Berkeley DB等)

The apr-util library exposes dbm (keyed database) and dbd (query oriented database) client functionality to the httpd server and its modules, such as authentication and authorization. The sdbm dbm and odbc dbd providers are compiled unconditionally.

The dbd support includes the Oracle instantclient package, MySQL, PostgreSQL and sqlite. To build these all, for example, set up the LIB to include the library path, INCLUDE to include the headers path, and PATH to include the dll bin path of all four SDK's, and set the DBD_LIST environment variable to inform the build which client driver SDKs are installed correctly, e.g.;

set DBD_LIST=sqlite3 pgsql oracle mysql

Similarly, the dbm support can be extended with DBM_LIST to build a Berkeley DB provider (db) and/or gdbm provider, by similarly configuring LIB, INCLUDE and PATH first to ensure the client library libs and headers are available.

set DBM_LIST=db gdbm

Depending on the choice of database distributions, it may be necessary to change the actual link target name (e.g. gdbm.lib vs. libgdb.lib) that are listed in the corresponding .dsp/.mak files within the directories srclib\apr-util\dbd or ...\dbm.

See the README-win32.txt file for more hints on obtaining the various database driver SDKs.

三、编译中的注意事项
    1. Python的升级到python-2.7.10引发的语法错误
        比如语句except IOError, e:==》except IOError as e:
    2. 添加Berkeley DB库
        在编译Subversion的时候,根据说明DB库是可选的但是在编译过程中发现APU_HAVE_DB为0的时候,工程是编译不过去的。虽然在编译APR时是可以编译成功的。为了Subversion成功则需要在编译APR时,将该参数设置为1.该宏是在Apu.h中声明,而该头文件时在编译APR时通过apu.hw文件生成的。所以需要在apu.hw文件中修改该参数。如果要求支持Apache Server,还需要在htdbm.mak/httxt2dbm.mak中添加Berkeley DB库文件的配置项(在LINK32_FLAGS中添加libdb44.lib),在apr_dbm_db.mak中引用的Berkeley DB库文件修改为匹配的库文件
阅读(1374) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~