Building TerraGear in Ubuntu 910 (32- or 64-bit): Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
Line 4: Line 4:


==Basic Install==
==Basic Install==
Note: This is tested 2010-01-23 and work on
- Ubuntu910 32-bit
- and on OSX 10.5.8/DuoCore Intel with VBox 3.1.2r56127 (Box with Ubuntu 910)
1. Start with a clean (new) installation of Ubuntu 910 (this sample is with 64-bit, should work also with 32-bit). Do not Update the system after installation with package manager. Skip update (important!).
1. Start with a clean (new) installation of Ubuntu 910 (this sample is with 64-bit, should work also with 32-bit). Do not Update the system after installation with package manager. Skip update (important!).
''Start of some display options''
Optional A:
Make sure your video/graphics card is very well configured. I recommend NVidia or ATI chipsets (though NVidia is more thoroughly tested).<br>
a) Install enving to obtain the latest drivers and their dependencies.
        (optional) * sudo apt-get install envyng-gtk
b) In case of problem with the resolution (usually a bad one with 640*480), we must fix it.  We can do it with:
        (optional) * sudo displayconfig-gtk
Optional B (Virtualbox):
If you install Ubuntu in a VBox install the guest additions for display changes.
''End of some display options''


2. Install the basic packages for git access and development:
2. Install the basic packages for git access and development:
Line 95: Line 85:
         * sudo make install
         * sudo make install


10. Done, we are ready to use '''terragear'''.
10. Done, we are (ready) to use '''terragear'''.


==Optional steps==
==Optional steps==

Revision as of 02:29, 23 January 2010

Template:Languages

I try to update this article because old one produced a lot of compiling errors and pointed to wrong sources. I am starting to change it but please be patient its not finished yet.

Basic Install

Note: This is tested 2010-01-23 and work on - Ubuntu910 32-bit - and on OSX 10.5.8/DuoCore Intel with VBox 3.1.2r56127 (Box with Ubuntu 910)

1. Start with a clean (new) installation of Ubuntu 910 (this sample is with 64-bit, should work also with 32-bit). Do not Update the system after installation with package manager. Skip update (important!).

2. Install the basic packages for git access and development:

       * sudo apt-get install git-core curl automake g++ gcc

3. Make a new directory where you download and install the proper packages. You need also to prepare a directory "newmat11" to extract the archive you get from following link. gpc will extract in a directory itself.

4. Download the files inside the new created directory: newmat 11,gpc 2.32:

       * [http://www.robertnz.net/ftp/newmat11.tar.gz]
       * [ftp://ftp.cs.man.ac.uk/pub/toby/gpc/gpc232.zip]
       * git clone http://mapserver.flightgear.org/git/simgear-cs/
       * git clone http://mapserver.flightgear.org/git/terragear-cs/

5. Before proceed to compile the main packages, we must understand that terragear-cs depends from simgear-cs, and this last one has many dependencies to satisfy.

       * Install libplib-dev (1.8.5-4), libboost1.38-dev, glutg3-dev, libglut3-dev, libjpeg62-dev and xorg-dev via package manager

6. As previous step to compile simgear-cs, don't forget install the next packages:

       * sudo apt-get install libopenal-dev libalut-dev openscenegraph zlib1g-dev libopenscenegraph-dev

7. Goto to the directory simgear-cs to start the compilation. Remember that when we download source code with a cvs software as git or svn we need to

 generate the configure file:
       * ./autogen.sh
   The configure file is now created.
       * ./configure --with-jpeg-factory
       * make
       * sudo make install

8. To follow, we must satisfy 2 more dependencies: gpc and newmat. Unpackage those files and inside each directory:

   a) GPC:
       - Copy and paste the next lines and create a new empty file with the name "Makefile"
       - Replace "spaces" with tabs in your file and watch out for proper returns/end of line to get a working Makefile:
       
       
       # Unix/Linux makefile for GPC 2.32
       #
       # Riley Rainey  (riley.rainey@websimulations.com)
       CFLAGS = -O -g
       libgenpolyclip.a: gpc.o
               rm -f $@
               ar cr $@ $<
               ranlib $@
       clean:
               rm -f libgenpolyclip.a *.o core *~
       install: libgenpolyclip.a
               -mkdir -p /usr/local/lib
               -mkdir -p /usr/local/include
               install libgenpolyclip.a /usr/local/lib/libgenpolyclip.a
               install gpc.h /usr/local/include/gpc.h


       - Modify the file gpc.h, searching for "GPC_EPSILON (DBL_EPSILON)" and replace with "GPC_EPSILON (0.000001)"
       - And -obviously- make and sudo make install.... Done!!!
   b) NEWMAT:
       * make -f nm_gnu.mak
       * sudo cp libnewmat.a /usr/local/lib
       * sudo mkdir /usr/local/include/newmat
       * sudo cp *.h /usr/local/include/newmat
               

9. Finally and before proceed with the compilation of terragear-cs, we must satisfy some additional libraries:

       * sudo apt-get install libwxgtk2.8-dev libcurl4-openssl-dev
       * Option: If you want to use gdal/OGR-support in terragear-cs:
         sudo apt-get install libgdal-dev
         Go to terragear-cs folder: /src/Prep/OGRDecode and remove "-logdi" in Makefile (Line 102)
         Go to terragear-cs folder: /src/Utils/ and remove "-logdi" in Makefile (Line 118)
   After that, inside of the directory:
       * ./autogen.sh
       * ./configure
       * Option: With gdal/OGR support type ./configure --with-gdal=/usr/bin/gdal-config
       * make
       * sudo make install

10. Done, we are (ready) to use terragear.

Optional steps

13. If we wish use the photo command and insert images inside our scenery, we need the chop.pl command:

       * sudo gedit /usr/local/bin/chop.pl:
   Copy and paste the follow code:
               #!/usr/bin/perl
               die "Usage: $0 file xdiv ydiv res\n" if ( $#ARGV != 3 );
                   
               $file = shift @ARGV;
               $xdiv = shift @ARGV;
               $ydiv = shift @ARGV;
               $res = shift @ARGV;
               die "Must start with a .png file\n" if ( $file !~ m/\.png$/ );
               # extract image dimensions
               $info = `file $file`;
               $info =~ s/,//g;
               ($junk, $type, $junk, $junk, $width, $junk, $height, $junk)
                   = split(/\s+/, $info, 8);
               print "$width - $height\n";
               $basename = $file;
               $basename =~ s/\.png$//;
               # convert source image to pnm
               `pngtopnm $basename.png > $basename.pnm`;
               $dx = $width / $xdiv;
               $dy = $height / $ydiv;
               for ( $j = 0; $j < $ydiv; $j++ ) {
                   for ( $i = 0; $i < $xdiv; $i++ ) {
                       print "Paso $i $j\n";
                       $x = $dx * $i;
                       $y = $height - $dy * ($j + 1);
                       $outputpnm = sprintf("$basename%X%X.pnm", $i, $j);
                       $outputsgi = sprintf("$basename%X%X.sgi", $i, $j);
                       $outputrgb = sprintf("$basename%X%X.rgb", $i, $j);
                	printf "Diviendo archivos...\n";
                       printf "pnmcut $x $y $dx $dy $basename.pnm | pnmscale -xysize $res $res > $outputpnm\n";
                       `pnmcut $x $y $dx $dy $basename.pnm | pnmscale -xsize $res -ysize $res > $outputpnm`;
                       printf "Convirtiendo archivos...\n";
                       `convert $outputpnm $outputsgi`;
                       printf "Renombrando archivos...\n";
                       rename($outputsgi, $outputrgb);
                       unlink($outputpnm);
                   }
               }
   Save the file.
   Install those additional packages which allows image manipulation:
       * sudo apt-get install imagemagick netpbm

14. Install QGIS for scenery edit.

       * sudo gedit /etc/apt/source.list
   Add to the bottom:
               deb http://ppa.launchpad.net/qgis/ubuntu hardy main
   Don't forget:
       * sudo apt-get update
       * sudo apt-get install qgis qgis-plugin-grass