== Fedora build with cmake: == Author: David Burken Last modified: 08 May 2013 Feedback welcome. Please send to the ossim mailing list at "ossim-developer AT lists.sourceforge.net" and reference this page. Note: Unix commands start with $, anything else will be notes, comments. If you see a $ // The part after slash slash is a comment. '''Getting the packages you need with yum:'''[[BR]] It is necessary to pick up 3rd-party yum repositories. Do: {{{ sudo rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm sudo rpm -Uvh http://elgis.argeo.org/repos/6/elgis-release-6-6_0.noarch.rpm sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm sudo yum update }}} After doing a fresh desktop install of Fedora these are some packages I usually need: {{{ sudo yum install ant ant-contrib ant-manual aspell autogen automake autoconf boost boost-devel cmake cpptasks cppunit cppunit-devel cvs gcc-c++ byacc expat-devel fftw flex git subversion libjpeg-turbo-devel freetype freetype-devel fftw-devel java-1.6.0-openjdk-devel libcurl-devel libcurl libpng-devel libpng libtool libXmu libXmu-devel minizip-devel OpenThreads-devel podofo podofo-devel python-devel qt qt-devel swig thunderbird xemacs xemacs-common xemacs-info.noarch xemacs-packages-base.noarch xemacs-packages-extra-info.noarch xemacs-packages-extra.noarch yasm yasm-devel zlib-devel }}} '''Environment variables'''[[BR]] I put my build environment in a separate file that I source. I do this because I have more than one workspace, i.e. osgeo, geoeye, geoeye-dev. This is a snip from ossimrc-osgeo file:[[BR]] {{{ ### # File: ossimrc-osgeo ### ### # ANT ### ANT_HOME=/usr/share/ant ### # Java ### JAVA_HOME=/usr/lib/jvm/java dev=/work/osgeo OSSIM_DEPENDENCIES=${dev}/local OSSIM_DEV_HOME=${dev} OSSIM_HOME=${dev}/ossim OSSIM_INSTALL_PREFIX=${dev}/local OSSIM_PREFS_FILE=${HOME}/ossim-prefs-osgeo LD_LIBRARY_PATH=${OSSIM_DEV_HOME}/build/lib:${OSSIM_DEV_HOME}/ossim_qt/lib:${OSSIM_DEV_HOME}/openjpeg:${OSSIM_DEV_HOME}/Lidar_DSDK/lib:${OSSIM_DEV_HOME}/Raster_DSDK/lib:${OSSIM_DEV_HOME}/local/lib64:${OSSIM_DEV_HOME}/local/lib PATH=${HOME}/bin:${OSSIM_DEV_HOME}/build/bin:${OSSIM_DEV_HOME}/local/bin:${OSSIM_DEV_HOME}/openjpeg/codec:${dev}/kakadu/latest/bin/Linux-x86-64-gcc:${PATH}:/usr/sbin:/sbin export ANT_HOME JAVA_HOME LD_LIBRARY_PATH OSSIM_DEPENDENCIES OSSIM_DEV_HOME OSSIM_HOME OSSIM_INSTALL_PREFIX OSSIM_PREFS_FILE PATH ### # Set the title so we know we're running osgeo code.: ### PROMPT_COMMAND='echo -ne "\033]0;osgeo4: ${PWD}\007"' }}} '''Make a workspace:'''[[BR]] // Top level:[[BR]] $ mkdir /work/osgeo[[BR]] // ossim build dir:[[BR]] $ mkdir /work/osgeo/build[[BR]] // Sandbox for 3rd party dependencies:[[BR]] $mkdir /work/osgeo/local[[BR]] '''Building'''[[BR]] To build the osgeo side: I have files that I source. One for osgeo one for geoeye. So I can source one or the other and then build and test code. So in my bash start up scripts I start with no ossim stuff set. Since we're building osgeo I do: // cd to home[[BR]] $ cd Source my osgeo setup file. This sets OSSIM_HOME, OSSIM_PREFS_FILE and so on. File contents at end:[[BR]] $ . ossimrc-osgeo $ cd /work/osgeo // Make the directory(sandbox) for 3rd party dependencies:[[BR]] $ mkdir local First time through check out code. Note I don't like to check out the whole trunk so I do pieces. I always build geos, libtiff, geotiff, gdal from the latest. You don't have to, it's up to you. Most of these you can get from yum but I find the code is usually way behind. NOTE: Things I build with cmake I use an "out of source" build so I put in a sub directory of the package. '''geos:'''[[BR]] // Needed by ossim.[[BR]] $ mkdir /work/osgeo/geos[[BR]] $ cd !$ // last argument of last command[[BR]] $ svn co http://svn.osgeo.org/geos/trunk geos-svn[[BR]] $ cd geos-svn[[BR]] $ ./tools/svn_repo_revision.sh[[BR]] $ cd .. $ mkdir build // "out of source" build dir[[BR]] $ cd build[[BR]] // Make a cmake config script[[BR]] $ xemacs geos-cmake-config.sh // Use whatever editor you want, gedit, whatever...[[BR]] // Contents of script:[[BR]] {{{ #!/bin/sh # --- # File: geos-cmake-config.sh # --- build_dir="/work/osgeo"; cmake -G "Unix Makefiles" \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=${build_dir}/local \ -DCMAKE_MODULE_PATH=${build_dir}/geos/geos-svn/cmake/modules \ ../geos-svn }}} // Make the script executable:[[BR]] $ chmod 755 geos-cmake-config.sh // Run the cmake command to set up the build system:[[BR]] $ ./geos-cmake-config.sh // Make - note the "-j 4" is to use 4 threads.[[BR]] $ make -j 4 // Install to sandbox:[[BR]] $ make install // Note if your sandbox was on a system slice, i.e. /usr/local you would do: "sudo make install" // End of GEOS '''PROJ4:'''[[BR]] // Needed by libgeotiff, gdal... $ mkdir /work/osgeo/proj[[BR]] $ cd !$ // last argument of last command[[BR]] $ svn co http://svn.osgeo.org/metacrs/proj/trunk/proj proj-svn[[BR]] $ cd proj-svn[[BR]] // Make config script[[BR]] $ xemacs myprojconfig.sh // Use whatever editor you want, gedit, whatever...[[BR]] // Contents of script:[[BR]] {{{ #!/bin/sh prefix=/work/osgeo/local ./configure --prefix=$prefix }}} // Make the script executable:[[BR]] $ chmod 755 myprojconfig.sh // Run the config command to set up the build system:[[BR]] $ ./myprojconfig.sh // Make - note the "-j 4" is to use 4 threads.[[BR]] $ make -j 4 // Install to sandbox:[[BR]] $ make install // Note if your sandbox was on a system slice, i.e. /usr/local you would do: "sudo make install"[[BR]] $ cp src/projects.h /work/osgeo/local/include // End of PROJ4 '''libtiff:'''[[BR]] // Needed by OpenSceneGraph, libgeotiff, ossim, gdal...[[BR]] $ cd /work/osgeo[[BR]] $ cvs -d :pserver:cvsanon@cvs.maptools.org:/cvs/maptools/cvsroot co libtiff[[BR]] $ cd libtiff[[BR]] // Make a configure script[[BR]] $ xemacs mylibtiffconfig.sh [[BR]] // Contents of script:[[BR]] {{{ #!/bin/sh # File: mylibtiffconfig.sh prefix=/work/osgeo/local ./configure --prefix=$prefix }}} // Make the script executable:[[BR]] $ chmod 755 mylibtiffconfig.sh // Run the cmake command to set up the build system:[[BR]] $ ./mylibtiffconfig.sh // Make - note the "-j 4" is to use 4 threads.[[BR]] $ make -j 4 // Install to sandbox:[[BR]] $ make install // Note if your sandbox was on a system slice, i.e. /usr/local you would do: "sudo make install" // End of libtiff '''geotiff:'''[[BR]] // Needed by ossim, gdal...[[BR]] // At this point we will need ossim_package_support module so get it:[[BR]] $ cd /work/osgeo[[BR]] $ svn co http://svn.osgeo.org/ossim/trunk/ossim_package_support ossim_package_support $ mkdir /work/osgeo/geotiff[[BR]] $ cd !$[[BR]] $ svn co http://svn.osgeo.org/metacrs/geotiff/trunk/libgeotiff libgeotiff[[BR]] $ mkdir build // "out of source" build dir[[BR]] $ cd build[[BR]] // Make a cmake config script[[BR]] // Note my config tell libgeotif to use my libtiff NOT the system libtiff.[[BR]] $ xemacs libgeotiff-cmake-config.sh // Use whatever editor you want, gedit, whatever...[[BR]] // Contents of script:[[BR]] {{{ #!/bin/sh # File: libgeotiff-cmake-config.sh build_root=/work/osgeo install_root=/work/osgeo/local cmake -G "Unix Makefiles" \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INCLUDE_PATH=$install_root/include \ -DCMAKE_INSTALL_PREFIX=$install_root \ -DCMAKE_LIBRARY_PATH=$install_root/lib \ -DCMAKE_MODULE_PATH=$build_root/ossim_package_support/cmake/CMakeModules \ -DGEOTIFF_ENABLE_INCODE_EPSG=ON \ -DWITH_JPEG=ON \ -DWITH_PROJ4=ON \ -DWITH_TIFF=ON \ -DWITH_ZLIB=ON \ ../libgeotiff/ }}} // Make the script executable:[[BR]] $ chmod 755 libgeotiff-cmake-config.sh // Run the cmake command to set up the build system:[[BR]] $ ./libgeotiff-cmake-config.sh // Make - note the "-j 4" is to use 4 threads.[[BR]] $ make -j 4 // Install to sandbox:[[BR]] $ make install // Note if your sandbox was on a system slice, i.e. /usr/local you would do: "sudo make install" // End of geotiff '''OpenThreads:'''[[BR]] // ossim has an OpenThreads dependency. If you are building OpenSceneGraph for ossimplanet it is in there; else, get it from yum.[[BR]] $ sudo yum install OpenThreads-devel[[BR]] // End of OpenThreads '''OpenSceneGraph:'''[[BR]] // Needed by ossimplanet. Provide OpenThreads.[[BR]] $ cd /work/osgeo[[BR]] $ mkdir osg[[BR]] $ cd !$[[BR]] // Get OpenSceneGraph release and place here.[[BR]] $ unzip OpenSceneGraph-3.0.1.zip[[BR]] $ ln -s OpenSceneGraph-3.0.1 latest[[BR]] $ mkdir build[[BR]] $ cd !$ // Create cmake script. Contents of osg-cmake-config.sh[[BR]] {{{ #!/bin/sh # --- # File: osg-cmake-config.sh # --- build_root=/work/osgeo install_root=/work/osgeo/local cmake -G "Unix Makefiles" \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=$install_root \ -DCMAKE_MODULE_PATH=$build_root/osg/latest/CMakeModules \ ../latest }}} $ chmod 755 osg-cmake-config.sh[[BR]] $ ./osg-cmake-config.sh[[BR]] $ make -j 4[[BR]] $ make install[[BR]] // End of OpenSceneGraph '''kakadu:'''[[BR]] //---[[BR]] // Not required but nice to have. Can be used by both ossim and gdal.[[BR]] // Note you need jni.h and JAVA_HOME environment variable so that that the make picks it up.[[BR]] // jni.h is in openjdk-devel package mine is "java-1.6.0-openjdk-devel.x86_64"[[BR]] // To install do "sudo yum install java-1.6.0-openjdk-devel.x86_64" // JAVA_HOME is set to:[[BR]] // We now require Kakadu version 7.1.[[BR]] //--- {{{ $ env | grep JAVA JAVA_HOME=/usr/lib/jvm/java }}} $ mkdir kakadu[[BR]] // Copy your kakadu zip file.[[BR]] $ cd kakadu[[BR]] $ unzip v7_1-12345C.zip[[BR]] $ cd v7_1-12345C/make[[BR]] // Choose the make file that matches your build:[[BR]] $ make -f Makefile-Linux-x86-64-gcc[[BR]] // Make a link[[BR]] $ cd /work/osgeo/kakadu[[BR]] $ ln -s v7_1-12345C latest[[BR]] // Copy the libraries to our sandbox:[[BR]] // Note under /work/osgeo/kakadu/latest/lib there will be sub-directories for your build type.[[BR]] {{{ $ pwd[[BR]] /work/osgeo/kakadu/latest/lib/Linux-x86-64-gcc $ ls libkdu.a libkdu_a71R.so* libkdu_aux.a libkdu_jni.so* libkdu_v71R.so* $ cp *.so *.a /work/osgeo/local/lib }}} // End of kakadu '''gdal:'''[[BR]] $ cd /work/osgeo[[BR]] svn co http://svn.osgeo.org/gdal/trunk/gdal gdal[[BR]] $ cd gdal[[BR]] // Make a configure script[[BR]] $ xemacs mygdalconfig.sh [[BR]] // Contents of script:[[BR]] // Note the gdal configure can be quite lengthy. Edit as required.[[BR]] // This builds gdal with my libtiff and geotiff.[[BR]] // I had to remove "--with-geos" as their configure did not handle the "3.4.dev" version.[[BR]] {{{ #!/bin/sh # File: mygdalconfig.sh # Note: Python needed for QGIS. prefix=/work/osgeo/local ./configure --prefix=${prefix} --with-kakadu=/work/osgeo/kakadu/latest --with-libtiff=/work/osgeo/local --with-geotiff=/work/osgeo/local --with-mrsid=/work/drb/mrsid/Geo_DSDK-7.0.0.2167 --with-python }}} // Make the script executable:[[BR]] $ chmod 755 mygdalconfig.sh // Run the cmake command to set up the build system:[[BR]] $ ./mygdalconfig.sh // Make - note the "-j 4" is to use 4 threads.[[BR]] $ make -j 4 // Install to sandbox:[[BR]] $ make install // Note if your sandbox was on a system slice, i.e. /usr/local you would do: "sudo make install" // End of gdal '''ossim:'''[[BR]] // Note there's too much junk in the trunk so I usually pull individual modules: // Get the code. Edit script to pull what you want. Contents of svn-co-ossim.sh {{{ #!/bin/bash #--- # File: svn-co-ossim.sh # Relies on environment variable: OSSIM_DEV_HOME #--- if [ -z "$OSSIM_DEV_HOME" ]; then echo "OSSIM_DEV_HOME environment variable is not set! Exiting..." exit fi if [ -d "$OSSIM_DEV_HOME/libwms" ]; then echo "Updating libwms..." svn update $OSSIM_DEV_HOME/libwms else echo "svn co ossimwms..." svn co https://svn.osgeo.org/ossim/trunk/libwms $OSSIM_DEV_HOME/libwms fi if [ -d "$OSSIM_DEV_HOME/oms" ]; then echo "Updating oms..." svn update $OSSIM_DEV_HOME/oms else echo "svn co oms..." svn co https://svn.osgeo.org/ossim/trunk/oms $OSSIM_DEV_HOME/oms fi if [ -d "$OSSIM_DEV_HOME/ossim" ]; then echo "Updating ossim..." svn update $OSSIM_DEV_HOME/ossim else echo "svn co ossim..." svn co https://svn.osgeo.org/ossim/trunk/ossim $OSSIM_DEV_HOME/ossim fi if [ -d "$OSSIM_DEV_HOME/ossimGui" ]; then echo "Updating ossimGui..." svn update $OSSIM_DEV_HOME/ossimGui else echo "svn co ossimGui..." svn co https://svn.osgeo.org/ossim/trunk/ossimGui $OSSIM_DEV_HOME/ossimGui fi if [ -d "$OSSIM_DEV_HOME/ossimjni" ]; then echo "Updating ossimjni..." svn update $OSSIM_DEV_HOME/ossimjni else echo "svn co ossimjni..." svn co https://svn.osgeo.org/ossim/trunk/ossimjni $OSSIM_DEV_HOME/ossimjni fi if [ -d "$OSSIM_DEV_HOME/ossim_junkyard" ]; then echo "Updating ossim_junyard..." svn update $OSSIM_DEV_HOME/ossim_junkyard else echo "svn co ossimjunkyard..." svn co https://svn.osgeo.org/ossim/ossim_junkyard $OSSIM_DEV_HOME/ossim_junkyard fi if [ -d "$OSSIM_DEV_HOME/ossimPlanet" ]; then echo "Updating ossimPlanet..." svn update $OSSIM_DEV_HOME/ossimPlanet else echo "svn co ossimPlanet..." svn co https://svn.osgeo.org/ossim/trunk/ossimPlanet $OSSIM_DEV_HOME/ossimPlanet fi if [ -d "$OSSIM_DEV_HOME/ossimPlanetQt" ]; then echo "Updating ossimPlanetQt..." svn update $OSSIM_DEV_HOME/ossimPlanetQt else echo "svn co ossimPlanetQt..." svn co https://svn.osgeo.org/ossim/trunk/ossimPlanetQt $OSSIM_DEV_HOME/ossimPlanetQt fi if [ -d " $OSSIM_DEV_HOME/ossimPredator" ]; then echo "Updating ossimPredator..." svn update $OSSIM_DEV_HOME/ossimPredator else echo "svn co ossimPredator..." svn co https://svn.osgeo.org/ossim/trunk/ossimPredator $OSSIM_DEV_HOME/ossimPredator fi if [ -d "$OSSIM_DEV_HOME/ossim_package_support" ]; then echo "Updating ossim_package_support..." svn update $OSSIM_DEV_HOME/ossim_package_support else echo "svn co ossim_package_support..." svn co https://svn.osgeo.org/ossim/trunk/ossim_package_support $OSSIM_DEV_HOME/ossim_package_support fi if [ -d "$OSSIM_DEV_HOME/ossim_plugins" ]; then echo "Updating ossim_plugins..." svn update $OSSIM_DEV_HOME/ossim_plugins else echo "svn co ossim_plugins..." svn co https://svn.osgeo.org/ossim/trunk/ossim_plugins $OSSIM_DEV_HOME/ossim_plugins fi if [ -d "$OSSIM_DEV_HOME/ossim_qt4" ]; then echo "Updating ossim_qt4..." svn update $OSSIM_DEV_HOME/ossim_qt4 else echo "svn co ossim_qt4..." svn co https://svn.osgeo.org/ossim/trunk/ossim_qt4 $OSSIM_DEV_HOME/ossim_qt4 fi }}} $ svn-co-ossim.sh[[BR]] $ cd /work/osgeo[[BR]] $ mkdir build // "out of source" build dir[[BR]] $ cd build[[BR]] // Make a cmake config script[[BR]] $ xemacs ossim-cmake-config.sh // Use whatever editor you want, gedit, whatever...[[BR]] // Contents of script:[[BR]] {{{ #!/bin/sh # File: ossim-cmake-config.sh build_dir="/work/osgeo"; cmake -G "Unix Makefiles" \ -DBUILD_CSMAPI=OFF \ -DBUILD_LIBRARY_DIR=lib \ -DBUILD_OMS=ON \ -DBUILD_OSSIM=ON \ -DBUILD_OSSIM_PLUGIN=ON \ -DBUILD_OSSIMCONTRIB_PLUGIN=OFF \ -DBUILD_OSSIMCSM_PLUGIN=OFF \ -DBUILD_OSSIMGEOPDF_PLUGIN=ON \ -DBUILD_OSSIMGDAL_PLUGIN=ON \ -DBUILD_OSSIMHDF_PLUGIN=OFF \ -DBUILD_OSSIMKAKADU_PLUGIN=ON \ -DBUILD_OSSIMKMLSUPEROVERLAY_PLUGIN=ON \ -DBUILD_OSSIMLAS_PLUGIN=ON \ -DBUILD_OSSIMLIBLAS_PLUGIN=OFF \ -DBUILD_OSSIMLIBRAW_PLUGIN=ON \ -DBUILD_OSSIMMRSID_PLUGIN=ON \ -DBUILD_OSSIMNDF_PLUGIN=ON \ -DBUILD_OSSIMNUI_PLUGIN=OFF \ -DBUILD_OSSIMOPENJPEG_PLUGIN=OFF \ -DBUILD_OSSIMPNG_PLUGIN=ON \ -DBUILD_OSSIMREGISTRATION_PLUGIN=ON \ -DBUILD_OSSIMQT4=ON \ -DBUILD_OSSIMGUI=ON \ -DBUILD_OSSIM_MPI_SUPPORT=OFF \ -DBUILD_OSSIMPLANET=OFF \ -DBUILD_OSSIMPLANETQT=OFF \ -DBUILD_OSSIMPREDATOR=ON \ -DBUILD_OSSIM_TEST_APPS=ON \ -DBUILD_RUNTIME_DIR=bin \ -DBUILD_SHARED_LIBS=ON \ -DBUILD_WMS=ON \ -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_INCLUDE_PATH=${build_dir}/local/include \ -DCMAKE_INSTALL_PREFIX=${build_dir}/local \ -DCMAKE_LIBRARY_PATH=${build_dir}/local/lib \ -DCMAKE_MODULE_PATH=${build_dir}/ossim_package_support/cmake/CMakeModules \ -DKAKADU_ROOT_SRC=/work/drb/kakadu/latest \ -DKAKADU_AUX_LIBRARY=${build_dir}/local/lib64/libkdu_a64R.so \ -DKAKADU_LIBRARY=${build_dir}/local/lib64/libkdu_v64R.so \ -DMRSID_DIR=${build_dir}/mrsid \ -DOSSIM_BUILD_ADDITIONAL_DIRECTORIES="${build_dir}/ossimjni" \ -DOSSIM_COMPILE_WITH_FULL_WARNING=ON \ -DOSSIM_DEPENDENCIES=${build_dir}/local \ -DOSSIM_DEV_HOME=${build_dir} \ -DOSSIM_INSTALL_PLUGINS_WITH_VERSION=OFF \ -DOSSIM_LIBRARIES=${build_dir}/build/lib/libossim.so \ -DOSSIM_PLUGIN_LINK_TYPE=MODULE \ -DOSSIMPLANET_ENABLE_EPHEMERIS=ON \ ../ossim_package_support/cmake/ }}} // Make the script executable:[[BR]] $ chmod 755 ossim-cmake-config.sh // Run the cmake command to set up the build system:[[BR]] $ ./ossim-cmake-config.sh // Make - note the "-j 4" is to use 4 threads.[[BR]] $ make -j 4 //---[[BR]] // I usually do not do a make install on mine because I develop out of it.[[BR]] //---[[BR]] // End of ossim // That's it!!! //---[[BR]] If everything built and your environment is set up correct, i.e. PATH and LD_LIBRARY_PATH you should have all the libtiff, geotiff, gdal, and ossim applications including: "imagelinker", "iview", "ossim-geocell".