Building

From Log4cpp

Jump to: navigation, search

Contents

Linux - gcc

As of version 0.2.0 log4cpp can be build using autoconf on platforms that support it. Simply do:

#./autogen.sh
#./configure
#make
#make check
#make install

This will install log4cpp under /usr/local. To install in another localation specify --prefix=<location> when running configure. Options for ./configure Besides the usual ./configure options like --prefix a few others are available:

--with-idsa

Include support for logging to IDSA (http://jade.cs.uct.ac.za/idsa/index.html). This will give you an IdsaAppender Appender class.

--with-omnithreads[=<path-to-omniORB>]

Enable multi-threading support using omniORB4's omniThreads MT abstraction library (http://www.omniorb.org). configure expects the omnithread header files to reside in <path-to-omniORB>/include and the library in <path-to-omniORB</lib, i.e. not in a platform specific subdirectory. Create symlinks where necessary.

NB. omniORB4 is required: omniORB3 will not suffice as it lacks sufficient support for thread specific data. At the moment (August 2002) omniORB4 is in beta, however most parts and specifically the threading library appear to be quite stable.

--with-pthreads

Enable multi-threading support using the 'pthread' POSIX threads library. This option is mutually exclusive with --with-omnithreads.

--enable-doxyen

Enables generation of API documentation by Dimitri van Heeschs Doxygen tool (http://www.doxygen.org/). Defaults to yes if doxygen can be found in the search path.

--enable-html-docs

If doxygen is enabled, have it generate HTML formatted documentation.

--enable-latex-docs

If doxygen is enabled, have it generate LaTeX formatted documentation.

--enable-dot

Let Doxygen use the 'dot' tool of GraphViz (http://www.graphviz.org) todraw its graphs.

Build notes for specific platforms

nix - g++ compiler

Log4cpp should build whitout modification on any decent *nix system with g++ and GNU make. The primary development platform is RedHat Linux 7.3, which has g++ 2.96-rh, but the aim is to be compatible with from g++ 2.95 and up. When g++ 3.x has been widely adopted we may drop support for older g++ versions.

Solaris - Sun CC compiler

Compilation with Suns CC compiler requires setting some enviroment variables. Also static libraries appear not to work. In short do:

CC=CC CXX=CC LD="CC -KPIC" ./configure --disable-static

Win32 - MSVC++ 7.1

Use the workspace and project files in subdirectory msvc7. You may need to adjust include/log4cpp/config-win32.h and the project files to your particular needs. For MSVC7.1, the default library is now a dll instead of a lib. So, log4cpp has been changed to log4cppLIB and log4cppDLL to log4cpp. STL and boost port are not provided even if the projects are ready to be added to the log4cpp solution.

Win32 - MSVC++ 6

Use the workspace and project files in subdirectory msvc6. You may need to adjust include/log4cpp/config-win32.h and the project files to your particular needs.

Win32 - MSVC++ 5

Building log4cpp with MSVC++ 5 is not supported and will not be, unless someone can find a way to do so without mutilating the source code.

Win32 - Borland C++ Builder 5

Use the project and make files in subdirectory bcb5.

Win32 - Cygwin

Use './configure; make; make install'. Be warned that there have been very few success or failure reports for this platform, so either it works very smoothly or noone actively uses log4cpp with Cygwin :-)

OpenVMS

Edit include/log4cpp/config-openvms.h if you need different settings. This has been tested on OpenVMS Alpha v7.3 and Compaq C++ V6.3-020 only.

1) Copy the src and include directory (including all its contents and subdirectories) onto your OpenVMS system.
2) Compile each source file (*.CPP and *.C in the src directory) one by one by the following command,
cxx /include=("/a1\$dkb0/user/tony/project/log4cpp/include") /define=(__USE_STD_IOSTREAM,__OPENVMS__) /repository=a1$dkb0:[user.tony.project.log4cpp.repository] APPENDER.CPP
cxx /include=("/a1\$dkb0/user/tony/project/log4cpp/include") /define=(__USE_STD_IOSTREAM,__OPENVMS__) /repository=a1$dkb0:[user.tony.project.log4cpp.repository] APPENDERSKELETON.CPP

...etc

Please substitute a correct path for your include directory. A unix-style directory name is requied in the /include parameter. In this example, the pathis A1$DKBO:[USER.TONY.PROJECT.LOG4CPP.INCLUDE]

A repository directory is also specified here as A1$DKB0:[USER.TONY.PROJECT.LOG4CPP.REPOSITORY].

3) Create a static library, LOG4CPP.OLB
lib/create log4cpp
4) Put all compiled OBJ files into the LOG4CPP.OLB
lib/insert log4cpp appender
lib/insert log4cpp appenderskeleton

...etc

5) Link a program with log4cpp.olb. e.g:
cxx /include=("/a1\$dkb0/user/tony/project/log4cpp/include") /define=(__USE_STD_IOSTREAM,__OPENVMS__) testlog4cpp.cxx
cxxlink /repository=a1$dkb0:[user.tony.project.log4cpp.repository] testlog4cpp,log4cpp/library

cmake - Cross pltform make

Tan Meng YUE has contributed a cmake configuration which can be used to build log4cpp on all systems which supporting cmake.

To compile log4cpp you can do (from the root of the project):

  1. mkdir build
  2. cd build
  3. rm -rf * # this is only for sureness that this dir is empty
  4. cmake ..
  5. make all

Now you should have the log4cpp library in the build directory.

Personal tools