OpenCPN on Low-power ARM Processor

OpenCPN is a navigation program created and maintained by David Register that displays electronic charts and connects to GPS “hockey pucks” usually via USB.

I’ve managed to run OpenCPN on an ARM processor, specifically on both pcDuino and Raspberry Pi. This is not that hard if you follow the instructions for compiling OpenCPN on Linux. The tough part is making it work reliably over time. Running under Windows, code reliability isn’t a problem, but ARM, it seems, causes grief for the C++ code in which OpenCPN is written.

UPDATE: Person who posted indicates that this branch of OpenCPN is optimized for Raspberry Pi: I am investigating how well it works in this application:

https://github.com/seandepagnier/OpenCPN.git

and more details here:

http://www.cruisersforum.com/forums/f134/optimized-opencpn-testers-needed-118554.html

As root (or preface most commands with sudo):
apt-get update
apt-get install -y libgtk2.0-dev gettext git-core cmake gpsd gpsd-clients \
libgps-dev build-essential wx-common libwxgtk2.8-dev \
libglu1-mesa-dev libgtk2.0-dev wx2.8-headers \
libbz2-dev libtinyxml-dev libsdl1.2debian xcalib

git clone https://github.com/seandepagnier/OpenCPN.git
cd OpenCPN/
mkdir build
cd build
cmake ../
make;make install

 

Learn more about the pcDuino in my writeup.

I managed to find a way to improve reliability – build OpenCPN with the latest 3.0.0 wxWidgets library instead of the 2.8.12 that comes default with Linux. After doing so, the ENC (vector) charts require quite a bit of scrolling and zooming to get the program to crash, whereas with the older library it didn’t take much (on either pcDuino or Raspberry Pi)

Here are the instructions on how to build for the pcDuino. The instructions are similar for the Raspberry Pi (the wxWidgets part). The presumption is that you know a minimal amount about Linux and code files.

Building OpenCPN (version 1117)

  1. Install the lubuntu OS as instructed on the pcDuino site onto a 16GB microSDHC card. You can probably do all this on a clean 8GB card and still install a state’s worth of RNC and ENC charts. You should be fine with 8GB if you can figure out how to cross-compile on a Windows PC and then install the resulting binaries.
  2. If using the 512 MB version, you will need to setup a swap file or partition. These instructions worked perfectly for me. Follow them to the letter and setup a 512 MB swap file.
  3. Get wxWidgets 3.0.0 tar file from the wxWidgets site and extract into your home folder (i.e. tar xvf …).
  4. Build wxWidgets by first creating a folder in their folder, i.e. mkdir gtkwidget, then cd into that folder, then type ../configure then type make. Go out and have dinner because it will take awhile (about 2 hours)
  5. Install wxWidgets: type sudo make install
  6. Type sudo ldconfig to install the linkages that OpenCPN will need
  7. At this point, follow the OpenCPN Linux install instructions, which I’ve summarized here…
  8. Get OpenCPN required libraries via apt-get
  9. Get OpenCPN from git
  10. These instructions are not on their web site and are specific to 3.0.0: Edit CMakeLists.txt using leafpad
  11. Search for wx – first reference to wx has a 2.8 after it and then close by a 2.9. Change the 2.9 to 3.0
  12. There are other references to installing via rpm or suse – since we are on debian, don’t need to touch those.
  13. Comment out line that starts STRING REGEX 2.9 with #
  14. While searching for wx, if the version matches 2.9, change it to 3.0 in three places
  15. OK, back to the instructions on the OpenCPN web site: In OpenCPN folder, mkdir build and cd into it
  16. type cmake ../
  17. Notice that as it processes the libraries you should see it refer to wxWidgets 3.0.0, not 2.8.12
  18. type make
  19. Now – you will get some errors during the compile in three files, fix them as follows
  20. src/chcanv.cpp – line 10689 – There is a #if check for 2.9.0 – remove all the five lines or so starting at #if and ending at #endif except for the line right after the #else
  21. TODO: deprecated methods
  22. src/OCPNRegion.cpp – line 470 add cast in #else just like in the one above for #ifdef, or just keep the line after the #else and remove the other four of five lines between and including #if and #endif
  23. src/scrollingdialog.cpp – Add #if 0 at start of file and #endif to be very last line (or fix in CMakeLists.txt first, then you won’t get an error here). Essentially we don’t want this file to be compiled
  24. Everything should compile and link successfully
  25. type sudo make install
  26. Open a terminal window in your home folder and type opencpn
  27. After it starts successfully and you are in the normal view, open the options (the wrench) and turn off Quilting, click OK
  28. Exit and cd into the newly created hidden folder called .opencpn
  29. type leafpad opencpn.conf
  30. Add the following two lines right after the [Settings] line

MEMCacheLimit=50
NCacheLimit=4

Restart and import your charts. You should now be able to zoom into charts and pan them without crashes.

 

4 thoughts on “OpenCPN on Low-power ARM Processor

  1. i have do that but i’ve a problem , the folder is created, what i have to do after, check directory to this folder, and then type …? when i write ../configure , nothing.
    thank you vey mutch.
    pascal

    4.Build wxWidgets by first creating a folder in their folder, i.e. mkdir gtkwidget, then cd into that folder, then type ../configure then type make. Go out and have dinner because it will take awhile (about 2 hours)

    • I realized I left out a lot of steps. What I did was download the bz2 compressed file from the wxWidgets web site via chromium. It placed it into ~/Downloads. I then opened a terminal window and cd Downloads. Then I did a tar xvf wxWidgets-3.0.0.0.tar.bz2 and this left a folder in the Downloads folder called wxWidgets-3.0.0. I created a folder wxWidgets in my home folder and moved the newly extracted folder wxWidgets-3.0.0 under it. Then, I cd ~/wxWidgets/wxWidgets-3.0.0, then I mkdir gtkbuild and cd gtkbuild. At this point if I do a pwd I get ~/wxwidgets/wxWidgets-3.0.0/gtkbuild. At this point I do a ../configure and it should run.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>