bdbcat / oesenc_pi

GNU General Public License v2.0
10 stars 17 forks source link

Flatpak Build - Error Creating Fingerprint file check OpenCpn Log file #92

Closed grhitch closed 4 years ago

grhitch commented 4 years ago

I really appreciate the enormous amount of work that is put into this, and like the direction that you are going using Flatpaks.

I am trying to setup OCPN on a Debian Buster machine.. So I thought I would have a go at preparing some flatpak plugins following Alec Leamas's instructions. I decided to start with S63. After quite a bit of fiddling I am able to package it OK, but ran into problems finding the helper file OCPNsenc. Assuming that I had done something wrong patching the code I decided to implement oesenc in a clean installation to see how it worked as both builds put the binary in a similar location.

The result was identical behaviour. That is, the helper oeserverd file was not found. If you install using the downloaded tar.gz file, the binary is installed in a location that can be found. However, installing from a flatpak this is not the case. The problem shows up when trying to create a fingerprint file.

The error message is "Error Creating Fingerprint file check OpenCpn Log file".

The location of oeserverd is: .local/share/flatpak/runtime/org.opencpn.OpenCPN.Plugin.oesenc/x86_64/master/82dd699196b56c5684d9fc0d06167d53dc5f125077faafbbfa3596ce7e8b4774/files/bin/oeserverd

In the flatpak build directory it is in app/files/bin/.

The steps were: Clean out any OCPN files from .var and .local and check that there are no others anywher else.

Install OpencpnFlatpak from opencpn.duckdns Branch: master Commit: d605f634dbb34e1f32dfe2db0e91a3507e80ec103e7b0514eed4d8638fa9e14d

Do not install any plugins

Download and build oesenc_pi from github Branch: master Last GIT Commit: 281eb4434640dbec5fdea98beb7f59d43120ddc0 In oesenc_pi/buildlinux64: cmake -DOCPN_FLATPAK=ON build flatpak-build In oesenc_pi/flatpak execute: make build build install

Start OpenCPN From Plugins oesenc select preferences Select Create System Identifier File Error Creating Fingerprint file check OpenCpn Log file

Extract from logfile given below: 14:09:06.004 MESSAGE pluginmanager.cpp:1408 PlugInManager: Initializing PlugIn: /app/extensions/lib/opencpn/liboesenc_pi.so 14:09:06.007 WARNING oesenc_pi.cpp:677 Cannot locate oeserverd binary in $PATH 14:09:06.007 MESSAGE oesenc_pi.cpp:739 Path to oeserverd is: 14:09:06.063 MESSAGE oesenc_pi.cpp:3849 IsDongleAvailable()::oeserverd execution results: 14:09:06.063 MESSAGE oesenc_pi.cpp:3857 IsDongleAvailable()::oeserverd execution error: 14:09:06.063 MESSAGE oesenc_pi.cpp:3860 execvp(-s) failed with error 2! 14:09:06.064 MESSAGE oesenc_pi.cpp:3873 IsDongleAvailable()::oeserverd execution error: 14:09:06.064 MESSAGE oesenc_pi.cpp:3876 execvp(-s) failed with error 2! 14:09:06.064 MESSAGE oesenc_pi.cpp:744 No Dongle detected 14:09:06.220 MESSAGE chartsymbols.cpp:800 ChartSymbols loaded from /app/share/opencpn/s57data/chartsymbols.xml 14:09:46.729 MESSAGE chart1.cpp:7524 LOGBOOK: 2020-05-26 04:09:46 UTC DR Lat 33.35800 Lon -79.28200 14:09:48.775 MESSAGE oesenc_pi.cpp:3952 Create FPR command: -g "/home/greg/.var/app/org.opencpn.OpenCPN/config/opencpn/" 14:09:48.842 MESSAGE oesenc_pi.cpp:3964 execvp(-g, /home/greg/.var/app/org.opencpn.OpenCPN/config/opencpn/) failed with error 2! 14:09:48.842 MESSAGE oesenc_pi.cpp:4096 oesenc_pi: oeserverd results: 14:09:48.842 MESSAGE oesenc_pi.cpp:4099 execvp(-g, /home/greg/.var/app/org.opencpn.OpenCPN/config/opencpn/) failed with error 2!

It is quite possible that I have done something wrong, but I think I have followed all of the instructions fully. Thanks and Regards

hreuver0183 commented 4 years ago

Did you install with? $ flatpak install --user http://opencpn.duckdns.org/opencpn-beta/opencpn.flatpakref

Normally one would expect oeserverd under: /home/{USER}/.var/app/org.opencpn.OpenCPN/bin/oeserverd

When you type flatpak list the installation is supposed to be found under user, not under system

grhitch commented 4 years ago

Thanks for your reply. Looks like I didn't have the beta. So, to be able to answer properly I wiped everything including manual file deletes where necessary and then installed the beta (yes as user). The result is exactly the same. Your response is a bit puzzling as the binary helper is not installed by OpenCPN. It is only installed with the plugin. The oeservd file will appear where you say if you install the plugin from the repository. This is not the problem I am trying to solve. The problem I have is to get the binary helper in an appropriate location when installing the plugin with flatpak. This is the problem I am trying to solve. I am doing this so that I can use the approach on other plugins that aren't yet available in the repository. Thanks Greg

bdbcat commented 4 years ago

Greg... This build mode for a flatpak plugin has not really been tested at all. All production builds are using a CI process to package tarballs, which are then installed by OCPN at run-time. But lets take a look... From the console output of your "install" step, where exactly is the oeserverd being installed? Dave

grhitch commented 4 years ago

Hi Dave, thanks for the reply. Yes I guessed that that was the case as it is difficult even to build and install the tar.gz unless you use the CI process. In doing this I was hoping to be able to advance the cause even though I don't have a lot of experience in build systems. To your question:

After install, the follwing files are found in /home/greg/.local/share/flatpak/runtime/org.opencpn.OpenCPN.Plugin.oesenc/x86_64/master/f758f5ff57fd4fd2e743fb1c07d15abe7eb54e5a83ea1049dbd4baeba3c69169/files/bin/: libsgllnx64-2.29.02.so oeserverd oeserverd.prog

I hope that answers your question Greg

grhitch commented 4 years ago

I have found a solution. I am not sure if it is the best solution, but it does look right to me. I started by checking path in use with flatpak (from the log) as follows:

MESSAGE pluginmanager.cpp:1047 Using PATH: /home/greg/.var/app/org.opencpn.OpenCPN/bin /app/extensions/bin /app/bin /home/greg/.var/app/org.opencpn.OpenCPN/bin /app/extensions/bin /app/bin /app/bin /usr/bin

I found by executing the following command that I could see how the overlays are mapped by flatpak: flatpak run --devel --command=sh --system-talk-name=org.freedesktop.login1 / org.opencpn.OpenCPN The binaries were found at /app/extensions/oesenc/bin. Clearly this is not in the path being searched.

I then changed line 30 in the .yaml file by add ";bin" to the end as follows: 27 add-extensions: 28 org.opencpn.OpenCPN.Plugin: 29 directory: extensions 30 merge-dirs: lib/opencpn;share/opencpn/plugins;share/locale;bin 31 subdirectories: true 32 no-autodownload: true 33 autodelete: false

This results in links being placed in /app/extensions/bin which is in the search path.

/app/extensions/bin/libsgllnx64-2.29.02.so -> /app/extensions/oesenc/bin/libsgllnx64-2.29.02.so /app/extensions/bin/oeserverd -> /app/extensions/oesenc/bin/oeserverd /app/extensions/bin/oeserverd.prog -> /app/extensions/oesenc/bin/oeserverd.prog

Now, after wiping and reinstalling OpenCPN and oesenc_pi, everything works as it should.

I would be happy to create a PR if you deem this appropriate. If so, should I do it through opencpn/OpenCPN or leamas/OpenCPN?

Greg

grhitch commented 4 years ago

Closing as I have proposed a solution. Have raised this PR #https://github.com/leamas/OpenCPN/pull/5#issue-428962650