Board index FlightGear Support Compiling

Terragear compilation - Ubuntu 14.04  Topic is solved

Building FlightGear from source, and in the need for help?

Terragear compilation - Ubuntu 14.04  

Postby wkitty42 » Sat Jul 01, 2017 5:55 pm

some of us may still be running ubuntu's 14.04 LTS for various reasons... building flightgear from the repo is pretty easy with the download_and_compile.sh script... one thing, though, is that terragear won't build because 14.04 has an old GDAL library, v1.17.something, but we can work around that...

a year ago on 2016 Jul 16, the minimum version of GDAL was increased to v2.0.0 and the code was adapted to the new API... what those of us on ubuntu 14.04 have had to do was to reset our terragear to the previous commit before this one and terragear would compile just fine... the problems arose when other fixes were needed because of changes in flightgear and simgear... so here we are...

NOTE: you must have an existing terragear repo managed by the download_and_compile.sh script before doing all this!

what i did:
  1. get into our terragear repository
    Code: Select all
    cd ~/flightgear-dev/next/terragear

  2. make sure we're on the terragear scenery/ws2.0 branch
    Code: Select all
    git checkout scenery/ws2.0

  3. make sure we've done the reset
    Code: Select all
    git reset --hard 082ee9b82f15c8067183925a2ce48da817fa3748

  4. create and checkout a new branch for us to use
    Code: Select all
    git checkout -b oldgdal scenery/ws2.0

  5. now it is time to go cherry-picking
    Code: Select all
    git cherry-pick 0bb5df8d4d9e67a99b2afe27f53d90592ac97674
    git cherry-pick ac460f92259629d222aee2411319327c736fe967
    git cherry-pick 8f48b13f096e6bfe6245e3f000e82a8af09801e8
    git cherry-pick 73dff25ca1b20f975e967bfe9395a2729d4bbee7
    git cherry-pick 4c8455c0eeb65d0d30702ca48d540fed90376dd8
    git cherry-pick 1e32e9bccb64c6e0836f0bd1afb33221fa8976ec
    git cherry-pick cf5fcfc6c05d5e76918bb5c9e2d371a1e1d0fe3a
    git cherry-pick 95a34ae32abe60af89c2aace6bb28a65279d7e1c

    NOTE: if you've modified your download_and_compile.sh script to force the above mentioned reset we'll be commenting that out in the next step... if you mess up or otherwise reset in this branch, you have to cherry-pick again so don't do that! ;)

  6. we need to edit download_and_compile.sh to add another round of cmake when we reconfigure terragear... this has something to do with CGAL and resetting the CXX_FLAGS... to build terragear with the new simgear, we must add a flag to use "c++11"... this needs to be done when we configure which is where the CXX_FLAGS come into play so we'll kill two birds in this step... adding the flag and doing the double cmake round...

    1. load download_and_compile.sh into your editor...

    2. near the top, around line 53, you'll find these two lines
      Code: Select all
      SG_CMAKEARGS=""
      FG_CMAKEARGS=""

      add a new line to them so they look like this
      Code: Select all
      SG_CMAKEARGS=""
      FG_CMAKEARGS=""
      TG_CMAKEARGS="-DCMAKE_CXX_FLAGS=-std=c++11"

    3. go down to your terragear build section and edit it to look like this... there are 13 lines added...
      Code: Select all
      TG_INSTALL_DIR=terragear
      INSTALL_DIR_TG=$INSTALL_DIR/$TG_INSTALL_DIR
      cd "$CBD"
      if [[ "$(declare -p WHATTOBUILD)" =~ '['([0-9]+)']="TERRAGEAR"' ]]; then
        echo "****************************************" | tee -a $LOGFILE
        echo "*************** TERRAGEAR **************" | tee -a $LOGFILE
        echo "****************************************" | tee -a $LOGFILE

        mkdir -p "terragear"
        cd "$CBD"/terragear
        _gitDownload https://git.code.sf.net/p/flightgear/terragear
        _gitUpdate scenery/ws2.0
      #################################################################
      # remove the next line when the OS has updated to GDAL >= 2.0.0 #
      # OR we have worked around the problem of having an old GDAL    #
      #################################################################
      #git reset --hard 082ee9b82f15c8067183925a2ce48da817fa3748

        if [ "$RECONFIGURE" = "y" ]; then
          cd "$CBD"
          mkdir -p build/terragear
          cd "$CBD"/build/terragear
          rm -f CMakeCache.txt
          echo " ** 1st CMAKE execution" | tee -a $LOGFILE
          "$CMAKE" -DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
                -DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_DIR_TG" \
                -DCMAKE_PREFIX_PATH="$INSTALL_DIR_SIMGEAR;$INSTALL_DIR_CGAL" \
                $TG_CMAKEARGS \
                ../../terragear/ 2>&1 | tee -a $LOGFILE
          echo " ** 2nd CMAKE execution" | tee -a $LOGFILE
          "$CMAKE" -DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
                -DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_DIR_TG" \
                -DCMAKE_PREFIX_PATH="$INSTALL_DIR_SIMGEAR;$INSTALL_DIR_CGAL" \
                $TG_CMAKEARGS \
                ../../terragear/ 2>&1 | tee -a $LOGFILE
        fi

        _make terragear

        cd "$CBD"
        echo "#!/bin/sh" > run_tg-construct.sh
        echo "cd $(dirname $0)" >> run_tg-construct.sh
        echo "cd install/terragear/bin" >> run_tg-construct.sh
        echo "export LD_LIBRARY_PATH=$INSTALL_DIR_SIMGEAR/lib" >> run_tg-construct.sh
        echo "./tg-construct \$@" >> run_tg-construct.sh

        echo "#!/bin/sh" > run_ogr-decode.sh
        echo "cd $(dirname $0)" >> run_ogr-decode.sh
        echo "cd install/terragear/bin" >> run_ogr-decode.sh
        echo "export LD_LIBRARY_PATH=$INSTALL_DIR_SIMGEAR/lib" >> run_ogr-decode.sh
        echo "./ogr-decode \$@" >> run_ogr-decode.sh

        echo "#!/bin/sh" > run_genapts850.sh
        echo "cd $(dirname $0)" >> run_genapts850.sh
        echo "cd install/terragear/bin" >> run_genapts850.sh
        echo "export LD_LIBRARY_PATH=$INSTALL_DIR_SIMGEAR/lib" >> run_genapts850.sh
        echo "./genapts850 \$@" >> run_genapts850.sh
      fi
      _logSep

    4. save the changes and exit your editor.
  7. now we can FINALLY build terragear using the download_and_compile.sh script...
    the key, here, is to not download anything to update terragear... "-d n" prevents the terragear repo from being downloaded and/or updated... we'll have to manage updates manually for now...
    Code: Select all
    ~/path_to_your/download_and_compile.sh -p n -d n -j 1 TERRAGEAR

that should do it... when download_and_compile.sh finishes, you should have a nice shiny set of terragear tools that you can play with building scenery... remember, this uses your old GDAL v1.17 so none of the newer code specific to GDAL stuff will be able to be used... future updates to this terragear will also have to be cherry-picked or hand-written...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9123
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: Terragear compilation - Ubuntu 14.04

Postby Hooray » Sun Jul 02, 2017 5:59 pm

This is something that would probably be best added to the wiki so that people can more easily find your advice in the future ?
Apart from that, it may be a good idea to provide feedback to the people involved in maintaining TerraGear to hopefully make this easier some day.
Besides, at some point we tinkered with maintaining a VM image (based on debian/ubuntu) to actually come up with TG pre-included.



http://wiki.flightgear.org/TerraGear_sc ... ualization
Image

Originally, this was very promising - and maybe this is something that you'd be interested in getting involved in some day ?
The main thing missing is to document what needs to be done to support this and provide feedback to the upstream TG folks, to hopefully get the corresponding changes committed.

The long-term goal would be to have as much configuration stuff in git repositories using shell/cmake machinery, and possibly some kind of build server automation to simplify the whole process. That was the whole point of using virtualization in the first place - i.e. allowing non-developers to easily end up with a working TG setup, without having to be GIS or C++ experts ...
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Terragear compilation - Ubuntu 14.04

Postby wkitty42 » Sun Jul 02, 2017 6:26 pm

i'm pretty sure that one of the terragear folks knows... i had asked them for one of their patches when i realized i already had everything and simply needed to branch from the reset commit and then cherry-pick from there into the new branch...

as for adding it to the wiki, i honestly find things a lot easier in the forums than in any wiki i've ever used... wikis really need a table of contents like any encyclopedia has... ToC as well as an index... but yeah, i could copy and paste it to the wiki and change out some of the bbcode for wiki markup/down stuffs... anyone could, really...

VMs are cool... i use QEMU/KVM... i've never used virtual box or any other... if there's an easy way to convert between VM formats, i can see this as a GoodThing<tm>... part of the problem, though, is the loss of the server or two where some files were stored... i still have to go playing to see how things need to be done in terrageargui now since we cannot download like we used to do... i think it is the shape files but my brain is still asleep ;)
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9123
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: Terragear compilation - Ubuntu 14.04

Postby Hooray » Sun Jul 02, 2017 6:51 pm

Regarding the ToC, actually that can be created automatically by the wiki once you begin using the proper tags/wiki formatting, so I would not be too concerned about that.

Concerning conversion of VM containers, I think there is an increasing tendency to support some of the more standard formats in most VM solutions
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Terragear compilation - Ubuntu 14.04

Postby wkitty42 » Sun Jul 02, 2017 6:59 pm

wkitty42 wrote in Sun Jul 02, 2017 6:26 pm:but yeah, i could copy and paste it to the wiki and change out some of the bbcode for wiki markup/down stuffs...

this is done... exact same title as this topic...
yuck!
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9123
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04


Return to Compiling

Who is online

Users browsing this forum: No registered users and 2 guests