Install OpenSceneGraph 2.8.3 with Collada support in Ubuntu 12.04

We are going to install OpenSceneGraph 2.8.3 (for now on OSG) to use it with osgART 2.0 RC3. As far as i know the last version of OSG that works with osgART is version 2.9.6 (following versions fail to draw the background video feed from the camera UPDATE: I found the solution to this error, read more in this post), but I recommend installing the 2.8.3 version. Download it from here and uncompress it.

Install those dependencies:

sudo apt-get install cmake cmake-curses-gui libopenal-dev libopenal1 libcurl4-openssl-dev libpoppler-dev libpoppler-glib-dev librsvg2-dev libgtkglext1 libgtkglext1-dev libgtkglextmm-x11-1.2-0 libgtkglextmm-x11-1.2-dev libwxgtk2.8-dev libopenthreads-dev libtiff4-dev libinventor0 inventor-dev libgif-dev libgif4 libjasper-dev libjasper1 libopenexr-dev libopenexr6 libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev libswscale-dev libavdevice53 libavcodec53 libavformat53 libavutil51 libswscale2 gstreamer0.10-ffmpeg ffmpeg libxine-dev libquicktime-dev winff dvdrip libavbin-dev libavbin0 libavifile-0.7c2 ffmpeg-dbg ffmpeg libavcodec-dev libavfilter-dev libxine1-ffmpeg moc-ffmpeg-plugin ffmpeg-dbg gstreamer0.10-fluendo-mp3 gstreamer0.10-plugins-bad gstreamer0.10-plugins-ugly libavbin-dev libavbin0 libavfilter-dev libavifile-0.7c2 libbabl-0.0-0 libcdaudio1 libmpeg2-4 libmpcdec6 libmp3lame0 libquicktime2 libxine1 libxine1-console libxine1-ffmpeg libxine1-misc-plugins libxine1-x moc-ffmpeg-plugin moc mjpegtools ogmtools xine-ui winff dvdrip libavbin-dev libavbin0 libavifile-0.7c2 ffmpeg-dbg ffmpeg-dbg ffmpeg libavcodec-dev libavfilter-dev libxine1-ffmpeg moc-ffmpeg-plugin

Install collada-dom as I explained in “Install collada-dom library in Ubuntu 10.04, 10.11, 11.04, 11.10 and 12.04“.

Some libraries that OSG depends on have changed so we need to change some of its source:

/src/osgPlugins/curl/ReaderWriterCURL.cpp
– Remove line 24 (#include <curl/types.h>").
/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp
– Add the following include in line 2:

#include <libavutil/mathematics.h>

– Change CODEC_TYPE_AUDIO with AVMEDIA_TYPE_AUDIO on line 220.
– Change CODEC_TYPE_VIDEO with AVMEDIA_TYPE_VIDEO on line 238.
– Replace the content from lines 84 to 96 (a switch statement) with:

error_str = AVERROR(error);

/src/osgPlugins/ffmpeg/FFmpegHeaders.hpp
– Add the following define bellow “#define __STDC_CONSTANT_MACROS“:

#define FF_API_OLD_SAMPLE_FMT 0

If you want to install OSG 2.9.6 add this changes to the source code too.

Now you can go inside your OSG 2.8.3 source code folder and run:

mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-D__STDC_CONSTANT_MACROS
make
sudo make install

I added “-DCMAKE_CXX_FLAGS=-D__STDC_CONSTANT_MACROS” on cmake command to fix an error with UINT64_C definition. You can add “-DBUILD_OSG_EXAMPLES=1” to compile the examples (will be installed in “/usr/local/share/OpenSceneGraph/bin/“). If you do so download OpenSceneGraph-Data files too:

sudo svn checkout http://www.openscenegraph.org/svn/osg/OpenSceneGraph-Data/tags/OpenSceneGraph-Data-2.8.0/ /usr/local/share/OpenSceneGraph/OpenSceneGraph-Data

If you want to be sure that cmake finded the libraries from Collada, execute ccmake .. and verify that Collada library options are filled correctly:

COLLADA_BOOST_FILESYSTEM_LIBRA   /usr/lib/libboost_filesystem.so              
COLLADA_BOOST_FILESYSTEM_LIBRA   COLLADA_BOOST_FILESYSTEM_LIBRARY_DEBUG-NOTFOU
COLLADA_BOOST_SYSTEM_LIBRARY     /usr/lib/libboost_system.so                  
COLLADA_BOOST_SYSTEM_LIBRARY_D   COLLADA_BOOST_SYSTEM_LIBRARY_DEBUG-NOTFOUND  
COLLADA_DOM_ROOT                 /dom                                         
COLLADA_DYNAMIC_LIBRARY          /usr/local/lib/libcollada14dom.so            
COLLADA_DYNAMIC_LIBRARY_DEBUG    COLLADA_DYNAMIC_LIBRARY_DEBUG-NOTFOUND       
COLLADA_INCLUDE_DIR              /usr/local/include/colladadom                 
COLLADA_MINIZIP_LIBRARY          /usr/local/lib/libminizip.so                 
COLLADA_MINIZIP_LIBRARY_DEBUG    COLLADA_MINIZIP_LIBRARY_DEBUG-NOTFOUND       
COLLADA_PCRECPP_LIBRARY          /usr/lib/i386-linux-gnu/libpcrecpp.so        
COLLADA_PCRECPP_LIBRARY_DEBUG    COLLADA_PCRECPP_LIBRARY_DEBUG-NOTFOUND       
COLLADA_PCRE_LIBRARY             /usr/lib/i386-linux-gnu/libpcre.so           
COLLADA_PCRE_LIBRARY_DEBUG       COLLADA_PCRE_LIBRARY_DEBUG-NOTFOUND          
COLLADA_STATIC_LIBRARY           COLLADA_STATIC_LIBRARY-NOTFOUND              
COLLADA_STATIC_LIBRARY_DEBUG     COLLADA_STATIC_LIBRARY_DEBUG-NOTFOUND 

When you finish compiling and installing OSG you should have a file called “osgdb_dae.so” in your OSG plugins folder (“/usr/local/lib/osgPlugins-2.8.3“). If you don’t have it verify you installed correctly the collada-dom library and that OSG is configured to use it.

Add the /usr/local/lib and /usr/local/lib/osgPlugins-2.8.3 library folders to the LD_LIBRARY_PATH variable on ~/.bashrc or ~/.profile:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/lib/osgPlugins-2.8.3

If you downloaded the OpenSceneGraph-Data files add the following too:

export OSG_FILE_PATH=/usr/local/share/OpenSceneGraph/OpenSceneGraph-Data

You can test if OSG work correctly by executing one of the examples (if you compiled them of course):

/usr/local/share/OpenSceneGraph/bin/osglogo

You should see something like this:

You might also like

Install OpenSceneGraph 2.9.6 with Collada support in Ubuntu 12.04
Although I usually install OpenSceneGraph 2.8.3 to work with osgART 2.0 RC3 it is also posible to use...

Install OpenSceneGraph 2.9.6 with Collada support in Ubuntu 12.04
Although I usually install OpenSceneGraph 2.8.3 to work with osgART 2.0 RC3 it is also posible to use...

Install osgART 2.0 RC3 with OpenSceneGraph 2.8.3 or 2.9.6 with Collada support in Ubuntu 12.04
Before installing osgART we need to install ARToolKit, collada-dom and OpenSceneGraph so look at those...

Install osgART 2.0 RC3 with OpenSceneGraph 2.8.3 or 2.9.6 with Collada support in Ubuntu 12.04
Before installing osgART we need to install ARToolKit, collada-dom and OpenSceneGraph so look at those...

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.