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)
- 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.
- 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.
- Get wxWidgets 3.0.0 tar file from the wxWidgets site and extract into your home folder (i.e. tar xvf …).
- 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)
- Install wxWidgets: type sudo make install
- Type sudo ldconfig to install the linkages that OpenCPN will need
- At this point, follow the OpenCPN Linux install instructions, which I’ve summarized here…
- Get OpenCPN required libraries via apt-get
- Get OpenCPN from git
- These instructions are not on their web site and are specific to 3.0.0: Edit CMakeLists.txt using leafpad
- 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
- There are other references to installing via rpm or suse – since we are on debian, don’t need to touch those.
- Comment out line that starts STRING REGEX 2.9 with #
- While searching for wx, if the version matches 2.9, change it to 3.0 in three places
- OK, back to the instructions on the OpenCPN web site: In OpenCPN folder, mkdir build and cd into it
- type cmake ../
- Notice that as it processes the libraries you should see it refer to wxWidgets 3.0.0, not 2.8.12
- type make
- Now – you will get some errors during the compile in three files, fix them as follows
- 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
- TODO: deprecated methods
- 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
- 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
- Everything should compile and link successfully
- type sudo make install
- Open a terminal window in your home folder and type opencpn
- After it starts successfully and you are in the normal view, open the options (the wrench) and turn off Quilting, click OK
- Exit and cd into the newly created hidden folder called .opencpn
- type leafpad opencpn.conf
- 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.
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.
Have you tried the new optimized-code version of the OpenCPN??
http://www.cruisersforum.com/forums/showthread.php?p=1506022#post1506022
Thank you for letting me know about this raspberry pi code branch of OpenCPN. I will be investigating it – looks promising.