This page is intended for users to contribute their findings about building CppUnit.

Contents

General Notes

See INSTALL in the source package.

UNIX-like systems

UNIX-like systems include Linux, AIX, CygWin, and Mac OS X/Darwin. Under Linux, you may want to check if your distribution has a cppunit package.

Microsoft Visual Studio

See INSTALL-WIN32.txt in the source package. Alternatively, src/CppUnitLibraries.dsw can be used.

Specific Platforms

Here are user notes for specific platforms:

SunOS 5.8, CC 5.5

./configure CXX=CC CXXFLAGS="-mt -xtarget=generic -g -features=no%transitions -xildoff" LD=CC LDFLAGS=-xildoff

./configure CXX=CC CXXFLAGS="-mt -xtarget=generic -g -features=no%transitions -xildoff" LD=CC LDFLAGS=-xildoff CC=CC

HP-UX B.11.1 PA-RISC

LD=/usr/ccs/bin/ld CXX="aCC" CC=aCC CXXFLAGS="-AA -ext +DAportable -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DUNIX -D_RWSTD_MULTI_THREAD -D_REENTRANT -mt +O1" ./configure

IBM AIX 5.1, VACPP 6.0

./configure

Cygwin w/ gcc 3.3.1

./configure

No errors with 1.10.2 and up-to-date Cygwin. Documentation is in INSTALL-unix, and is out-of-date (no --disable-shared required on configure step). GCC now gives pretty names, so --disable-typeinfo-name is not required either.

For autoconfig users, the line for configure.ac is AM_PATH_CPPUNIT(1.10.2). The command for aclocal is aclocal -I /usr/local/share/aclocal. To eliminate the aclocal warning about an underquoted definition of AM_PATH_CPPUNIT, edit /usr/src/local/cppunit.m4, changing line 4 from:

AC_DEFUN(AM_PATH_CPPUNIT,

to

AC_DEFUN([AM_PATH_CPPUNIT],

MingW with MSYS on Microsoft XP

I got some errors running 'make check' and 'make install' but I least I got libcppunit.a (static build) and 'libcppunit-1-12-0.dll'

Because MSYS, this files are located at msysdirectory\local\bin and msysdirectory\local\lib Just move them to C:\CppUnit\lib

Don't forget to set PATH to c:\CppUnit\lib

Solaris 2.8 64-bit, gcc 3.3.2

export CFLAGS="-m64 -mcpu=v9"; export CXXFLAGS=$CFLAGS; ./configure --libdir=/usr/local/lib/sparcv9

Borland C++ Builder

See http://community.borland.com/article/0,1410,32704,00.html . These instructions were written for Builder 5.x, but there are suggestions for working with 6.x.

Eclipse

Follow these step by step instructions on how to build CppUnitWithEclipse and CDT.

Mac OS 10.4 Universal Binary (PowerPC and i386), GCC 4.0.1

To build a native single-architecture binary follow the generic UNIX instructions.

For a universal build using DWARF-2 debug symbols (recommended - it makes the library dramatically smaller and easier to debug):

When building on an Intel machine:

./configure --disable-dependency-tracking CXXFLAGS="-arch ppc -arch i386 -gdwarf-2 -O2"
make AM_LDFLAGS="-XCClinker -arch -XCClinker ppc -XCClinker -arch -XCClinker i386"

When building on a PowerPC machine (with Universal SDK installed):

./configure --disable-dependency-tracking CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386 -gdwarf-2 -O2"
make AM_LDFLAGS="-XCClinker -arch -XCClinker ppc -XCClinker -arch -XCClinker i386 -XCClinker -isysroot -XCClinker /Developer/SDKs/MacOSX10.4u.sdk"

Generating Documentation on Mac OS

If you want to generate the Doxygen documentation when you build cppunit, there are a few other things that you may have to do during and after running configure. You have to tell the configuration script that you want to run Doxygen by including the --enable-doxygen and, optionally, the --enable-dot arguments. The real trick is if you have used the mountable disk images to install them. In that case, the binaries are buried in /Applications and probably aren't in your path. To get around this, modify the PATH environment variable when you run configure. On my machine, I have the Graphviz package installed using the disk image and compiled my own Doxygen so its in /usr/local/bin.

I use the following command line to configure everything:

PATH="$PATH:/usr/local/bin:/Applications/Graphviz.app/Contents/MacOS" \
CPPFLAGS="-arch ppc -arch i386 -gdwarf-2 -O2" \
./configure --enable-doxygen --enable-dot --enable-html-docs

After you configure everything, you will have to modify doc/Doxyfile if you don't have dot in your path. Find the line starting with DOT_PATH and change it to something like the following.

DOT_PATH = "/Applications/Graphviz.app/Contents/MacOS"

Now you can build everything including the documentation. Enjoy.


Mac OS Framework

To make usage of CppUnit in Xcode projects more convenient, I've created a Xcode project that builds a Carbon framework.

The project is based on CppUnit 1.12.0, made with Xcode 2.4 and builds universal binaries for Mac OS X 10.4 (Tiger). The limitation is that the graphical test runners are currently not supported, however this should be possible at least for the Qt test runner.

Info and download links are available at http://wbailer.wordpress.com/2007/08/27/mac-os-x-framework-for-cppunit

Tru64

Digital UNIX V4.0F Compaq C V6.3-129 (dtk)(Rev. 1229)

./configure CC='cxx -using_std -pthread -tweak -std strict_ansi' CXX='cxx -using_std -pthread -tweak -std strict_ansi' LD=CXX LDFLAGS=-lm --disable-shared

Microsoft Visual C++ .NET

Don't use UNIX build tools - load CppUnitLibraries.dsw instead.

------ Build started: Project: simple, Configuration: Debug Win32 ------

Linking...
Performing Post-Build Event...
ExampleTestCase::example : assertion
ExampleTestCase::anotherExample : assertion
ExampleTestCase::testAdd : assertion
ExampleTestCase::testDivideByZero : error
ExampleTestCase::testEquals : assertion
v:\shared\rsunit\cppunit-1.10.2\examples\simple\exampletestcase.cpp(7) : error : Assertion
Test name: ExampleTestCase::example
equality assertion failed
- Expected: 1
- Actual  : 1.1
v:\shared\rsunit\cppunit-1.10.2\examples\simple\exampletestcase.cpp(15) : error : Assertion
Test name: ExampleTestCase::anotherExample
assertion failed
- Expression: 1 == 2
v:\shared\rsunit\cppunit-1.10.2\examples\simple\exampletestcase.cpp(27) : error : Assertion
Test name: ExampleTestCase::testAdd
assertion failed
- Expression: result == 6.0
##Failure Location unknown## : Error
Test name: ExampleTestCase::testDivideByZero
uncaught exception of unknown type
v:\shared\rsunit\cppunit-1.10.2\examples\simple\exampletestcase.cpp(51) : error : Assertion
Test name: ExampleTestCase::testEquals
equality assertion failed
- Expected: 12
- Actual  : 13
Failures !!!
Run: 5   Failure total: 5   Failures: 4   Errors: 1
Project : error PRJ0019: A tool returned an error code from "Performing Post-Build Event..."

every time you compile. You can double click on the errors to have .NET take you directly to the test that failed.

Microsoft eMbedded Visual C++ v4 (eVC4)

Don't use UNIX build tools - load CppUnitLibraries.dsw instead.

Multiple errors when built with STLport v5.0RC2, eg. {{{_construct.h(119): error C2665: 'new': none of the 2 overloads can convert parameter 2 from type 'stlp_std::basic_string<char,stlp_std::char_traits<char>,stlp_std::> *'

r,stlp_std::char_traits<char>,stlp_std::> &)' being compiled}}}

Can anyone help on this?

Please post the full set of build errors: msevc_errors.txt

Visual Studio 2005 Express

Even using the Microsoft SDK not all the libraries are able to be built. Specifically the test runner won't build. I think this is mainly due to the fact that the SDK does not have some required MFC code. Note that the paid for version of Visual Studio 2005 does manage to build the libraries.

Microsoft Visual Studio 2005

In order to work in this IDE, two changes are needed, stated in the following subsections.

cppunit

The cppunit project requires a lib folder to exist at the same level as the src folder to build successfully. So make sure to manually create this folder if the cppunit project is build before any other projects of the solution.

Note #1: Other project(s) of the solution will create the lib folder when they are built so this is only a problem when the cppunit project is build first.

Note #2: I have discovered this problem with cppunit version 1.12.0 but I have not tried any other version(s).

TestRunner

To build it, change a line in file MsDevCallerListCtrl.cpp (of project TestRunner):

#import "libid:80cc9f66-e7d8-4ddd-85b6-d9e6cd0e93e2" version("7.0") lcid("0") raw_interfaces_only named_guids

Change the "7.0" to "8.0" so it should read as

#import "libid:80cc9f66-e7d8-4ddd-85b6-d9e6cd0e93e2" version("8.0") lcid("0") raw_interfaces_only named_guids

This imports "dte80a.olb" from "%common_files%\Microsoft Shared\MSEnv\dte80a.olb". (Obviously this changed from 7.0 to 8.0 between VS 2003 and VS 2005.)

DSPlugIn

Remove the project DSPlugIn as it is only needed for Visual Studio 6.0

Note on Source Location

With VS2005, if you dont have the source folder in a path without spaces, it will not build. So throw it on your C:\ drive or in a sub folder, but make sure there are no spaces in the path

Microsoft Visual Studio 2008 Standard

v1.12.0 Compiles and runs OK without modification.

However the release static library is 11.4Megs. ( in MSVS2003 it was about 3.5Megs, which seemed quite large enough! ) Anyone know how to reduce this?

The release static library is huge because of the "/Z7" compiler flag (C7 Compatible debug info). It appears to embed all debugging info right into the library (instead of in a .PDB or otherwise). If you change it to "/Zi" (Program Database), then the library size goes down to a more reasonable 2-4mb. -- Tim Green

WINCE 5.0 Pocket PC SDK

WINCE 5.0 STANDARD SDK

1. of course you need to install the SDK first. ( SDK can be downloaded from Microsoft's website ).

Needs some modification on the source file:

here are the patches apply to 1.10.2 and 1.11.6.

patch for 1.10.2: cppunit-1.10.2-wince.patch.bz2

patch for 1.11.6: cppunit-1.11.6-wince.patch.bz2 (need to add the same deploy argument as 1.10.2, you can refer to the 1.10.2's project setting

note: I've only tested the 'simple' app, it can be compiled, but can't run under the WINCE 5.0 Pocket PC Emulator or PB 5.0 emulator.

after applying those patches, you also need to modify some setting of the VS2005.

Choose the menu of the VS2005

Tools->Options
   Project and Solutions
     -> VC++ Directories
   choose the Platform as Windows Mobile 5.0 Pocket PC SDK
   choose Show directories for: Include files
   add your cppunit's include directory into the below list.
   for example:
   C:\cppunit-1.10.2\include
   or
   C:\cppunit-1.11.6\include

to test the 'simple' app, right click on the simple project, click Set as Startup Project, then you can deploy the program to the emulator.

Here is some error output from the IDE output window of VS2005.

Load module: simple.exe
Load module: msvcr80d.dll
Load module: coredll.dll.0409.mui
Load module: coredll.dll
Data Abort: Thread=96f66b30 Proc=814c6e30 'simple.exe'
AKY=00002001 PC=0042f34c(simple.exe+0x0041f34c) RA=00401fe4(simple.exe+0x003f1fe4) BVA=1c000004 FSR=00000407
Unhandled exception at 0x0042f34c in simple.exe: 0xC0000005: Access violation reading location 0x00000004.
The thread 0xb7cb1e3e has exited with code 0 (0x0).
Unload module: msvcr80d.dll
The program '[b6eca90e] simple.exe' has exited with code -1073741819 (0xc0000005).

This problem is caused by using a wrong entrypoint of the program

change the entry point according to the following map in the linker option of VS2005 will solve this problem:

      Your entrypoint         CRT entrypoint


      WinMain                    WinMainCRTStartup
      wWinMain                   wWinMainCRTStartup
      main                       mainACRTStartup
      wmain or _tmain            mainWCRTStartup
      DllMain                    _DllMainCRTStartup

But the simple.exe still can't run correctly.

The same situation occurs in the 1.11.6 version.

Linux ARM9, gcc 3.3.2 cross-compile hosted on Windows

Instructions for building for use with Linux on the ARM9 processor. Build environment is Cygwin and gcc 3.3.4 ARM cross-compile toolchain hosted on Windows.

bash-3.00$ cd ~/cppunit-1.12.0.        # directory containing source
bash-3.00$ source ~/setup_ARM.bash     # configure shell for ARM cross-compile
Configuring GCC toolchain for ARM
/opt/crosstool/gcc-3.3.4-glibc-2.3.2/arm-unknown-linux-gnu/bin
bash-3.00$ which gcc                   # validate cross-compile tools are active
/opt/crosstool/gcc-3.3.4-glibc-2.3.2/arm-unknown-linux-gnu/bin/gcc
bash-3.00$ make distclean              # clean and configure source tree
bash-3.00$ ./configure --build=i686-cygwin --host=arm-unknown-linux-gnu --disable-shared –-prefix=/opt/crosstool/gcc-3.3.4-glibc-2.3.2/arm-unknown-linux-gnu
bash-3.00$ make
bash-3.00$ make install

OpenSolaris 2008.05 Sun C++

./configure LDFLAGS="-lCstd -lCrun -lc -lm"
make
make install (as root)

BuildingCppUnit1 (last edited 2008-05-09 16:52:22 by c-3e2972d5)

SourceForge.net Logo