Tuesday, March 01, 2011

How To Build Log4cxx In Visual Studio 2010

Daniel mentioned how he managed to build log4cxx in Visual Studio. However, he did not provide more details. So this blog post serves as a detailed explanation.
http://old.nabble.com/Unable-to-build-with-VS2010-td28519743.html

We are going to follow the steps here, http://logging.apache.org/log4cxx/building/vstudio.html. However, we must make changes to adapt to Visual Studio 2010.

Preparation
Download the log4cxx ZIP package from here, http://logging.apache.org/log4cxx/download.html, and extract its content.
Download apr and apr-util ZIP packages from here, http://apr.apache.org/download.cgi.


3. Now let's translate the original commands into manual steps,
 unzip apr-1.2.11-win32-src.zip      -> manually extract this zip rename apr-1.2.11 apr               -> rename the extracted folder unzip apr-util-1.2.10-win32-src.zip -> manually extract this zip rename apr-util-1.2.10 apr-util     -> rename this folder too cd apache-log4cxx-0.10.0             configure                           -> execute configure.bat configure-aprutil                   -> see below*
* as the sed tool is not available on Windows, you must do the following,
Open apr-util\include\apu.hw.

Find the line starting with "#define APU_HAVE_APR_ICONV".
Change this constant to 0 and save.

Open apr-util\include\apr_ldap.hw.
Find the line starting with "#define APR_HAS_LDAP"
Change this constant to 0.

The changes mean that we won't use APR ICONV and LDAP support.
Building log4cxx.dll

Read more: The Half-Blood Programmer