Hi fellow wiki editors!

To help newly registered users get more familiar with the wiki (and maybe older users too) there is now a {{Welcome to the wiki}} template. Have a look at it and feel free to add it to new users discussion pages (and perhaps your own).

I have tried to keep the template short, but meaningful. /Johan G

Difference between revisions of "Terragear compilation - Ubuntu 14.04"

From FlightGear wiki
Jump to: navigation, search
(initial copy'n'paste from my forum topic of the same title.)
 
(How to proceed)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
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...
+
== Motivation ==
 +
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... <ref>{{cite web
 +
  |url    =  https://forum.flightgear.org/viewtopic.php?p=313522#p313522
 +
  |title  =  <nowiki> Terragear compilation - Ubuntu 14.04 </nowiki>
 +
  |author =  <nowiki> wkitty42 </nowiki>
 +
  |date  =  Jul 1st, 2017
 +
  |added  =  Jul 1st, 2017
 +
  |script_version = 0.40
 +
  }}</ref>
  
 +
 +
== Background ==
 
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...
 
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...
  
 +
 +
== How to proceed ==
 
'''NOTE: you must have an existing terragear repo managed by the download_and_compile.sh script before doing all this!'''
 
'''NOTE: you must have an existing terragear repo managed by the download_and_compile.sh script before doing all this!'''
  
Line 8: Line 20:
  
 
1. get into our terragear repository
 
1. get into our terragear repository
 +
<syntaxhighlight lang="bash">
 
   cd ~/flightgear-dev/next/terragear
 
   cd ~/flightgear-dev/next/terragear
 +
</syntaxhighlight>
  
 
2. make sure we're on the terragear scenery/ws2.0 branch
 
2. make sure we're on the terragear scenery/ws2.0 branch
 +
<syntaxhighlight lang="bash">
 
   git checkout scenery/ws2.0
 
   git checkout scenery/ws2.0
 +
</syntaxhighlight>
  
 
3. make sure we've done the reset
 
3. make sure we've done the reset
 +
 +
<syntaxhighlight lang="bash">
 
   git reset --hard 082ee9b82f15c8067183925a2ce48da817fa3748
 
   git reset --hard 082ee9b82f15c8067183925a2ce48da817fa3748
 +
</syntaxhighlight>
  
 
4. create and checkout a new branch for us to use
 
4. create and checkout a new branch for us to use
 +
<syntaxhighlight lang="bash">
 
   git checkout -b oldgdal scenery/ws2.0
 
   git checkout -b oldgdal scenery/ws2.0
 +
</syntaxhighlight>
  
 
5. now it is time to go cherry-picking
 
5. now it is time to go cherry-picking
 +
<syntaxhighlight lang="bash">
 
   git cherry-pick 0bb5df8d4d9e67a99b2afe27f53d90592ac97674
 
   git cherry-pick 0bb5df8d4d9e67a99b2afe27f53d90592ac97674
 
   git cherry-pick ac460f92259629d222aee2411319327c736fe967
 
   git cherry-pick ac460f92259629d222aee2411319327c736fe967
Line 28: Line 50:
 
   git cherry-pick cf5fcfc6c05d5e76918bb5c9e2d371a1e1d0fe3a
 
   git cherry-pick cf5fcfc6c05d5e76918bb5c9e2d371a1e1d0fe3a
 
   git cherry-pick 95a34ae32abe60af89c2aace6bb28a65279d7e1c
 
   git cherry-pick 95a34ae32abe60af89c2aace6bb28a65279d7e1c
 +
</syntaxhighlight>
  
 
'''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!''' ;)
 
'''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!''' ;)
Line 111: Line 134:
  
 
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...
 
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...
 +
 +
== References ==
 +
{{Appendix}}

Latest revision as of 13:20, 2 July 2017

Motivation

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... [1]


Background

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


How to proceed

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

  cd ~/flightgear-dev/next/terragear

2. make sure we're on the terragear scenery/ws2.0 branch

  git checkout scenery/ws2.0

3. make sure we've done the reset

  git reset --hard 082ee9b82f15c8067183925a2ce48da817fa3748

4. create and checkout a new branch for us to use

  git checkout -b oldgdal scenery/ws2.0

5. now it is time to go cherry-picking

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

7. load download_and_compile.sh into your editor...

7a. near the top, around line 53, you'll find these two lines

 SG_CMAKEARGS=""
 FG_CMAKEARGS=""

add a new line to them so they look like this

 SG_CMAKEARGS=""
 FG_CMAKEARGS=""
 TG_CMAKEARGS="-DCMAKE_CXX_FLAGS=-std=c++11"

7b. go down to your terragear build section and edit it to look like this... there are 13 lines added...

 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

7c. save the changes and exit your editor.

8. 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...

 ~/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...

References

References
  1. wkitty42  (Jul 1st, 2017).  Terragear compilation - Ubuntu 14.04 .