Chair for Computer Aided Medical Procedures & Augmented Reality
Lehrstuhl für Informatikanwendungen in der Medizin & Augmented Reality

THIS WEBPAGE IS DEPRECATED - please visit our new website

Back to main page.

A HOWTO for the compilation and installation of the Ubitrack library

This page contains useful instructions to compile and install the Ubitrack libraries to be used in VisualStudio


See also README.txt in checkout's top level folder for more recent requirements



  • Windows Platform SDK, required for the new DirectShowFrameGrabber Windows SDK for Windows Server 2008 and .NET Framework 3.5
  • LAPACK, required for most of the exciting math stuff.
    Note: For Win32, a compiled lapack version is supplied with this library.
  • OpenCV, for marker tracking and other vision stuff. If you do not like to compile the library by your own, use the compiled version OpenCV-2.1.0-win32-vs2008.exe.
  • FFmpeg, Unofficial windows binaries http://ffmpeg.arrozcru.org/builds
  • freeglut (for demo only)
  • libcurl, required for database client library
  • Sun Java SE Development Kit (JDK) 6, required for the Java bindings
  • SWIG, required for the Java bindings
  • Coin3D, 3D Rendering
  • GLEW provides efficient run-time mechanisms for determining which OpenGL extensions are supported on the target platform.
  • DSVideoLib (DirectShowVideoLibrary) A wrapper supporting concurrent access to framebuffers from multiple threads. Useful for developing applications that require live video input from a variety of capture devices (frame grabbers, IEEE-1394 DV camcorders, USB webcams).

Build Instructions

General Steps

  • Scons User and Installation Guide, if there are problems with the installation
  • scons command line options: scons OPENCV_PATH=XXX BOOST_PATH=XXX all install-all
  • scons remembers the command line options, so you don't have to write them again and again.
  • HINT: type scons --help to see command line options
  • HINT: type scons -h to see all (cached) variables
  • HINT: type scons --config=force to recheck the dependencies, not using the cached variables
  • HINT: Use the -k option to not stop on errors. All the rest then also gets compiled
  • HINT: Use the -j x option to use multiple processors, where x is the number of threads. if your computer has 2 processors set x to 4.
  • HINT: scons -c to clean the built, helpes sometimes with compilation problems.
  • HINT: deleting the .sconf_temp directory and the file .sconsign.dblite, will also help with some compilation problems.
  • In the file config.cache there are the cached scons command line options
  • HINT: type scons FORCE_MSVC_VERSION = '9.0' to force scons to use Visual Studio 9.0 (also works with other versions)
  • HINT: add different outputprefixes with the option PREFIX=XXX to seperate release and debug versions
  • HINT: to compile a debug version add the option RELEASE_BUILD=false otherwise set RELEASE_BUILD=true Combine this with the PREFIX option (see above). For example scons PREFIX=release RELEASE_BUILD=true and scons PREFIX=debug RELEASE_BUILD=false
  • HINT: use the option TARGET_ARCH="x86" to force 32-bit compilation or TARGET_ARCH="x86_64" to force the 64-bit compilation (windows only feature)
  • HINT: when using 'install-all' scons will install ubi in the directory specified in PREFIX otherwise it will be built in build/rls (build/dbg)
  • Check that everything works: scons test
  • Now look at the release/bin and release/lib folders (or debug/bin and debug/lib for the debug-version)
  • If the DirectShowFrameGrabber is needed, install the new Windows SDK for Windows Server 2008 and .NET Framework 3.5
  • To build the library, simply enter in the main directory:
  • Scons supports the following options:
    scons [BUILD_OPTION=value] ... [targets]
  • Currently we support the following targets:
    (none) build only the ubitrack library
    drivers build the drivers
    demos build demos
    vision build vision library and components
    dbclient build the database client library
    all build all libraries, drivers and demo applications
    install copy the library files to the directory given by PREFIX (see below)
    java-bindings build java wrapper
    install-drivers copy the drivers to the install directory
    install-vision install vision library and components
    install-dbclient install the database client library
    install-all copy libraries and drivers to install directory
    install-java-bindings install java wrapper
    test build and run unit tests
    vcproj create visual studio project files

  • The following build options are available. Enter scons -h in the top directory for more explanations and default values. You only need to set a build option once and its value will be remembered in config.cache until you specify a new value.
    PREFIX directory where the libraries will be installed.
    RELEASE_BUILD Builds an optimized verion when set to 'true'. Set to 'true' by default.
    TARGET_ARCH Flag for choosing 32 bit ("x86") or 64 bit ("x86_64") compilation. Set to "x86" by default.
    BOOST_PATH Path to the boost library
    BOOST_INCLUDE Path to the boost headers (overrides BOOST_PATH)
    BOOST_LIBS Path to the boost libraries (overrides BOOST_PATH)
    GLUT_PATH Path to the glut library (only for demo application)
    GLUT_INCLUDE Path to the glut headers (overrides GLUT_PATH)
    GLUT_LIBS Path to the glut libraries (overrides GLUT_PATH)
    GLEW_PATH Path to the glew library
    GLEW_INCLUDE Path to the glew headers (overrides GLEW_PATH)
    GLEW_LIBS Path to the glew libraries (overrides GLEW_PATH)
    OPENCV_PATH Path to the OpenCV library
    OPENCV_INCLUDE Path to the OpenCV headers (overrides OPENCV_PATH)
    OPENCV_LIBS Path to the OpenCV libraries (overrides OPENCV_PATH)
    CURL_PATH Path to the curl library
    CURL_INCLUDE Path to the curl headers (overrides CURL_PATH)
    CURL_LIBS Path to the curl libraries (overrides CURL_PATH)
    JAVA_HOME Path to default Sun Java SE Development Kit (Can also be specified as a normal system environment variable. Under most circumstances, the build system can derive this information automatically from the location of 'javac', so you should try without setting this variable, first. Under all circumstances, 'javac' has to be in the system path. This variable does not work on Mac since there is no default JDK, everything should work automatically there.)
    SWIGCOM Path to swig binary (should be detected automatically), e.g. SWIG_PATH=C:\MYSWIGPATH\swigwin.exe. ATTENTION: Since Scons 1.0, SWIG_PATH is deprecated
    SWIG_PATH Path to swig include directory (should be detected automatically)
    FAROSDK_PATH Path to the CmmSpecific?.h file within the FARO USB Arm 5 SDK
    INTERSENSESDK_PATH Path to the isense.h and isense.c file within the InterSense? SDK Directory
    DSVIDEOLIB_PATH Path to the sources of dsvideolib
    TISCH_PATH Path to the libtisch
    FORCE_MSVC_VERSION Forces scons to use a certain MS Visual Studio Version (e.g. FORCE_MSVC_VERSION=7.1)

  • To build files in and below a certain directory for which no explicit target exists, go to that directory and enter scons -U.
  • For example to build a release library and put the library files in the subdirectory release with the OpenCV directory C:\Programme\OpenCV and the Boost installed in C:\Programme\boost\boost_1_34_1 type:
    scons OPENCV_PATH=C:\Programme\OpenCV BOOST_PATH=C:\Programme\boost\boost_1_34_1 PREFIX=release RELEASE_BUILD=true all install-all
  • To build a debug version with the same OpenCV and Boost directories in the subdirectory debug type:
    scons OPENCV_PATH=C:\Programme\OpenCV BOOST_PATH=C:\Programme\boost\boost_1_34_1 PREFIX=debug RELEASE_BUILD=false all install-all
  • HINT: scons -c to clean the built, helpes sometimes with compilation problems
  • Check that everything works: scons test
  • Now look at the release/bin and release/lib folders (or debug/bin and debug/lib for the debug-version)

Some Hints for the Mac

  • Use MacPorts (http://trac.macosforge.org/projects/macports/wiki) to get a mac version of Scons, Boost and OpenCV. MacPorts somtimes s... so try to reinstall the (dependent) packages
  • To optional Java bindings, you also need swig and swig-java from MacPorts. You might have to announce this version to Scons by setting the SWIGPATH scons variable, e.g. by setting SWIGPATH = '/opt/local/bin/swig' in file config.cache in the Ubitrack build directory.
  • Edit Path analoge to: export DYLD_LIBRARY_PATH=~/SharedFolder/UNI/UbiTrack/lib:~/SharedFolder/UNI/UbiTrack/lib/ubitrack
  • If you use MacPorts and you have problems with the md5 module of python, try to install py25-hashlib
  • In case library checks fail, you might have to change the target platform. It is configured statically in the SConstruct file which resides in the Ubitrack base directory. Just grep for 'darwin'. For a 64 bit system, the 'x86_64' flag should be sufficent. If no platform flag is specified, scons will detect it automatically. Maybe, this should be the default way to handle this!

Checking that it works

Connect a video camera, print out doc/misc/Marker-Cube.pdf, go into the doc/utql directory and type

   utConsole ExampleRenderMarker.utql
A windows should appear with the camera image, showing a snowman overlaid on one of the markers.

Note: This only works if Ubitrack was compiled with OpenCV and Freeglut.

Configure VisualStudio

  • To use the new Windows Platform SDK libraries, you have to change the library and include directories in VisualStudio (remove old Platform-SDK-Directories):
    • In "Tools" -> "Options...", "Projects and Solutions" -> "VC++ Directories" remove the old Platform-SDK-Include-Directory "$(VCInstallDir)PlatformSDK\Include" and add to the "Include files" the path to your new Windows Platform SDK includes "C:\Programme\Microsoft SDKs\Windows\v6.1\Include"
    • In "Extra" -> "Options...", "Projects and " -> "VC++ Directories" remove the old Platform-SDK-Library-Directory "$(VCInstallDir)PlatformSDK\Lib" and add to the "Library files" the path to your new Windows Platform SDK libraries "C:\Programme\Microsoft SDKs\Windows\v6.1\Lib"
  • Go to the project properties
  • In "C/C++" -> "General": Add your Ubitrack include path C:\[...]\UbiTrack\src to the "Additional Include Directories"
  • In "Linker" -> "General": Add your Ubitrack library path C:\[...]\UbiTrack\release\lib to the "Additional Library Directories"
  • In "Linker" -> "Input": Add ubitrack.lib to the "Additional Dependencies"

Common Build Problems

Please see the Ubitrack FAQ? for many common compile problems.

Using the Visual Studio 2008

Install the latest Windows SDK (v6.1), otherwise it will not work.

When using the Visual Studio 2008 scons will eventually not find the include and libs of the compiler suite.

So you have to specify the following paths per hand

  • Include:
    • Visual Studio 2008 directory: C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\include
    • Windows SDK: C:\\Program Files\\Microsoft SDKs\\Windows\\v6.1\\include
    • atl header: C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\atlmfc\\include

  • Libs:
    • Visual Studio 2008 : C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\lib
    • Windows SDK: C:\\Program Files\\Microsoft SDKs\\Windows\\v6.1\\Lib
    • atl libs: C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\atlmfc\\lib

scons LIBS=C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\lib; <CR>
C:\\Program Files\\Microsoft SDKs\\Windows\\v6.1\\Lib;C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\atlmfc\\lib <CR>
INCLUDE =C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\include; C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\atlmfc\\include <CR>
c:\\Program Files\\Microsoft SDKs\\Windows\\v6.1\\Include

Compiling the DirectShowFrameGrabber

On some Windows Systems the DirectShowFrameGrabber might not compile without a trick. When it does not compile try:

LAPACK Problems on Linux

On some Linux distributions (e.g. Debian) you will see the following lines, which indicate that LAPACK was not found:
   Checking for dgesvd_() in C library lapack... no
   Checking for dgesvd() in C library lapack... no
First of all, make sure that the LAPACK and BLAS libraries are installed on your system. If this is the case, then most likely, the libraries have distribution-specific names. You can adapt them by changing the LAPACK_LIBS variable. E.g. on debian you might get lucky with the following setting:
   scons LAPACK_LIBS=lapack-3:blas-3

On Ubuntu 9.04, blas depends on libgfortran, which however only exists in terms of libgfortran.so.3. In this case, a symlink helps

   ln -s /usr/lib/libgfortran.so.3 /usr/lib/libgfortran.so

Library Problems on Linux

If the scons check for an installed library fails with the following lines
   Checking for glutInitWindowSize( 800, 600 ) in C++ library freeglut... no                          
   Checking for glutMainLoopEvent() in C++ library glut... no
although you are sure that it is installed properly and also that its path is configured properly (see build instructions above) then you might suffer from the following problem: Depending on the Linux distribution, libraries have slightly different names. E.g. on Ubuntu 8.10, there is no libGL.so but a libGL.so.1 symlink pointing to the actually installed library libGL.so.177.82 (depending on the nvidia driver version). This is just an example. scons, however, expects libraries to have the canonical name, libGL.so in this case. You might have to add a corresponding symlink manually. A look into the config/glut build script reveals that additional libraries libGL.so and libGLU.so are required on Linux:
   glut_options[ 'LIBS' ] = [ 'GLU', 'GL' ]
If they cannot be found by scons for the reason just described, then the check will fail without further notice. It is not sufficient that libglut.so and GL/freeglut.h are available in the configured paths, as suggested by the following lines of code, also from config/glut.
   elif conf.CheckLibWithHeader( "glut", "GL/freeglut.h", "C++", "glutMainLoopEvent();", 0 ):
       glut_options[ 'LIBS' ] = [ 'glut' ] + glut_options.get( 'LIBS', [] )
       have_freeglut = True

Boost Problems on 64-Bit Linux

Boost 1.35 for 64 bit systems contains a bug which leads to error messages similar to the following
g++ -o build/rls/src/Vision/Undistortion.os -c -pthread -Wall -O3 -fPIC "-DBOOST_UBLAS_BOUNDED_ARRAY_ALIGN=__attribute__ ((aligned (16)))" -DTIXML_USE_STL -I3rd/asio -I3rd/boost-bindings -I/usr/include/opencv -I3rd/tinyxml -I3rd/log4cpp/include -Isrc src/Vision/Undistortion.cpp
In file included from src/Ubitrack/Measurement/Measurement.h:37,
                 from src/Ubitrack/Util/CalibFile.h:39,
                 from src/Vision/Undistortion.cpp:32:
/usr/include/boost/serialization/vector.hpp:185: error: redefinition of 'struct boost::serialization::implementation_level<std::vector<long int, std::allocator<long int> > >'
/usr/include/boost/serialization/vector.hpp:185: error: previous definition of 'struct boost::serialization::implementation_level<std::vector<long int, std::allocator<long int> > >'
/usr/include/boost/serialization/vector.hpp:185: error: redefinition of 'struct boost::serialization::implementation_level<std::vector<long unsigned int, std::allocator<long unsigned int> > >'
/usr/include/boost/serialization/vector.hpp:185: error: previous definition of 'struct boost::serialization::implementation_level<std::vector<long unsigned int, std::allocator<long unsigned int> > >'
scons: *** [build/rls/src/Vision/Undistortion.os] Error 1
scons: building terminated because of errors.
Use boost >=1.36. See also http://bugs.gentoo.org/show_bug.cgi?id=231259.

Don't forget to install package libboost-math1.37-dev. At least on Ubuntu 9.04, its not installed automatically when requesting package libboost-1.37-dev.

Swig C# - Missing arrays_csharp.i

At least on Ubuntu 9.04 coming with swig 1.3, the typemap file arrays_charp.i is missing. Download it from here and copy it to your /usr/share/swig1.3/csharp/ directory.

This error also occurs on Max OSX 10.5 with and without mac ports. Copy the file to /usr/share/swig/<version>/csharp/ directory.

Linux (Ubuntu 12.04 LTS)

  • Install GCC etc: "apt-get install build-essential" (sollte abgefragt werden)
  • Install Scons: "apt-get install scons"
  • Install LAPACK library: "apt-get install liblapack-dev"
  • Install Boost: "apt-get install libboost1.46-all-dev"
  • Install OpenCV?: "apt-get install libopencv-dev"
  • Install Translation Package for libcv-dev: "apt-get install libcv-dev"
  • Install Parallelism lib: "apt-get install libtbb-dev"
  • Install FreeGLUT?: "apt-get install freeglut3-dev"
  • Install HighGUI? lib: "apt-get install libhighgui-dev" (lib muss noch in scons abgefragt werden)

  • create the file "config.cache" and add: ("lapack" als liboption in "modules/utcore/config/01lapack", "opencv_imgproc" als liboption in "modules/utvision/config/opencv", "glut" als liboption in "modules/utvisualization/config/glut")
    • LAPACK_LIBS="/usr/lib/lapack"

Edit | Attach | Refresh | Diffs | More | Revision r1.71 - 23 Apr 2013 - 16:58 - ChristianWaechter

Lehrstuhl für Computer Aided Medical Procedures & Augmented Reality    rss.gif