wiki:DavesFedoraCmakeBuildNotes

Version 22 (modified by dburken, 12 years ago) ( diff )

--

This is how I do it:

NOT COMPLETE! Coming soon…

Note: Unix commands start with $, anything else will be notes, comments. If you see a $ <some_command> The part after slash slash is a comment.

Getting the packages you need with yum:

After doing a fresh desktop install of Fedora these are some packages I usually need:

sudo yum install ant ant-contrib ant-manual autogen automake autoconf boost boost-devel cmake 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 podofo podofo-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

Make a workspace:

I have several workspaces under /work

/work/osgeo
/work/geoeye
/work/drb

Building

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 test code. So in my bash start up scripts I start with no ossim stuff set. Since we're building osgeo I do:

$ cd cd to home

Source my osgeo setup file. This sets OSSIM_HOME, OSSIM_PREFS_FILE and so on. File contents at end: $ . ossimrc-osgeo

$ cd /work/osgeo

Make the directory(sandbox) for 3rd party dependencies:
$ 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:
$ mkdir /work/osgeo/geos
$ cd !$ last argument of last command
$ svn co http://svn.osgeo.org/geos/trunk geos-svn
$ mkdir build
"out of source" build dir
$ cd build
Make a cmake config script
$ xemacs geos-cmake-config.sh
Use whatever editor you want, gedit, whatever...
Contents of script:

#!/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:
$ chmod 755 geos-cmake-config.sh

Run the cmake command to set up the build system:
$ ./geos-cmake-config.sh

Make - note the "-j 4" is to use 4 threads.
$ make -j 4

Install to sandbox:
$ make install
Note if your sandbox was on a system slice, i.e. /usr/local you would do: "sudo make install"

End of GEOS

libtiff:
$ cd /work/osgeo
$ cvs -d :pserver:cvsanon@cvs.maptools.org:/cvs/maptools/cvsroot co libtiff
$ cd libtiff
Make a configure script
$ xemacs mylibtiffconfig.sh
Contents of script:

#!/bin/sh

# File: mylibtiffconfig.sh
prefix=/work/osgeo/local

./configure --prefix=${prefix}

Make the script executable:
$ chmod 755 mylibtiffconfig.sh

Run the cmake command to set up the build system:
$ ./mylibtiffconfig.sh

Make - note the "-j 4" is to use 4 threads.
$ make -j 4

Install to sandbox:
$ 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:

At this point we will need ossim_package_support module so get it:
$ cd /work/osgeo
$ svn co http://svn.osgeo.org/ossim/trunk/ossim_package_support ossim_package_support

$ mkdir /work/osgeo/geotiff
$ cd !$
$ svn co http://svn.osgeo.org/metacrs/geotiff/trunk/libgeotiff libgeotiff
$ mkdir build "out of source" build dir
$ cd build
Make a cmake config script
Note my config tell libgeotif to use my libtiff NOT the system libtiff.
$ xemacs libgeotiff-cmake-config.sh
Use whatever editor you want, gedit, whatever...
Contents of script:

#!/bin/sh

# File: libgeotiff-cmake-config.sh

build_dir="/work/osgeo";

cmake -G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Release \
-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 \
-DGEOTIFF_ENABLE_INCODE_EPSG=ON \
-DWITH_JPEG=ON \
-DWITH_PROJ4=ON \
-DWITH_TIFF=ON \
-DWITH_ZLIB=ON \
../libgeotiff/

Make the script executable:
$ chmod 755 libgeotiff-cmake-config.sh

Run the cmake command to set up the build system:
$ ./libgeotiff-cmake-config.sh

Make - note the "-j 4" is to use 4 threads.
$ make -j 4

Install to sandbox:
$ make install
Note if your sandbox was on a system slice, i.e. /usr/local you would do: "sudo make install"

End of geotiff

kakadu:
---
Not required but nice to have. Can be used by both ossim and gdal.
Note you need jni.h and JAVA_HOME environment variable so that that the make picks it up.
jni.h is in openjdk-devel package mine is "java-1.6.0-openjdk-devel.x86_64"
To install do "sudo yum install java-1.6.0-openjdk-devel.x86_64" JAVA_HOME is set to:
---

$ env | grep JAVA
JAVA_HOME=/usr/lib/jvm/java

$ mkdir kakadu
Copy your kakadu zip file.
$ cd kakadu
$ unzip v6_4-00367C.zip
$ cd v6_4-00367C/make
Choose the make file that matches your build:
$ make -f Makefile-Linux-x86-64-gcc
Make a link $ cd /work/osgeo/kakadu $ ln -s v6_4-00367C latest End of kakadu

gdal:
$ cd /work/osgeo
svn co http://svn.osgeo.org/gdal/trunk/gdal gdal
$ cd gdal
Make a configure script
$ xemacs mygdalconfig.sh
Contents of script:
Note the gdal configure can be quite lengthy. Edit as required. This builds gdal with my libtiff and geotiff

#!/bin/sh

# File: mygdalconfig.sh
# Note: Python needed for QGIS.

prefix=/work/osgeo/local

./configure --prefix=${prefix} --with-kakadu=/work/drb/kakadu/latest --with-geos=/work/osgeo/local/bin/geos-config --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:
$ chmod 755 mygdalconfig.sh

Run the cmake command to set up the build system:
$ ./mygdalconfig.sh

Make - note the "-j 4" is to use 4 threads.
$ make -j 4

Install to sandbox:
$ 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

Note: See TracWiki for help on using the wiki.