OpenTX 2.2 OSX Build Instructions
The following instructions describe how to set up the build environment, retrieve the source code and lastly build OpenTX on a Apple OSX machine.
You need to install Xcode from the Store. It's free, you have time to take a big cup of coffee.
Then a number of tools and libraries have to be installed.
Download it from there: http://www.obdev.at/products/crosspack/index.html
Get & install Homebrew (http://brew.sh)
(this is to install qmake, the arm compiler, and pyqt)
Install homebrew by pasting this line in terminal (not as root) :
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Answer 'yes' to Xcode command line tools installation
In a terminal window
brew tap PX4/homebrew-px4
brew update
brew cask install xquartz
brew install gcc-arm-none-eabi cmake homebrew/x11/fox dfu-util avrdude
If you get assertion errors in gcc during compilation try a different gcc version (e.g. brew remove gcc-arm-none-eabi
and brew install gcc-arm-none-eabi-49
)
(Instructions based on ArduPilot)
If you want to build Companion or the simulator also install Qt and SDL
brew install sdl qt5
In a terminal window
brew install python
brew install pyqt5 --with-python
This will install python, pyqt5 and sip, which pyqt depends on.
In a terminal window
brew install python
pip3 install pillow
This will install python (3.x) and Pillow, a fork of python PIL.
Depending on your installation, you might have to use -DPYTHON_EXECUTABLE=/usr/local/opt/python/libexec/bin/python
when invoking cmake
to make use of the python version installed by brew
instead of the system one.
This is what you need to install to build binaries
Navigate to wherever you want to store the source code. Issue the following command (it will take quite a while to complete):
git clone --recursive -b next https://github.com/opentx/opentx
Git has now built a cloned OpenTX repository for you and switch directly to the next branch.
Create a directory for the build, for example directly in the opentx folder
cd opentx
mkdir build
cd build
Run cmake with the configuration options pointing to OpenTX's source directory. You might adjust the path /usr/local/Cellar/qt5/5.6.0
to match your local installation.
cmake -DPCB=X9D+ -DHELI=YES -DCMAKE_PREFIX_PATH=/usr/local/opt/qt5 ..
You can find the path with:
brew info qt5
Build the firmware:
make -j4 firmware
If you want to build everything including the companion use
make
If you want to build a disk image (dmg)
make package
Warning the steps are quite tidious and only required if you want to build Companion/Disk Image that runs on older version of Mac OS X than your own development machine Mac OS X. For development and personal use it is fine to just use packages from homebrew. Also using MACOSX_DEPLOYMENT_TARGET
can somtetimes lead to strange errors.
-
Install Xcode and Xcode command line tools
-
Get QT and install it. Should create a dir like
Qt/5.7/clang_64
that has the QT libraries. -
Install build time only dependencies via homebrew (http://brew.sh):
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew install cmake pyqt pkg-config
-
Build the dependencies that will later be included with Companion: libusb, libsdl and dfu-util. You need to build these by hand since Homebrew does not allow setting
MACOSX_DEPLOYMENT_TARGET
-
libusb
wget https://github.com/libusb/libusb/releases/download/v1.0.20/libusb-1.0.20.tar.bz2 export MACOSX_DEPLOYMENT_TARGET=10.9 tar xfv libusb-1.0.20.tar.bz2 cd libusb-1.0.20 ./configure make sudo make install cd ..
-
dfu-util
wget https://downloads.sourceforge.net/project/dfu-util/dfu-util-0.9.tar.gz export MACOSX_DEPLOYMENT_TARGET=10.9 tar xfv dfu-util-0.9.tar.gz cd dfu-util-0.9 ./configure make sudo make install
-
avrdude
wget http://download.savannah.gnu.org/releases/avrdude/avrdude-6.3.tar.gz export MACOSX_DEPLOYMENT_TARGET=10.9 tar xfv avrdude-6.3.tar.gz cd avrdude-6.3 ./configure make sudo make install
-
libSDL
wget https://www.libsdl.org/release/SDL-1.2.15.tar.gz tar xfv SDL-1.2.15.tar.gz export MACOSX_DEPLOYMENT_TARGET=10.9 cd SDL-1.2.15 wget 'https://bugzilla-attachments.libsdl.org/attachment.cgi?id=1320' -O patch1 wget 'https://bugzilla-attachments.libsdl.org/attachment.cgi?id=1324' -O patch2 wget 'https://hg.libsdl.org/SDL/raw-rev/91ad7b43317a' -O patch3 patch -p1 < patch1 patch -p1 < patch2 patch -p1 < patch3 ./configure --without-x make sudo make install
-
-
(Optional) Check libraries/binaries for the minimal OS X version
otool -l /usr/local/lib/libusb-1.0.0.dylib |grep -A 3 MIN_MACOS cmd LC_VERSION_MIN_MACOSX cmdsize 16 version 10.9 sdk 10.11
-
Clone OpenTX
git clone -b next https://github.com/opentx/opentx ~/opentx
-
Build release
mkdir -p ~/out/ ~/opentx/tools/build-companion.sh ~/opentx ~/out/ test
-
in
~/out/
a complete dmg should be present (opentx-companion-2.2.0test.dmg
)
Wiki Home
- Compiling OpenTx
-- Linux
--- OpenTX 2.1
--- Companion 2.1
--- OpenTX 2.2
-- Mac OS X
--- OpenTX 2.1
--- Companion 2.1
--- OpenTX 2.2
-- Windows
--- OpenTX 2.0 - 2.2
--- OpenTX 2.3
-- All OSs
--- OpenTX 2.2 with QtCreator
--- OpenTX Compilation Options