Monthly Archives: June 2012 - Page 2

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 ").
/src/osgPlugins/ffmpeg/FFmpegDecoder.cpp
- Add the following include in line 2:

#include 

- 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:

Install collada-dom library in Ubuntu 10.04, 10.11, 11.04, 11.10 and 12.04

I wanted to install collada-dom to add support for DAE files on OpenSceneGraph. I used the SVN from 2011/03/12 (I already had it downloaded and knew it worked fine). You can download the same code for that date with this commnad:

svn co -r {20110312} https://collada-dom.svn.sourceforge.net/svnroot/collada-dom/trunk collada-dom

The last trunk code in SVN repository fails to compile rt and fx projects and even does not work with OpenSceneGraph (looks like some types disapeared from Collada DOM and OpenSceneGraph plugin for DAE files expects them). Anyway if you want to try you can download running this command:

svn co https://collada-dom.svn.sourceforge.net/svnroot/collada-dom/trunk collada-dom

Install the following dependencies for Ubuntu 10.04:

sudo apt-get install libboost1.40-dev libpcre++-dev nvidia-cg-toolkit libboost-filesystem1.40-dev libglut3-dev

For Ubuntu 10.10 and 11.04 install those:

sudo apt-get install libboost1.42-dev libpcre++-dev nvidia-cg-toolkit libboost-filesystem1.42-dev libglut3-dev

And for Ubuntu 11.10 and 12.04 install those:

sudo apt-get install libboost1.46-dev libpcre++-dev nvidia-cg-toolkit libboost-filesystem1.46-dev freeglut3-dev

To compile execute, inside the collada-dom folder, those commands:

make os=linux project=minizip -C dom
make os=linux project=dom -C dom
make os=linux project=rt -C rt
make os=linux project=fx -C fx

We can now just copy the libraries and includes we need to “/usr/local/lib” and “/usr/local/include“:

sudo cp dom/build/linux-1.4/libminizip.* /usr/local/lib/
sudo cp dom/build/linux-1.4/libcollada14dom.* /usr/local/lib/
sudo cp -R dom/include /usr/local/include/colladadom
sudo cp rt/build/linux-1.4/libcollada14rt.* /usr/local/lib/
sudo cp fx/build/linux-1.4/libcollada14fx.* /usr/local/lib/

UPDATE: Fixed the compilation and installation process to bypass the problems with domTest and viewer. Also excluded rt and fx because they are not necessary. Ignore rest of the post.

But there have been some changes in the Boost library used in Ubuntu 12.04: the function native_file_string() has been deleted and we have to change “dom/test/1.4/domTest.cpp” file code on lines 91 and 95 to call c_str() instead of native_file_string(). So change this:

string lookupTestFile(const string& fileName) {
        return (dataPath() / fileName).native_file_string();
}

string getTmpFile(const string& fileName) {
        return (tmpPath() / fileName).native_file_string();
}

To this:

string lookupTestFile(const string& fileName) {
        return (dataPath() / fileName).c_str();
}

string getTmpFile(const string& fileName) {
        return (tmpPath() / fileName).c_str();
}

I got another error while compiling domTest complaining about not being able to locate a reference to libboost_system:

make[1]: Entering directory `/home/user/compilations/collada-dom/dom'
Linking build/linux-1.4/domTest
/usr/bin/ld: build/linux-1.4/obj/domTest.o: undefined reference to symbol 'boost::system::system_category()'
/usr/bin/ld: note: 'boost::system::system_category()' is defined in DSO /usr/lib/libboost_system.so.1.46.1 so try adding it to the linker command line
/usr/lib/libboost_system.so.1.46.1: could not read symbols: Invalid operation

I added -lboost_system -lboost_filesystem to the libOpts variable in “dom/make/common.mk” file (line 25) and it worked.

libOpts := -lboost_system -l boost_filesystem

I also had a similar error while compiling the “viewer” library, but we don’t need this.

  • Page 2 of 2
  • <
  • 1
  • 2