User:Puffergas

From FlightGear wiki
Revision as of 20:06, 6 August 2020 by Puffergas (Talk | contribs) (SD Card)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Copy Path(s)

Easy way to copy the path of a file or folder.

During the compiling process there will be times when the path of a file or folder is needed for a Terminal command. One easy GUI short cut is to right click on the file or folder to pull up an option list. Find the option 'Copy Path(s)' and click on it. The path of the file or folder will be copied. Next, in the Terminal, click on 'Edit' at the top of the Terminal window and then click on 'Paste' in order to past the link into the Terminal. See the screen shot to the left.

Location of Files

The SD card performs well for common computer tasks and running FlightGear. However, compiling large programs could wear out the SD card before it's time. This is an excellent application for a SSD drive. Especially if many compiled versions of FlightGear are planned. For that reason this Wiki will choose to compile and install FlightGear on a SSD drive.

This is a good time to create some needed folders on the SSD. For this Wiki the folder FlightGear was created in the root of the SSD. Within this newly created folder FlightGear, create two more folders named fg-install and source. Use your favorite method to navigate and create folders, whether it be the Terminal or GUI. Furthuremore, these files can have other names as long as those other names are globally used.

Build Order

wkitty42 wrote:

"The download_and_compile.sh builds in this order:

PLIB, OSG, SimGear, FlightGear

It updates fgdata between the building of SimGear and FlightGear so that the translations tool can be handled properly..."

Patching; OSG patch example

There could come a time when the source needs to be patched before compiling. In this case the patch command can be used along with it's argument -p. For example; the OpenSceneGraph-3.4.0 requires the '0007-Explicit-signed-char-type-for-portability-base64.patch' patch, in order for it to compile for the ARM architecture.

In this example, the patch can be found at this link: OpenSceneGraph-3-4-0 patch. The download link for '0007-Explicit-signed-char-type-for-portability-base64.patch' is what we are looking for. This file can be downloaded with the wget command as seen below:

wget --trust-server-names https://sources.debian.org/src/openscenegraph-3.4/3.4.1+dfsg1-5/src/osgPlugins/osgjs/Base64.cpp/

Place, the above patch file, into the the source root folder of OpenSceneGraph-3-4-0.

The argument ,-p adjusts the path of the patch. Below is an example of a snippet from a patch. Reference the line ,--- openscenegraph-3.4.orig/src/osgDB/ConvertBase64.cpp. The folder openscenegraph-3.4.orig/ can not be used, in our example. In this case, one of the path folders need to be ignored, hence -p1. If two path folders needed to be ignored; -p2.

Index: openscenegraph-3.4/src/osgDB/ConvertBase64.cpp
===================================================================
--- openscenegraph-3.4.orig/src/osgDB/ConvertBase64.cpp
+++ openscenegraph-3.4/src/osgDB/ConvertBase64.cpp
@@ -28,7 +28,7 @@ namespace osgDB
 
     int base64_decode_value(char value_in)
     {
-        static const char decoding[] = {62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-2,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51};
+        static const signed char decoding[] = {62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-2,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51};
         static const char decoding_size = sizeof(decoding);
         value_in -= 43;
         if (value_in < 0 || value_in > decoding_size) return -1;

Navigate the terminal into the root folder of OpenSceneGraph-3.4.0 source. Side note: the patch command might need to be installed. Now enter the below command into the terminal:

patch -p1 <0007-Explicit-signed-char-type-for-portability-base64.patch

PLIB

Compilation algorithm for PLIB. Directory tree structure
  1. Navigate the Terminal into the source folder.
  2. Enter the below command into the Terminal:
    • git clone git://git.code.sf.net/p/libplib/code libplib.git
      
      • This will copy the needed source files into this folder source.
  3. Enter the below command into the Terminal:
    • cd libplib.git
      
      • This will navigate the Terminal into the folder libplib.git that was created and populated by the git command.
  4. Enter the below command into the Terminal:
    • echo "1.8.6" > version
      
      • This will edit the file 'version' that is in this folder. This file can also be modified with a text editor, even via a GUI.
  5. Enter the below command into the Terminal:
    • sed s/PLIB_TINY_VERSION\ \ 5/PLIB_TINY_VERSION\ \ 6/ -i src/util/ul.h
      
      • This is some complicated version editing.
  6. Enter the below command into the Terminal:
    • git commit --all --message "Increase tiny version to 6."
      
      • More version patching stuff.
  7. Create a folder named build-plib and have it placed in the source folder.
    • The mkdir command or a GUI method can be used to create this folder.
    • In other words; FlightGear/source/build-plib
  8. Navigate the Terminal into the build-plib folder that was just created.
  9. Enter the below command into the Terminal:
    • cmake -D CMAKE_INSTALL_PREFIX:PATH=fg-install libplib.git
      
      • The two folders fg-install and libplib.git need to be replaced with the relative or absolute address of these folders. Use your favorite method.
      • The absolute address can easily be copied and pasted with the above Copy Path(s) method. This could be a large string, however the Terminal doesn't mind.
    • This will setup the build.
  10. Enter the below command into the Terminal:
    • make -j3
      
      • This will perform the compiling.
      • The -j3 argument will allow three of the Pi's cores to participate in the compilation.
  11. Enter the below command into the Terminal:
    • make install
      
      • PLIB will be installed into the fg-install folder.
Storage Device
 |
 |
 |----FlightGear
 |     |
 |     |
 |     |----fg-install
 |     |
 |     |
 |     |
 |     |----source
 |     |     |  [1] [2]
 |     |     |
 |     |     |
 |     |     |----build-plib
 |     |     |     [8] [9] [10] [11]
 |     |     |
 |     |     |
 |     |     |----libplib.git
 |     |     |      [3] [4] [5] [6]
 |     |     |      [7]
 |     |     |
 |     |
 |

OSG

Compilation algorithm for OSG. Directory tree structure

Not done Not done

  1. Navigate the Terminal into the source folder.
  2. Enter the below command into the Terminal:
    • git clone --branch OpenSceneGraph-3.4.0 https://github.com/openscenegraph/OpenSceneGraph.git
      
      • The above is one line.
  3. Patch OSG 3.4 with with the above steps.

Not done Not done


Storage Device
 |
 |
 |----FlightGear
 |     |
 |     |
 |     |----fg-install
 |     |
 |     |
 |     |
 |     |----source
 |     |     |  [1] [2]
 |     |     |
 |     |     |
 |     |     |----OpenSceneGraph
 |     |     |       [3]  
 |     |     |
 |     |     |
 |     |     |----
 |     |     |      
 |     |     |      
 |     |     |
 |     |
 |

Not done Not done

OpenRTI

James wrote: " OpenRTI is optional. If you're using it, you need to compile it before SimGear (and therefore, before FlightGear). It's orthogonal to OSG.

SimGear

Compilation algorithm for SimGear. Directory tree structure
  1. Not done Not done
    • Not done Not done


Storage Device
 |
 |
 |----FlightGear
 |     |
 |     |
 |     |----fg-install
 |     |
 |     |
 |     |
 |     |----source
 |     |     |  
 |     |     |
 |     |     |
 |     |     |----build-plib
 |     |     |     
 |     |     |
 |     |     |
 |     |     |----libplib.git
 |     |     |      
 |     |     |      
 |     |     |
 |     |
 |

Not done Not done

FlightGear

Compilation algorithm for FlightGear. Directory tree structure
  1. Not done Not done
    • Not done Not done


Storage Device
 |
 |
 |----FlightGear
 |     |
 |     |
 |     |----fg-install
 |     |
 |     |
 |     |
 |     |----source
 |     |     |  
 |     |     |
 |     |     |
 |     |     |----build-plib
 |     |     |     
 |     |     |
 |     |     |
 |     |     |----libplib.git
 |     |     |      
 |     |     |      
 |     |     |
 |     |
 |

Not done Not done

FlightGear Data

Install algorithm for FlightGear Data. Directory tree structure
  1. Not done Not done
    • Not done Not done


Storage Device
 |
 |
 |----FlightGear
 |     |
 |     |
 |     |----fg-install
 |     |
 |     |
 |     |
 |     |----source
 |     |     |  
 |     |     |
 |     |     |
 |     |     |----build-plib
 |     |     |     
 |     |     |
 |     |     |
 |     |     |----libplib.git
 |     |     |      
 |     |     |      
 |     |     |
 |     |
 |

Not done Not done