Tuesday, February 20, 2018

Compile OpenCPN 4.8.2 for Armbian

UPDATE:
As of Armbian 5.65 with Ubuntu Bionic this is not necessary. The Ubuntu PPA has arm version of the latest release of OpenCPN

A fresh clean install of OpenCPN 4.8.2 on Armbian 5.38 - Ubuntu 16.04 - Orange Pi PC Plus

My laptop is named pot, the Orange Pi PC Plus gets renamed cpn.

Download the latest desktop version of Armbian for the Orange Pi board you have. It still needs to be the Legacy kernel 3.4.113 because the accelerated GPU drivers are not yet in the mainline kernel.

Write the OS image to the sd-card:

pot# dd bs=4M of=/dev/sdc if=Armbian_5.38_Orangepipcplus_Ubuntu_xenial_default_3.4.113_desktop.img


Do the normal setup of a fresh image:

pot# scp /etc/hosts root@cpn:/etc
passwd, config networking, ssh-copy-id, scp setup, fix ~larryl/.ssh ownership, ./confi   
reboot   # to finish filesystem resize
updatedb  # for the locate command


I had to wait quite a while for the daily cron: apt to finish before I could do:

apt update; apt upgrade
apt-get install build-essential cmake gettext git-core gpsd gpsd-clients libgps-dev \
   wx-common libwxgtk3.0-dev libglu1-mesa-dev libgtk2.0-dev wx3.0-headers libbz2-dev \
   libtinyxml-dev libportaudio2 portaudio19-dev libcurl4-openssl-dev libexpat1-dev \
   libcairo2-dev wx3.0-i18
   ... 0 upgraded, 105 newly installed, 1 to remove and 0 not upgraded. (as of Feb 18, 2018)


The default build image does not have enough swap space for the compile so I plugged in a USB SSD that had alinux installed once and setup that swap partition:

mkswap -f /dev/sda2
swapon /dev/sda2
armbian-config   # set hostname to cpn and TZ to Asia/Taipei


Now to get and compile OpenCPN source as a normal user:

git clone https://github.com/OpenCPN/OpenCPN.git  
git ccheckout v4.8.2
cd OpenCPN; mkdir build; cd build
cmake -DCFLAGS="-O2 -march=native" -DBUNDLE_DOCS=OFF -DBUNDLE_TCDATA=OFF -DBUNDLE_GSHHS=CRUDE ../
make package
dpkg -i /home/larryl/OpenCPN/build/opencpn_4.8.2-1_armhf.deb 

******** errors *******
dpkg: dependency problems prevent configuration of opencpn:
 opencpn depends on libwxgtk3.0-0; however:
  Package libwxgtk3.0-0 is not installed.
 opencpn depends on libtinyxml2.6.2; however:
  Package libtinyxml2.6.2 is not installed.
******** errors *******


So this is the reason I hate Ubuntu, needlessly changing the package name instead of the revision fields so the dependencies no longer match the "new package name"!!! So adjust the depends in the package description file for the variable ending in "PACKAGE_DEPS" about line 98:

vi ../CMakeLists.txt
SET (PACKAGE_DEPS "libc6, libwxgtk3.0-0v5, wx3.0-i18n, libglu1-mesa (>= 7.0.0), \
  libgl1-mesa-glx (>= 7.0.0), zlib1g, bzip2, libtinyxml2.6.2v5, libportaudio2")


Add the v5 to the dependencies as above

cmake -DCFLAGS="-O2 -march=native" -DBUNDLE_DOCS=OFF -DBUNDLE_TCDATA=ON -DBUNDLE_GSHHS=LOW ../
make package
sudo dpkg -i /home/larryl/OpenCPN/build/opencpn_4.8.2-1_armhf.deb


If you have unmet dependencies, you can attempt to fix them with:

sudo apt install -f

Ready to configure OpenCPN with charts, tide data, connections and your favorite settings.

PS: The finished package should soon be up on github repositories.

No comments:

Post a Comment