-
Notifications
You must be signed in to change notification settings - Fork 126
Building from source
Please note that a 32-bit Linux binary is not built automatically by the server, but the following set of commands should get you a working version of Labrador on Ubuntu and variants (Lubuntu, Xubuntu, Kubuntu etc.)
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install pkg-config
sudo apt-get install git
sudo apt-get install qtbase5-dev
sudo apt-get install qtchooser
sudo apt-get install qt5-qmake
sudo apt-get install qtbase5-dev-tools
sudo apt-get install libusb-1.0-0-dev
sudo apt-get install libfftw3-dev
sudo apt-get install libeigen3-dev
cd ~
git clone https://github.com/espotek-org/Labrador
cd ~/Labrador/Desktop_Interface
QT_SELECT=qt5 qmake
make
sudo make install
sudo ldconfig
labrador
The Raspberry Pi bootstrap script (see below) performs these commands and should also work on Ubuntu and variants.
If you're having any issues, please file a bug report and we can work together to update the wiki.
Please note that Raspbian version 9 (Stretch) or later is required to install this software.
To install Labrador on the Raspberry Pi, open a terminal and paste the following command:
wget -O /tmp/labrador_bootstrap_pi https://raw.githubusercontent.com/espotek-org/Labrador/master/labrador_bootstrap_pi && sudo chmod +x /tmp/labrador_bootstrap_pi && sudo /tmp/labrador_bootstrap_pi
This will automatically download, compile and install the latest version of the Labrador software from source. The whole process will take around 20-30 minutes, so don't forget to pack a snack!
After running it, a desktop entry will appear for the Labrador software (under Education), and running the labrador command from the terminal will launch the software interface.
Continuing the instructions from above, you will additionally need to install the debhelper package. Then run dpkg-buildpackage from the Desktop_Interface directory. If everything is successful, you will have a file named espotek-labrador_<version>_<arch>.deb in the parent directory (replace <version> and <arch> with appropriate values) which can be installed using dpkg:
sudo apt-get install debhelper
cd ~/Labrador/Desktop_Interface
DEB_BUILD_OPTIONS=nostrip dpkg-buildpackage -b -j1
cd ..
sudo dpkg -i espotek-labrador_<version>_<arch>.deb
The DEB_BUILD_OPTIONS=nostrip part is optional; it leaves the symbols in case you need them for debugging, and skips creating a separate debug-symbols package. The -j1 part is also optional; it may be needed on Raspberry Pi or other resource-limited computers to build using only a single CPU core.
Most of the commands in this section are sourced from the workflow file for macOS with minor edits. For reference, Github runs this workflow file to generate the macOS package on the releases page.
First, run the following homebrew command to install prerequisite packages:
brew install fftw libomp qt@5 libusb eigen
Then, navigate to the Desktop_Interface directory of this repo, open Labrador.pro with a text editor, remove the following line from the MAC OSX BUILD ONLY section
INCLUDEPATH += $$system(brew --prefix)/include
and replace it with
INCLUDEPATH += $$system(echo "$(brew info fftw | grep -oE '^/usr/\S+')")/include
INCLUDEPATH += $$system(echo "$(brew info libomp | grep -oE '^/usr/\S+')")/include
These two lines point the compiler to fftw and libomp header files. This is necessary for fftw because, for unknown reasons, the compiler isn't able to find these files in $$system(brew --prefix)/include even if they are in it. This is necessary for libomp because it is a "keg-only" homebrew package, meaning it isn't automatically copied into directories (such as $$system(brew --prefix)/include) that are widely-visible to programs running on the computer. Lastly, the removal of $$system(brew --prefix)/include from INCLUDEPATH ensures that the compiler doesn't find any files in it that are incompatible with the build.
Next, still in the Desktop_Interface directory, run
"$(brew info qt@5 | grep -oE '^/usr/\S+')"/bin/qmake Labrador.pro
make
The first command is essentially qmake Labrador.pro with the assurance that the invoked qmake comes from version 5 of Qt.
The make command will take a minute or so and build the app in a subdirectory, Labrador.app, of Desktop_Interface.
After make finishes, navigate to Labrador.app/Contents/MacOS/ and run
cp ../../../build_mac/libdfuprog/lib/libdfuprog-0.9.dylib .
(note the period at the end!), which copies a library that the app depends on into a location where the app can find it.
Finally, from within Labrador.app/Contents/MacOS/, run ./Labrador to start the app.
To build a version of the macOS app that can be debugged using, e.g., lldb, first clean the build if necessary by running make clean and make distclean from within the Desktop_Interface directory.
Then, run the same commands as stated above with the substitution ->.../bin/qmake Labrador.pro.../bin/qmake -config debug Labrador.pro.
It is possible to compile custom versions of the firmware and flash them to your Labrador. Windows users may be able to do this using Atmel Studio and the .atsln in /Labrador/AVR_Code/. However, this option is not available to Mac and Linux users, so an alternative Makefile-based firmware compilation method is described below.
The Makefile in /Labrador/AVR_Code/USB_BULK_TEST was generated from the .cproj file in that directory with the help of as2make. Steps to make the Makefile functional are as follows:
- download and build the GNU AVR Tools listed below by following the instructions here:
- binutils
- most recent version known to work for this project: binutils-2.45.tar.bz2 from here
- On mac, installation may fail if the build script finds the apple-supplied version of gcc. The homebrew version allows the build to work. If necessary, download it here and point the build script to it by setting the
CCenvironment variable appropriately, e.g., viaexport CC=/usr/local/opt/gcc@12/bin/gcc-12or a similar command.
- avr-gcc
- most recent version known to work for this project: gcc-15.2.0.tar.gz from here
- on mac, updates to the Xcode command line tools may compel use of a more recent version in the future.
- avr-libc
- If the environment variable
$CCwas set for the binutils build, it should be unset before the avr-libc build so that the new version of gcc in$PREFIX/binis found - most recent version known to work for this project: avr-libc-2.2.1.tar.bz2 asset from here
- If the environment variable
- In line 35 of the Makefile, set
AVRDIRto whatever$PREFIXwas set to for the build process. - navigate to /Labrador/AVR_Code/USB_BULK_TEST on the command line, type
make 0x01ormake 0x02, and hit enter. The distinction between the 0x01 and 0x02 variants of the firmware is described in the Makefile header. The newly compiled firmware labrafirm_0x01.hex or labrafirm_0x02.hex can be flashed to the device as described in https://github.com/espotek-org/Labrador/wiki/Troubleshooting-Guide#manual-firmware-recovery