Difference between revisions of "Installation/MacOSX"

From PaparazziUAV
Jump to: navigation, search
(updated status of os x install - sim working again)
m (fix a link to the install script)
 
(60 intermediate revisions by 10 users not shown)
Line 2: Line 2:
 
__TOC__
 
__TOC__
  
'''The OS X installation is may be temporarily broken, as well as the links to the binary installer. This is being actively resolved, and hopefully will be finished soon. (March 20, 2013).'''
+
'''Update on OS X installation: Currently, arm-none-eabi-gdb on 10.6 should be broken (gcc-arm-embedded can be compiled by hand if required without python support, or installing python2.7 as a framework from a dmg might work).'''
  
'''Update on OS X installation: Macports install should be working fine for 10.6, 10.7 and 10.8, but the binary installer is still not available. arm-none-eabi-gdb will not run properly on 10.6 at the moment. The simulator in master is currently broken, and launching agents from paparazzi center in 10.8 is also broken. (April 9, 2013)'''
+
'''(Feb. 1, 2014) Current OS X limitations:'''
 +
* '''10.6.* requires some manual effort to properly install gcc-arm-embedded, email the mailing list if help required  (gcc-arm-embedded can be compiled by hand if required without python support, or installing python2.7 as a framework from a dmg might work)'''
 +
* '''There is no cross compiler for the ARDrone2.'''
  
'''Update on OS X installation: Currently, only launching agents from paparazzi center in 10.8 and arm-none-eabi-gdb on 10.6 should be broken (gcc-arm-embedded can be compiled by hand if required without python support, or installing python2.7 as a framework from a dmg might work). The simulator should be working again. The binaries are still unavailable as there has not been time to set up a new build server. (June 4, 2013)'''
+
= Intro =
 +
This page describes the installation of paparazzi on a MacOS X.
  
== Intro ==
+
There are not as many MacOS X users as there are Linux users. We are always looking for more people to help with the effort of maintaining the OSX port. If you are a frequent user of OS X and understand the underpinnings we are looking for an official OSX maintainer at the moment. Let us know on gitter: https://gitter.im/paparazzi/discuss
Would it not be great to also be able to run Paparazzi from your shiny Apple Mac? Well, this page explains how you can manage to do just that.
 
  
The task of supporting Paparazzi on  Apple MacOS X is ongoing as the project evolves and the more people adapt it the process will be streamlined. Presently it is known that Paparazzi will install on OSX versions 10.5.8, 10.6.*, 10.7.*.
+
Presently it is known that Paparazzi will install on OSX versions 10.6.*, 10.7.*, 10.8.*, 10.9.*, 10.10.*.
  
== Basic Install ==
+
There are a few legacy installation approaches that might work on older OS X versions but are known not to work on the current Mac OS X. They all can be found on the [[Installation/MacOSX-legacy]] page.
If your Apple Mac operation system is OSX Snow Leopard or Lion or newer then the easiest way to get started with Paparazzi on your Apple Mac is to start with the Basic install.
 
<ol>
 
The steps you need to take to enjoy Paparazzi are:
 
<li>Install the latest available [http://itunes.apple.com/us/app/xcode/id448457090?mt=12 Xcode] development tool for your OS, we had good success with [http://itunes.apple.com/us/app/xcode/id448457090?mt=12 Xcode] v4.2 on Snow Leopard and v4.3.2 on Lion. For Snow Leopard, Xcode 3.2.6 also works and is still available as a [https://developer.apple.com/downloads/ free download] with an Apple ID (search for ''xcode 3.2.6'').</li>
 
<ol>
 
<li>With Xcode 4.3 and above you need to install the command line tools. Xcode --> Preferences --> Downloads --> Components --> Command line tools</li>
 
<li>Check that the correct version of Xcode is being used for compilation <source lang=bash>/usr/bin/xcodebuild -version</source> It should return the version of Xcode that has been installed, e.g. 4.2. In the rare case you need to change your XCode version run the following command in your terminal: <source lang=bash>sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer</source></li>
 
</ol>
 
<li>Install the Paparazzi Tools installer from [https://dl.dropbox.com/u/54220220/paparazzi-tools-SnowLeopard.dmg Snow Leopard] or [https://dl.dropbox.com/u/54220220/paparazzi-tools-Lion.dmg Lion]</li>
 
<li>That's it! To run Paparazzi you need to open the Terminal app and build and run Paparazzi.
 
<ol>
 
<li>In spotlight type Terminal and then open the Terminal App</li>
 
<li>then type: <source lang="bash">cd ~/paparazzi && make && ./paparazzi</source></li>
 
</ol>
 
</li>
 
</ol>
 
Note that the binary installer will check if ~/paparazzi exists on your system. If it does, then the installer does nothing. If this directory does NOT already exist, the installer will automatically clone the Paparazzi Git repository into that directory.
 
  
===Basic Uninstall ===
+
= Installing from Source (Homebrew/Opam) =
In the case you would like to uninstall Paparazzi after completing a basic installation, one must type the following in your terminal prompt:
 
  
<source lang="bash">rm -rf ~/paparazzi</source>
+
Note: Macports used to conflict with homebrew. According to the homebrew website it is not the case any more as homebrew overrides the environment variables to have a pristine environment as if macports or fink were not installed on the system. It is not confirmed that opam does the same, so it probably is still a good idea to not have macports or fink installed simultanously with homebrew.
  
'''Warning''' This first step removes your paparazzi source code, including any changes you may have made yourself locally. If you want to keep your git repository intact, skip this first step and only use the following two steps.
+
# Install [http://xquartz.macosforge.org/landing/ XQuartz].
 +
# Add XQuartz libraries to pkg-config search path by adding the following line:
 +
<source lang="bash">export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig</source>
 +
to your ~/.profile, ~/.bashrc, ~/.zshrc.local or similar. Note: You have to restart your terminal for the variable to be set, or you execute the export manually in your terminal by pasting the line and pressing enter.
 +
# Install [https://itunes.apple.com/us/app/xcode/id497799835 XCode]
 +
# Run XCode.app once to accept the license. You can find it in your /Applications folder
 +
# Install [http://brew.sh/ homebrew].
 +
# Not all packages are yet part of the official homebrew repository (like ivy-c or jsbsim) this is why you might want to run the installation in two steps using the official repository and then [paparazzi homebrew tap https://github.com/paparazzi/homebrew-paparazzi].
 +
## Install the packages included in homebrew: <source lang="bash">brew install git coreutils gnu-sed gtk+ libglade libgnomecanvas sdl libusb libusb-compat gsl opam wget dfu-util</source>
 +
## Add paparazzi tap: <source lang="bash">brew tap paparazzi/homebrew-paparazzi</source>
 +
## Install the remaining packages: <source lang="bash">brew install ivy-c jsbsim</source> Note: We provide these packages as a tap but the hope is to eventually include them in the official homebrew repository.
 +
# Initialize opam <source lang="bash">opam init</source> You should allow opam to modify your .profile and .ocamlinit so that it's settings stay permanent. Also do not forget to run <source lang="bash">eval `opam config env`</source> after the initialization or restart your terminal.
 +
# <source lang="bash">opam pin add paparazzi-dev https://github.com/paparazzi/paparazzi-portability-support.git</source>
 +
# <source lang="bash">opam install conf-gnutls</source>
 +
# Install [https://launchpad.net/gcc-arm-embedded GCC ARM embedded].
 +
## Download the gcc-arm-none-eabi-version.tar.bz2 from the website.
 +
## Extract it into your home directory: <source lang="bash">cd ~/</source><source lang="bash">tar xfvj ~/Downloads/gcc-arm-none-eabi-*.tar.bz2</source>
 +
## Add the bin directory to your PATH environment variable by adding an export to your .profile or .bashrc or .zshrc.local or similar. <source lang="bash">echo export PATH=$(echo ~/gcc-arm-none-eabi-* | tr ' ' '\n' | sort -r | head -n 1 )/bin:\$PATH >> ~/.profile</source> Do not forget to restart your terminal or at least source the new .profile by executing <source lang="bash">. ~/.profile</source>
 +
# Now you should be able to [[Installation#Getting_the_Source_Code|clone the paparazzi repository]] and run make, and execute ./paparazzi
  
<source lang="bash">
+
This process is tested and is working on Mac OS Yosemite 10.10.2 ( [[User:Esden|Esden]] ([[User talk:Esden|talk]]) 16:16, 16 March 2015 (PDT) )<br/>
sudo rm -rf /opt/paparazzi
+
This process is tested and is working on Mac OS Yosemite 10.10.5 ( [[User:Esden|Esden]] ([[User talk:Esden|talk]]) 14:10, 22 September 2015 (PDT) )<br/>
sudo rm -f /etc/paths.d/paparazzi
+
This process is tested and is working on Mac OS El Capitan 10.11 ( [[User:Esden|Esden]] ([[User talk:Esden|talk]]) 16:59, 1 October 2015 (PDT) )
</source>
 
  
===Using Luftboot and PyUSB===
+
= Installing from Source, El Capitan, alternate (Homebrew/Opam) =
  
'''UPDATE:''' The lastest binary installer should have PyUSB included by default, no need to install it separately.
+
Download [http://www.recherche.enac.fr/~jestin/soft/install_pprz_brew_highsierra.sh install_pprz_brew_highsierra.sh], and run it. It's been successful on El Capitan, and High Sierra with homebrew, and a quartz gtk.  
  
If you are planning on loading code onto a Luftboot-equipped STM32 board, you will need to have a Python version on your machine that is active and with [http://sourceforge.net/apps/trac/pyusb/ PyUSB] installed for that version.
+
== Installation Troubleshooting Notes ==
  
To install PyUSB, execute
+
=== "Fatal error: exception Gtk.Error("GtkMain.init: initialization failed\nml_gtk_init: initialization failed")" ===
<source lang="bash">
+
Try starting ./paparazzi inside of the XQuartz X11 terminal.
sudo python setup.py install
 
</source>
 
from inside the unzipped PyUSB source directory.
 
  
To test which Python version is the default and whether this Python version can find the PyUSB module, in Terminal simply type:
+
=== aspcud is not compiling with the error "CMAKE_OSX_DEPLOYMENT_TARGET is '10.11' but CMAKE_OSX_SYSROOT: """ ===
<source lang="bash">
+
[https://github.com/Homebrew/homebrew/issues/40401 It is a known bug in homebrew.] You have to install full XCode you can't just use the command line tools.
python
 
</source>
 
To start the default Python. At the Python prompt (>>>) type:
 
<source lang="bash">
 
import usb
 
</source>
 
If another prompt line comes up, PyUSB is installed correctly and you will be able to use Luftboot. If an error is thrown, then your configuration is not correct.
 
  
===MacPorts and PyUSB===
 
If you have MacPorts installed, you can install either <code>py26-pyusb</code>, <code>py26-pyusb-devel</code> or <code>py27-pyusb-devel</code>, depending on which Python(s) you have installed already, or wish to install. For example:
 
<source lang="bash">
 
sudo port selfupdate
 
sudo port install py27-pyusb-devel
 
</source>
 
  
To find out what versions of Python are available on your system (via MacPorts):
+
=== El Capitan and High Sierra’s /usr/include ===
<source lang="bash">
+
I was having trouble getting paparazzi to build against the native libxml2 libraries on Mac OS X v10.11 - “El Capitan.” The problem was that I was missing the header files – in fact the entire /usr/include tree was gone.
port select --list python
 
</source>
 
Default Apple Python versions have a -apple ending.
 
  
Select a different version of python to be the active version if desired. For example:
+
Here's the error I was seeing during the make process:
<source lang="bash">
 
sudo port select --set python python27
 
</source>
 
 
 
A good, working configuration would be to have MacPorts installed, and install <code>py27-pyusb-devel</code>, then ensure that python27 is the active version.
 
 
 
===Troubleshooting===
 
 
 
There are sometimes path issues with OS X if you have MacPorts or a similar (Homebrew, Fink) system installed. The reason for this is there may be multiple copies of a binary required for Paparazzi in different places, and depending on the path, the desired instance is not correctly called. This often presents itself as an error when building the main Paparazzi source code. A typical error may involve the <code>pkg-config</code> program. This can often be corrected by checking and adjusting your PATH environment variable.
 
 
 
To check the currently configured default PATH:
 
<source lang="bash">
 
echo $PATH
 
</source>
 
Ideally, the Paparazzi binary paths (<code>/opt/paparazzi/bin</code> and <code>/opt/paparazzi/sbin</code>) should come first. To move the Paparazzi paths to the highest search priority:
 
<source lang="bash">
 
export PATH=/opt/paparazzi/bin:/opt/paparazzi/sbin:$PATH
 
</source>
 
This will only be active in the current terminal session. If you wish to manually modify the path permanently, you can edit ~/.profile and add the above line to the bottom of the file.
 
 
 
== Installing from source ==
 
The tools that are required to work with paparazzi on a Mac are installed from MacPorts. All of the commands are given by terminal commands, please open your terminal first.
 
  
In case you '''already have MacPorts installed''', it is advised to run the following steps before proceeding:
+
<pre>
<ol>
+
OL app_server
<li>check that /opt/local/bin is the first entry in your PATH, easy to check by giving the following command</li>
+
app_server.c:42:10: fatal error: 'libxml/xmlreader.h' file not found
<source lang="bash">env</source>
+
#include <libxml/xmlreader.h>
<li>Then give the following command to make sure your ports are up-to-date</li>
+
        ^
<source lang="bash">sudo port selfupdate && sudo port upgrade outdated</source>
+
1 error generated.
..great, you now can run the installation steps starting from step '''3''' below.
+
make[1]: *** [app_server] Error 1
</ol>
+
make: *** [tmtc] Error 2
 +
</pre>
  
If you don't already have MacPorts installed run the following steps:
+
The fix is to run '''xcode-select --install'''. Apparently you can have the developer tools installed, but not have the “command line developer tools” which include /usr/include. Unfortunately, thanks to the “rootless” feature, this Apple-sanctioned installer is pretty much the only way to get /usr/lib back.
<ol>
 
<li>Install the latest [http://itunes.apple.com/us/app/xcode/id448457090?mt=12 XCode]</li>
 
<li>If you are using Mountain Lion, X11 is no longer included by default, use the [http://xquartz.macosforge.org/landing/ XQuartz project] to install it.</li>
 
<li>Install [http://www.macports.org/install.php MacPorts]</li>
 
<li>Edit the file <source lang="bash">/opt/local/etc/macports/sources.conf</source> and above the <source lang="bash">rsync://...</source> line add <source lang="bash">rsync://rsync.paparazziuav.org/macports/ports/</source> It is important that this line comes before the path to the standard ports as some of the Paparazzi ports are intended to replace the standard versions. The file is write protected so it will be necessary to be root in order to edit it. The simplest way is to open a terminal window and use nano thus:
 
<source lang="bash">sudo nano /opt/local/etc/macports/sources.conf</source>
 
<li>Now update the available ports with the command:</li>
 
<source lang="bash">sudo port selfupdate</source>
 
<li>To install all of the paparazzi prerequisites:</li>
 
<source lang="bash">sudo port install paparazzi-tools</source>
 
<li>...Then go and have lunch, get a coffee, get some sleep. This will probably take a long time.</li>
 
<li> After installation, we need to set the correct python to override the default OS X python:</li>
 
<source lang="bash">sudo port select --set python python27</source>
 
<li> You can also [[#Changing the GTK look and feel|change the GTK theme]]
 
</ol>
 
  
Now you can follow the generic instructions for [[Installation|installing the paparazzi source]].
+
If running 10.14 Mojave, you'll have to perform this step after installing the command line developer tools:
 +
<pre>
 +
installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
 +
</pre>
  
'''NOTE:''' If you had previously used MacPorts to install Paparazzi, you may need to manually uninstall arm-none-eabi-binutils, arm-none-eabi-gcc-linaro, and arm-none-eabi-gdb prior to upgrading paparazzi-tools. libcmsis, libopenstm32 and libopencm3 ports may need to be uninstalled as well. For example:
+
NOTE: Experienced this same issue with Mac OS X High Sierra as well.
<source lang="bash">sudo port uninstall -f libcmsis libopenstm32 libopencm3 arm-none-eabi-gdb arm-none-eabi-gcc-linaro arm-none-eabi-binutils</source>
 
 
 
=== Lion and XCode 4.3 or newer notes ===
 
 
 
After installing Xcode 4.3 you will need to install the command line tools by opening the XCode preferences pane, Downloads and selecting Command Line Tools for isnstallation. Otherwise you will not find GCC in your unix path.
 
 
 
Also if macports is complaining about xcodebuild and that you should run
 
 
 
# sudo xcode-select -switch /Applications/Xcode.app
 
 
 
You should actually run
 
 
 
#sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
 
 
 
so that xcodebuild can find the needed executables for you.
 
 
 
=== Troubleshooting ===
 
If you continually experience problems installing paparazzi or paparazzi-tools then it may be that you have some other conflicting software installed. i.e. an old version of a library in /usr.
 
 
 
One way to work around issues relating to prior MacPort installs that has been found is to clean out everything MacPorts has installed and install from scratch using the latest MacPorts
 
# <source lang="bash">sudo port -f uninstall installed</source>
 
# <source lang="bash">sudo port clean --all uninstalled</source>
 
# <source lang="bash">sudo port selfupdate</source>
 
# <source lang="bash">sudo port install paparazzi-tools</source>
 
This was in fact the process used to check that the code installed on a clean machine.
 
 
 
==== Upgrading to Lion ====
 
If you already have MacPorts and Paparazzi installed and running and you then upgrade to Lion you'll probably find that some things are broken. (make can't be found for example)
 
To remedy this situation you need to do the following:
 
# Upgrade Xcode to the Lion version. (App Store --> Search for Xcode and install)
 
# Install the Lion version of [http://www.macports.org/install.php MacPorts]
 
# <source lang="bash">sudo port -f uninstall installed</source>
 
# <source lang="bash">sudo port clean --all uninstalled</source>
 
# <source lang="bash">sudo port selfupdate</source>
 
 
 
Now here you have the opportunity to use the binary installer method detailed above or if installing from source then Macports can be used to build from source thus:
 
 
 
# <source lang="bash">sudo port install paparazzi-tools</source>
 
 
 
If you use a USB to serial converter that isn't based on the FTDI chipset then you may also find that your USB to Serial driver needs to be updated.
 
# Start console
 
# Plug in your USB to serial converter
 
You may get a message similar to this <source lang="bash">Jul 26 23:14:48 Bernies com.apple.kextd[10]: Can't load /System/Library/Extensions/osx-pl2303.kext - no code for running kernel's architecture.</source>
 
 
 
If you are fortunate enough to have a USB to serial converter that is using the PL2303 chipset then the [http://www.prolific.com.tw/eng/downloads.asp?id=31 Prolific] driver should sort you out. Installation instructions are included in the readme.txt and are well worth following.
 
 
 
=== Keeping source files for debugging ===
 
If you wish to debug code using the source install then you'll find that many of the source files for the libraries are missing.
 
 
 
This is because MacPorts cleans up the build artifacts and source files after the installation is complete. This behaviour can be changed by adding the -k option to the port command.
 
 
 
For example:
 
  sudo port -k install paparazzi-tools
 
This will result in all of the source and build artefact files being left on the hard disk.
 
 
 
Should you later wish to clean up these files you can do so with the clean command.
 
 
 
For example:
 
  sudo port clean installed
 
  
 
=Running Paparazzi=
 
=Running Paparazzi=
Line 199: Line 89:
 
  cd ~/paparazzi
 
  cd ~/paparazzi
 
  ./paparazzi
 
  ./paparazzi
 +
 +
=== Running on MacOSX without any network connexion ===
 +
 +
When running pprz on a mac with no internet connexion, you might encounter
 +
<source lang="bash">
 +
RUN '/Users/tom/paparazzi/sw/ground_segment/cockpit/gcs '
 +
setsockopt() Cannot join group: Can't assign requested address
 +
</source>
 +
It's a known problem for the underlying Ivy bus protocol. The easiest workaround is to connect to a Wifi hotspot, the longer one is the following:
 +
<source lang="bash">sudo route -nv add -net 224.0.0.0 -interface lo0</source>
 +
And to return to the previous state
 +
<source lang="bash">sudo route -v delete -inet 224.0.0.0</source>
  
 
=== Changing the GTK look and feel ===
 
=== Changing the GTK look and feel ===
Line 209: Line 111:
 
A good choice is:
 
A good choice is:
 
<source lang="bash">switch2 /opt/local/share/themes/ClearlooksClassic/</source>
 
<source lang="bash">switch2 /opt/local/share/themes/ClearlooksClassic/</source>
 +
 +
Another theme selector with a little bit better preview option is "gtk-chtheme"
  
 
=== USB Drivers for Telemetry ===
 
=== USB Drivers for Telemetry ===
Line 254: Line 158:
 
Here is a diff between a "vanilla OS X" and one that has been modified (Essentially below was removed):
 
Here is a diff between a "vanilla OS X" and one that has been modified (Essentially below was removed):
 
  quadzilla:Contents root# diff ~/Info.plist Info.plist  
 
  quadzilla:Contents root# diff ~/Info.plist Info.plist  
 +
<source lang="diff">
 
  1784,1805d1783
 
  1784,1805d1783
 
  < <key>FT2232C_B</key>
 
  < <key>FT2232C_B</key>
Line 302: Line 207:
 
  < <integer>1027</integer>
 
  < <integer>1027</integer>
 
  < </dict>
 
  < </dict>
 +
</source>
  
 
Once you have edited the file
 
Once you have edited the file
Line 312: Line 218:
 
==Installing FlightGear==
 
==Installing FlightGear==
 
FlightGear has been packaged for use on OS X. This package can be downloaded from:
 
FlightGear has been packaged for use on OS X. This package can be downloaded from:
http://macflightgear.sourceforge.net/home/downloads/
+
http://www.flightgear.org/download/
  
There are several packages available. Recently, FlightGear 2.6.0 was released. A binary for OS X is available, and seems to work properly on Lion (OS X 10.7.4). Follow the directions [http://macflightgear.sourceforge.net/home/documents/users-guide/ here] for installation and basic usage. Additional documentation can be found  [http://macflightgear.sourceforge.net/home/documents/ here].
+
There are several packages available. Recently, FlightGear 3.0 was released. A binary for OS X is available, and seems to work properly on Maverics (OS X 10.9.2). Follow the directions [http://www.flightgear.org/download/main-program/ here] for installation. Additional documentation can be found  [http://macflightgear.sourceforge.net/home/documents/ here].
  
 
[[Image:Flightgear_launchgui_OSX_pprzoptions.png|thumb|350px|Screenshot of FlightGear launch gui in OS X with options for visualizing Paparazzi simulations]]
 
[[Image:Flightgear_launchgui_OSX_pprzoptions.png|thumb|350px|Screenshot of FlightGear launch gui in OS X with options for visualizing Paparazzi simulations]]
Line 320: Line 226:
  
  
* In Paparazzi Center, add to the simulator command the <tt>-fg</tt> option plus the IP address of the machine running flightgear in this case the loopback interace is used as Flightgear and Paparazzi are running on the same machine:
+
* In Paparazzi Center, add to the simulator command the <tt>--fg</tt> option plus the IP address of the machine running flightgear in this case the loopback interace is used as Flightgear and Paparazzi are running on the same machine:
  .../sw/simulator/launchsitl -a TJ1 -fg 127.0.0.1 -boot -norc
+
  .../sw/simulator/pprzsim-launch --aircraft TJ1 -t sim --boot --norc --fg_host 127.0.0.1
 
Note TJ1 is the name of the aircraft you must substitute this with the name of your aircraft.
 
Note TJ1 is the name of the aircraft you must substitute this with the name of your aircraft.
 
* Launch Flight Gear with the following set in the others tab under advanced settings:
 
* Launch Flight Gear with the following set in the others tab under advanced settings:
 
  --fdm=null --native-gui=socket,in,30,,5501,udp
 
  --fdm=null --native-gui=socket,in,30,,5501,udp
  
For Flight Gear visualization, version 2.6 or greater is best. If you wish to use version 2.4 or lower, you must add the following to the firmware section of your airframe file:
+
For Flight Gear visualization, version 3.0 or greater with Rembrand switched on is best. If you wish to use version 2.4 or lower, you must add the following to the firmware section of your airframe file:
  
 
<source lang="xml">
 
<source lang="xml">
Line 337: Line 243:
  
 
[[Image:Flightgear_pprz_sim_OSX.png|thumb|right|350px|Screenshot of Flightgear visualizing the default Microjet simulation in OS X (not the default Muret, FR location)]]
 
[[Image:Flightgear_pprz_sim_OSX.png|thumb|right|350px|Screenshot of Flightgear visualizing the default Microjet simulation in OS X (not the default Muret, FR location)]]
 
If it is night in FlightGear and you wish to view the simulation in daylight, follow the instructions on the [[Simulation#Why is it night in Flight Gear, if my sim is flying during the day?|Simulation]] page.
 
  
 
==Simulations Using JSBSim==
 
==Simulations Using JSBSim==

Latest revision as of 07:24, 25 February 2019

Update on OS X installation: Currently, arm-none-eabi-gdb on 10.6 should be broken (gcc-arm-embedded can be compiled by hand if required without python support, or installing python2.7 as a framework from a dmg might work).

(Feb. 1, 2014) Current OS X limitations:

  • 10.6.* requires some manual effort to properly install gcc-arm-embedded, email the mailing list if help required (gcc-arm-embedded can be compiled by hand if required without python support, or installing python2.7 as a framework from a dmg might work)
  • There is no cross compiler for the ARDrone2.

Intro

This page describes the installation of paparazzi on a MacOS X.

There are not as many MacOS X users as there are Linux users. We are always looking for more people to help with the effort of maintaining the OSX port. If you are a frequent user of OS X and understand the underpinnings we are looking for an official OSX maintainer at the moment. Let us know on gitter: https://gitter.im/paparazzi/discuss

Presently it is known that Paparazzi will install on OSX versions 10.6.*, 10.7.*, 10.8.*, 10.9.*, 10.10.*.

There are a few legacy installation approaches that might work on older OS X versions but are known not to work on the current Mac OS X. They all can be found on the Installation/MacOSX-legacy page.

Installing from Source (Homebrew/Opam)

Note: Macports used to conflict with homebrew. According to the homebrew website it is not the case any more as homebrew overrides the environment variables to have a pristine environment as if macports or fink were not installed on the system. It is not confirmed that opam does the same, so it probably is still a good idea to not have macports or fink installed simultanously with homebrew.

  1. Install XQuartz.
  2. Add XQuartz libraries to pkg-config search path by adding the following line:
export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig

to your ~/.profile, ~/.bashrc, ~/.zshrc.local or similar. Note: You have to restart your terminal for the variable to be set, or you execute the export manually in your terminal by pasting the line and pressing enter.

  1. Install XCode
  2. Run XCode.app once to accept the license. You can find it in your /Applications folder
  3. Install homebrew.
  4. Not all packages are yet part of the official homebrew repository (like ivy-c or jsbsim) this is why you might want to run the installation in two steps using the official repository and then [paparazzi homebrew tap https://github.com/paparazzi/homebrew-paparazzi].
    1. Install the packages included in homebrew:
      brew install git coreutils gnu-sed gtk+ libglade libgnomecanvas sdl libusb libusb-compat gsl opam wget dfu-util
      
    2. Add paparazzi tap:
      brew tap paparazzi/homebrew-paparazzi
      
    3. Install the remaining packages:
      brew install ivy-c jsbsim
      
      Note: We provide these packages as a tap but the hope is to eventually include them in the official homebrew repository.
  5. Initialize opam
    opam init
    
    You should allow opam to modify your .profile and .ocamlinit so that it's settings stay permanent. Also do not forget to run
    eval `opam config env`
    
    after the initialization or restart your terminal.
  6. opam pin add paparazzi-dev https://github.com/paparazzi/paparazzi-portability-support.git
    
  7. opam install conf-gnutls
    
  8. Install GCC ARM embedded.
    1. Download the gcc-arm-none-eabi-version.tar.bz2 from the website.
    2. Extract it into your home directory:
      cd ~/
      
      tar xfvj ~/Downloads/gcc-arm-none-eabi-*.tar.bz2
      
    3. Add the bin directory to your PATH environment variable by adding an export to your .profile or .bashrc or .zshrc.local or similar.
      echo export PATH=$(echo ~/gcc-arm-none-eabi-* | tr ' ' '\n' | sort -r | head -n 1 )/bin:\$PATH >> ~/.profile
      
      Do not forget to restart your terminal or at least source the new .profile by executing
      . ~/.profile
      
  9. Now you should be able to clone the paparazzi repository and run make, and execute ./paparazzi

This process is tested and is working on Mac OS Yosemite 10.10.2 ( Esden (talk) 16:16, 16 March 2015 (PDT) )
This process is tested and is working on Mac OS Yosemite 10.10.5 ( Esden (talk) 14:10, 22 September 2015 (PDT) )
This process is tested and is working on Mac OS El Capitan 10.11 ( Esden (talk) 16:59, 1 October 2015 (PDT) )

Installing from Source, El Capitan, alternate (Homebrew/Opam)

Download install_pprz_brew_highsierra.sh, and run it. It's been successful on El Capitan, and High Sierra with homebrew, and a quartz gtk.

Installation Troubleshooting Notes

"Fatal error: exception Gtk.Error("GtkMain.init: initialization failed\nml_gtk_init: initialization failed")"

Try starting ./paparazzi inside of the XQuartz X11 terminal.

aspcud is not compiling with the error "CMAKE_OSX_DEPLOYMENT_TARGET is '10.11' but CMAKE_OSX_SYSROOT: """

It is a known bug in homebrew. You have to install full XCode you can't just use the command line tools.


El Capitan and High Sierra’s /usr/include

I was having trouble getting paparazzi to build against the native libxml2 libraries on Mac OS X v10.11 - “El Capitan.” The problem was that I was missing the header files – in fact the entire /usr/include tree was gone.

Here's the error I was seeing during the make process:

OL app_server
app_server.c:42:10: fatal error: 'libxml/xmlreader.h' file not found
#include <libxml/xmlreader.h>
         ^
1 error generated.
make[1]: *** [app_server] Error 1
make: *** [tmtc] Error 2

The fix is to run xcode-select --install. Apparently you can have the developer tools installed, but not have the “command line developer tools” which include /usr/include. Unfortunately, thanks to the “rootless” feature, this Apple-sanctioned installer is pretty much the only way to get /usr/lib back.

If running 10.14 Mojave, you'll have to perform this step after installing the command line developer tools:

installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

NOTE: Experienced this same issue with Mac OS X High Sierra as well.

Running Paparazzi

Please see Installation for details on running Paparazzi, downloading source code from GitHub and updating software.

Paparazzi can be started in the usual way

cd ~/paparazzi
./paparazzi

Running on MacOSX without any network connexion

When running pprz on a mac with no internet connexion, you might encounter

RUN '/Users/tom/paparazzi/sw/ground_segment/cockpit/gcs '
setsockopt() Cannot join group: Can't assign requested address

It's a known problem for the underlying Ivy bus protocol. The easiest workaround is to connect to a Wifi hotspot, the longer one is the following:

sudo route -nv add -net 224.0.0.0 -interface lo0

And to return to the previous state

sudo route -v delete -inet 224.0.0.0

Changing the GTK look and feel

Run /opt/local/bin/switch2 to select a different theme. More detailed instructions can be found at http://gtk.php.net/manual/en/html/tutorials/tutorials.installation.macosx-stepbystep.html

Additional themes can be downloaded from http://art.gnome.org/themes/gtk2

A good choice is:

switch2 /opt/local/share/themes/ClearlooksClassic/

Another theme selector with a little bit better preview option is "gtk-chtheme"

USB Drivers for Telemetry

No drivers need to be installed in order to program either the STM32 based or LPC2148 based autopilot boards (ie TINY, TWOG, Booz, Lisa/L, Lisa/M) using a USB port. However telemetry between the vehicle and ground control station requires a modem. On an Apple Mac this will generally be connected to a USB port. Whatever modem is used it will be necessary to load drivers that allow Paparazzi to communicate with the modem. It is not possible to describe all possible modems and their configuration. However the most commonly used chipset for USB to serial communication is produced by FTDI. Below is described the installation of the FTDI drivers. This can be used as a guide for installing drivers for modems using other chipsets.


FTDI drivers can be downloaded from FTDI

The device will probably become available as something like /dev/tty.usbserial-000013FD when connected. Note that different USB ports get different addresses. When connecting to another port the same device came up as /dev/tty.usbserial-000014FA

Since Paparazzi is currently configured to use /dev/ttyUSB0 it's easiest to just create a link to the required device.

  1. Remove all USB devices from the computer and run the command ls -l /dev/*usb* /dev/*USB* hopefully this will not list anything
  2. Plug in your radio and repeat the command ls -l /dev/*usb* /dev/*USB* this should now list the serial port that the radio has been connected to. In my case I get
        ls -l /dev/*usb* /dev/*USB*
    crw-rw-rw- 1 root wheel 11, 27 20 Jan 14:38 /dev/cu.usbserial-000013FD
    crw-rw-rw- 1 root wheel 11, 26 20 Jan 14:38 /dev/tty.usbserial-000013FD
  3. Next we need to create a symbolic link to the tty.usbserial device listed to /dev/ttyUSB0 in my case the command is sudo ln -s /dev/tty.usbserial-000013FD /dev/ttyUSB0
  4. To check that everything is correct run the first command again ls -l /dev/*usb* /dev/*USB* and you should get something like this
        ls -l /dev/*usb* /dev/*USB*
    crw-rw-rw- 1 root wheel 11, 27 20 Jan 14:38 /dev/cu.usbserial-000013FD
    crw-rw-rw- 1 root wheel 11, 26 20 Jan 14:38 /dev/tty.usbserial-000013FD
    lrwxr-xr-x 1 root wheel 0 20 Jan 14:42 /dev/ttyUSB0 -> /dev/tty.usbserial-000013FD


Once the FTDI driver (kernel extension) is loaded it takes over for all FTDI connections. This means that it will not be possible to program the Lisa/L or Lisa/M boards while the driver is loaded.

To unload the driver use the command

sudo kextunload /System/Library/Extensions/FTDIUSBSerialDriver.kext

This should not give an error. if it does then try again a few times after quitting programs that may have used the connection. If the driver still fails to unload then a reboot may be required.

When it comes time to connect the modem again you'll again need the driver loaded. This can be done with the complementary command

sudo kextload /System/Library/Extensions/FTDIUSBSerialDriver.kext

Workaround for Issues with errors (Device busy) when trying to program a Lisa/L

Programming the Lisa on OS X

The problem: The "default" vendor id and product id for the ftdi device on Lisa is the same one used by all the manufacturers of clone usb-serial interfaces. This isn't an issue on Linux because of the udev rules file we use does not load the ftdi drivers for lisas programming interface. Windows and Mac OS X don't use this file so they can only use vendor id and product id. So as soon as you plug in Lisa they load USB->serial port drivers for the two ports they believe are on Lisa causing a conflict. The programming of Lisa happens through a different mechanism and does not want the programming interface of Lisa to be taken by the FTDI driver which has already been loaded. For OS X there is a hack we can do that makes it better until we can get vendor and product ids sorted out. It involves modifying the /System/Library/Extensions/FTDIUSBSerialDriver.kext/Contents/Info.plist file. We change it so only the first of the two serial interfaces is loaded. The second is not as it is the programming interface.

The File (edit with a text editor):

/System/Library/Extensions/FTDIUSBSerialDriver.kext/Contents/Info.plist

Here is a diff between a "vanilla OS X" and one that has been modified (Essentially below was removed):

quadzilla:Contents root# diff ~/Info.plist Info.plist 
 1784,1805d1783
 < 		<key>FT2232C_B</key>
 < 		<dict>
 < 			<key>CFBundleIdentifier</key>
 < 			<string>com.FTDI.driver.FTDIUSBSerialDriver</string>
 < 			<key>ConfigData</key>
 < 			<dict>
 < 				<key>LatencyTimer</key>
 < 				<integer>2</integer>
 < 			</dict>
 < 			<key>IOClass</key>
 < 			<string>FTDIUSBSerialDriver</string>
 < 			<key>IOProviderClass</key>
 < 			<string>IOUSBInterface</string>
 < 			<key>bConfigurationValue</key>
 < 			<integer>1</integer>
 < 			<key>bInterfaceNumber</key>
 < 			<integer>1</integer>
 < 			<key>idProduct</key>
 < 			<integer>24592</integer>
 < 			<key>idVendor</key>
 < 			<integer>1027</integer>
 < 		</dict>
 1830,1853d1807
 < 		<key>FT2232H_B</key>
 < 		<dict>
 < 			<key>CFBundleIdentifier</key>
 < 			<string>com.FTDI.driver.FTDIUSBSerialDriver</string>
 < 			<key>ConfigData</key>
 < 			<dict>
 < 				<key>LatencyTimer</key>
 < 				<integer>2</integer>
 < 			</dict>
 <  			<key>IOClass</key>
 < 			<string>FTDIUSBSerialDriver</string>
 < 			<key>IOProviderClass</key>
 < 			<string>IOUSBInterface</string>
 < 			<key>bConfigurationValue</key>
 < 			<integer>1</integer>
 < 			<key>bInterfaceNumber</key>
 < 			<integer>1</integer>
 < 			<key>bcdDevice</key>
 < 			<integer>1792</integer>
 <  			<key>idProduct</key>
 < 			<integer>24592</integer>
 < 			<key>idVendor</key>
 < 			<integer>1027</integer>
 < 		</dict>

Once you have edited the file

- sudo kextunload /System/Library/Extensions/FTDIUSBSerialDriver.kext/
- sudo kextload /System/Library/Extensions/FTDIUSBSerialDriver.kext/

To reload the driver or you can just reboot.

It is expected as Paparazzi moves to supporting more operating systems that unique product and vendor ids will be obtained thus removing the need for this step.

Installing FlightGear

FlightGear has been packaged for use on OS X. This package can be downloaded from: http://www.flightgear.org/download/

There are several packages available. Recently, FlightGear 3.0 was released. A binary for OS X is available, and seems to work properly on Maverics (OS X 10.9.2). Follow the directions here for installation. Additional documentation can be found here.

Screenshot of FlightGear launch gui in OS X with options for visualizing Paparazzi simulations

Once FlightGear is installed, the GUI launcher can be used to set common options. By clicking on the Advanced Features arrow, one can gain access to many more options as well as an interface to specify command line options (the Others tab). This is where one can specify the flight dynamics model and network connectivity required for visualizing Paparazzi simulations as described on the Simulation page.


  • In Paparazzi Center, add to the simulator command the --fg option plus the IP address of the machine running flightgear in this case the loopback interace is used as Flightgear and Paparazzi are running on the same machine:
.../sw/simulator/pprzsim-launch --aircraft TJ1 -t sim --boot --norc --fg_host 127.0.0.1

Note TJ1 is the name of the aircraft you must substitute this with the name of your aircraft.

  • Launch Flight Gear with the following set in the others tab under advanced settings:
--fdm=null --native-gui=socket,in,30,,5501,udp

For Flight Gear visualization, version 3.0 or greater with Rembrand switched on is best. If you wish to use version 2.4 or lower, you must add the following to the firmware section of your airframe file:

  <firmware name="fixedwing or rotorcraft">
     ...
     <define name="FG_2_4" value="1"/>
     ...
  </firmware>
Screenshot of Flightgear visualizing the default Microjet simulation in OS X (not the default Muret, FR location)

Simulations Using JSBSim

JSBSim is an open-source flight dynamics and control software library. It can provide a more realistic simulation environment over the basic built-in Paparazzi simulator. See the Simulation page for background information and how to run a normal simulation. After this can be done in a satisfactory manner, follow the steps below to utilize the JSBSim flight dynamics model.

Please see JSBSim for installation instructions and Simulation#JSBSim for instructions on how to use the JSBSim FDM in simulations.

Differences with the Linux version

This section is intended to document all the subtle differences between Linux and Mac OS X versions of Paparazzi.

Change of text editor

The default editor in Linux is gedit, but in OS X, it is open, which simply uses whatever the default program for opening .xml files is setup.

Ivy subnet mask

On Linux, the Ivy submask is 127.255.255.255

On Mac OS X, the Ivy submask is 224.255.255.255


In C applications, such as tmtc/c_ivy_client_example_1.c, this should be set adaptively by something like:

 #ifdef __APPLE__
  printf("Mac OS, network submask: 224.255.255.255\n");
  IvyStart("224.255.255.255");
 #else
  printf("NO Mac OS, network submask: 127.255.255.255\n");
  IvyStart("127.255.255.255");
 #endif


Is there a better way to do this?