Various tricks

To compile an OpenCPN plugin from github, first clone it, and perform the Debian/Ubuntu canonical way to install build depencies:

$ sudo apt install devscripts equivs
$ sudo mk-build-deps -i -r ci/control
$ sudo apt-get --allow-unauthenticated install -f

Then, to get rid of the wxwidgets conundrum, make the following change:

diff --git a/cmake/PluginConfigure.cmake b/cmake/PluginConfigure.cmake


@@ -198,13 +198,13 @@ endif()
if(NOT WIN32 AND NOT APPLE AND NOT QT_ANDROID)
find_package(GTK2)
- if(GTK2_FOUND AND NOT "$ENV{BUILD_GTK3}" STREQUAL "TRUE")
- set(wxWidgets_CONFIG_OPTIONS ${wxWidgets_CONFIG_OPTIONS} --toolkit=gtk2)
- include_directories(${GTK2_INCLUDE_DIRS})
- set(GTK_LIBRARIES ${GTK2_LIBRARIES})
- set(PKG_BUILT_WITH_GTK "gtk2")
- message(STATUS "${CMLOC}Building against GTK2...")
- else(GTK2_FOUND AND NOT "$ENV{BUILD_GTK3}" STREQUAL "TRUE")
+ #if(GTK2_FOUND AND NOT "$ENV{BUILD_GTK3}" STREQUAL "TRUE")
+ #set(wxWidgets_CONFIG_OPTIONS ${wxWidgets_CONFIG_OPTIONS} --toolkit=gtk2)
+ #include_directories(${GTK2_INCLUDE_DIRS})
+ #set(GTK_LIBRARIES ${GTK2_LIBRARIES})
+ #set(PKG_BUILT_WITH_GTK "gtk2")
+ #message(STATUS "${CMLOC}Building against GTK2...")
+ #else(GTK2_FOUND AND NOT "$ENV{BUILD_GTK3}" STREQUAL "TRUE")
find_package(GTK3)
if(GTK3_FOUND)
include_directories(${GTK3_INCLUDE_DIRS})
@@ -217,7 +217,7 @@ if(NOT WIN32 AND NOT APPLE AND NOT QT_ANDROID)
message(STATUS "${CMLOC} Unix: Neither FATAL_ERROR GTK2 nor GTK3")
set(PKG_BUILT_WITH_GTK "")
endif(GTK3_FOUND)
- endif(GTK2_FOUND AND NOT "$ENV{BUILD_GTK3}" STREQUAL "TRUE")
+ #endif(GTK2_FOUND AND NOT "$ENV{BUILD_GTK3}" STREQUAL "TRUE")
set(EXTRA_LIBS ${EXTRA_LIBS} ${GTK_LIBRARIES})
else()
set(PKG_BUILT_WITH_GTK "${PKG_TARGET_GTK}")

That should do it. On Ubuntu 20.04, the sudo make install puts the _pi.so file in /usr/local/lib/opencpn/; you might have to move it. sudo make package creates a .tar.gz file, but it lacks metadata so it cannot be imported. 

Comments

Marco Bergman said…
Post to myself: the problem with GTK can also be solved with
export BUILD_GTK3=TRUE
Marco Bergman said…
sudo apt-get update
sudo apt-get upgrade
sudo apt install devscripts equivs
sudo mk-build-deps -i -r ci/control
sudo apt-get --allow-unauthenticated install -f
git clone https://github.com/pypilot/pypilot_pi
cd pypilot_pi/
git submodule init
git submodule update
mkdir build
cd build
export BUILD_GTK3=TRUE
cmake ..
make
sudo make install
cp /usr/lib/opencpn/libpypilot_pi.so ~/.local/lib/opencpn/

Popular posts from this blog

Stellendam v.v.

Singlehanded 2022