Skip to content

How to compile and build Stratux executable

mikessut edited this page Jun 18, 2020 · 17 revisions

Software can be compiled, linked and built on the Pi itself, probably the easiest and most compatible approach. Executable image files can then be run on any other supported model of the Pi (0, 2 or 3). The faster speed of the Raspberry Pi 3 compiles the code about 3x faster than a Pi2, and takes a few minutes.

Command line can be accessed either directly on the Pi itself (plug in HDMI monitor and USB keyboard) or remotely using a terminal window (Mac Utilities Terminal or Windows PC using PuTTY). The remote computer can be connected over Wi-Fi or Wired Ethernet using SSH.

The standard Stratux image has all of the dependencies installed except for those installed below. If you are using a clean Raspbian install or another distribution, you will need to dig through the image/ directory in the source and manually determine what your system needs.

From a remote computer (can be over Wi-Fi or wired Ethernet), login using SSH by opening a Terminal window in Mac or using PuTTY in Windows

ssh pi@192.168.1.76
_[password]_ raspberry

Or directly on the machine, login with username pi password raspberry

sudo su -
*** IF THERE IS A PROBLEM WITH THE CAFILE, RUN date -s "Tue May 7 19:40:00 UTC 2019"
AND SET WITH CURRENT UTC TIME***
raspi-config --expand-rootfs
reboot
cd /root/
wget https://dl.google.com/go/go1.14.2.linux-armv6l.tar.gz
tar -zxvf go1.14.2.linux-armv6l.tar.gz
set GO111MODULE=on
git clone --recursive https://github.com/cyoung/stratux
cd stratux
service stratux stop
make
make install
service stratux start

Explanation

  • sudo enables supervisor privileges
  • stopping the stratux service releases the executable files in use and also frees up processing capacity
  • set GO111MODULE=on enables new Go package manager functionality
  • make invokes the Unix make process with the configuration file Makefile in the stratux directory
  • make install makes that target, creating a new image file
  • starting the stratux service runs the program again

NOTE 1: If make fails with an error about an invalid flag in #cgo CFLAGS, may have to make a minor modification to ~/stratux/godump978/godump978_exports.go. Find the line that reads: #cgo CFLAGS: -L../ and change it to: #cgo CFLAGS: -I../ (Note: That is changing an uppercase L to an uppercase I, not a lowercase l).

NOTE 2: If make install fails with an error about copying fancontrol, you may have to make a minor modification to ~/stratux/Makefile. In "go build" command in the section labeled fancontrol:, add -o fancontrol after -p 4. Then run make and make install again.

NOTE 3: If make fails with an error about C.rtlsdr_set_bias_tee see note about building librtlsdr, which amounts to:

cd ~/tmp
git clone git@github.com:jpoirier/librtlsdr.git
cd librtlsdr
mkdir build; cd build
cmake ../
sudo make install
sudo ldconfig