The Apache Portable Runtime Project

Get Involved

  • Subversion
  • Mailing Lists
  • Snapshots
  • Build on Win32
  • Build on Unix
  • Download!

  • from a mirror
  • APR Docs

  • Version 1.2
  • Version 0.9
  • Trunk (dev)
  • APR-util Docs

  • Version 1.2
  • Version 0.9
  • Trunk (dev)
  • APR-iconv Docs

  • Version 1.1
  • Version 0.9
  • Trunk (dev)
  • Guidelines

  • Project Guidelines
  • Contributing
  • Version Numbers
  • Miscellaneous

  • License
  • Projects using APR
  • Security Reports
  • Requirements

    Compiling apr, apr-iconv and/or apr-util requires the following environment to be properly installed:

    • A suitable Microsoft compiler: such as: Microsoft Visual C++ 5.0 or higher; Microsoft Visual Studio .NET 2002 or higher (with Visual C++ .NET compiler). We have not yet tried the 'Express' versions of Visual Studio .NET 2005 and are unable to provide support for them.
    • Follow the required directory layout.

    APR can be built using the command line tools, or from within the graphical IDE (Visual Studio IDE Workbench or Microsoft Development Environment).

    Visual C++ 5.0 users only: The Windows Platform SDK. Visual C++ 5.0 developers need the updated Microsoft Windows Platform SDK to enable some APR features. The Platform SDK files distributed with Visual C++ 6.0 and later are sufficient, so those users may skip this requirement. The Windows Platform SDK update is required to enable all supported features with MSVC++ 5.0. Without a current version, APR will issue warnings under MSVC++ 5.0 or fail to build entirely. Look for the update on Microsoft's website - we are afraid they change the link too often to cite.
    Historical APR releases only: Current versions of APR do not need awk - however, older versions of APR (prior to APR 1.1.1) require awk. You may find a Win32 binary version of awk at: http://cm.bell-labs.com/cm/cs/who/bwk/awk95.exe You must have awk installed as awk.exe.
    Required Directory Layout

    For a supported build, you must have apr, apr-iconv, and apr-util checked-out in parallel directories. For example:

    • C:\work\apr\
    • C:\work\apr-iconv\
    • C:\work\apr-util\

    For a release, unzipping the release files into this directory layout should be sufficient.

    To track development, please read the information on checking out from Subversion. We recommend TortoiseSVN on Win32 platforms.

    Currently, the directories must be called apr, apr-iconv, and apr-util. No exceptions.

    Developer Studio Workspace/Microsoft Development Environment IDE Build

    APR can be compiled using Visual C++'s graphical environment. To simplify this process, a complete Visual Studio workspace, apr-util/aprutil.dsw, is provided. This workspace exposes the entire list of working .dsp projects that are required for the complete APR binary release. It includes dependencies between the projects to assure that they are built in the appropriate order.

    These workspaces are shipped in the Visual Studio 6.0 format - however, you can safely 'upgrade' them to your current Visual Studio release (i.e. Visual Studio 2003 .NET). However, for compatibility and simplicity, we only distribute Visual Studio 6.0 workspaces. See below for converting the workspaces for Visual Studio 5.0.

    Open the apr-util/aprutil.dsw workspace, and choose either aprutil or libaprutil (for static or dynamic libraries) with the Release or Debug build as the Active Project. aprutil.dsw causes all related projects to be built.

    You can then choose 'Build Solution' or 'Build Project' to build the libraries and the dependencies.

    The apr test environment can be compiled using VC++'s Visual Studio development environment with the apr/test/aprtest.dsw project. This workspace exposes the apr/apr.dsp static library and the apr/test/aprtest.dsp projects that allow the developer to assemble the entire test application suite.

    Historical Build Note (does not apply to releases after 1.1.1): If you are doing a Visual Studio 5.0/6.0 Graphical build, it will only find awk.exe from the Tools menu Options... Directories settings for the Executable files. Add the path for awk.exe to this list, as needed. For Visual Studio .NET 2003 and newer, you may need to copy awk to the Common7\Tools\Bin directory (i.e. where RC.exe is) - it no longer has the specific PATH options (as far as we can tell).
    Command-Line Build

    If you use the command line, you must configure it:

      "C:\Program Files\DevStudio\VC\Bin\vcvars32.bat"
    

    If necessary, you will also need to prepare the Platform SDK environment:

      "C:\Program Files\Platform SDK\setenv.bat"
    

    cd to the apr-util directory. Now, simply use one of the following commands to compile the static or dynamic libraries, respectively, on Visual C++ 6.0 or later:

      msdev aprutil.dsw /MAKE \
        apriconv - Win32 Release" \
        apr - Win32 Release" \
        libapr - Win32 Release" \
        gen_uri_delims - Win32 Release" \
        xml - Win32 Release" \
        "aprutil - Win32 Release" \
    
      msdev aprutil.dsw /MAKE \
        libapr - Win32 Release" \
        libapriconv - Win32 Release" \
        gen_uri_delims - Win32 Release" \
        xml - Win32 Release" \
        libaprutil - Win32 Release" \
    

    Either command will compile APR. The latter will build the libraries as .dll dynamic shared libraries, rather than static libraries.

    Replace Release with Debug to include debugging information in the resulting files, making it easier to find bugs and track down problems.

    For Visual Studio C++ 5.0 command line users: Only the .dsp files are maintained within Subversion. Win32 .mak files are NOT maintained in Subversion, due to the tremendous waste of reviewer's time. Therefore, you cannot rely on the NMAKE commands above to build revised .dsp project files unless you then export all .mak files yourself from the project.
    Integrating the Library

    We should tell ya'll 'bout this, no?

    Library Components

    The apr-util/aprutil.dsw workspace builds the .dsp projects of the Apache server listed with dependent projects preceeding their dependencies:

    1. apr-util\aprutil.dsp
    2. apr-util\libaprutil.dsp
    3. apr-util\uri\gen_uri_delims.dsp
    4. apr-util\xml\expat\lib\xml.dsp
    5. apr-iconv\apriconv.dsp
    6. apr-iconv\libapriconv.dsp
    7. apr\apr.dsp
    8. apr\libapr.dsp

    The libXXX projects create .dll targets, dynamic shared libraries. Their non-libXXX counterparts create static .lib targets.

    To compile code for the libraries, the consuming compiliation must include the apr/include and apr-util/include directories in their include file search paths. To target the static .lib versions of the library, the consuming compiliation must define the macros APR_DECLARE_STATIC and APU_DECLARE_STATIC. This prevents the apr and apr-util symbols from being tagged as __declspec(dllimport), eliminating compiliation warnings and speeding up execution.

    Converting the Project for Visual C++ 5.0

    The .dsp project files are distributed in Visual C++ 6.0 format. Visual C++ 5.0 (97) will recognize them. To quickly prepare the .dsp files in the native Visual Studio 5.0 (97) format, you can run this command from the top-level apr directory (above apr, apr-util and apr-iconv):

         perl apr\build\cvtdsp.pl -5
    

    You must type this command from the top level directory of the apr source tree. Every VC6 .dsp project file within the current directory and below will be listed as it is converted. If you contribute back a patch that revises project files, please convert them back with the the -6 option instead of -5, which returns the project files to Visual Studio 6.0 format.


    Copyright © 1999-2003, The Apache Software Foundation