Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pypilot plugin rejected on Ubuntu 22.04 #37

Closed
marcobergman opened this issue Nov 13, 2023 · 25 comments
Closed

Pypilot plugin rejected on Ubuntu 22.04 #37

marcobergman opened this issue Nov 13, 2023 · 25 comments

Comments

@marcobergman
Copy link

Installing Ubuntu desktop 22.04 and opencpn from ppa:opencpn/opencpn, the pypilot plugin is non-functional, then rejected right after restart of opencpn.

The opencpn.log file mentions undefined symbol: _ZNK13wxGLCanvasEGL15IsShownOnScreenEv, version WXU_3.2 (see below).

Starting OCPN with Wayland disabled (GDK_BACKEND=x11 opencpn or putting WaylandEnable=false in /etc/gdm3/custom.conf) does not solve the problem.

14:23:11.973 MESSAGE update_mgr.cpp:222 Selected update: pypilot
14:23:11.980 MESSAGE pluginmanager.cpp:572 Installing pypilot
14:23:11.980 MESSAGE plugin_handler.cpp:1248 Installing pypilot_pi-0.40.30.0-ubuntu-x86_64-22.04-jammy.tar.gz from local cache
14:23:11.982 MESSAGE plugin_handler.cpp:712 archive finish write error: Can't restore time
14:23:11.982 MESSAGE plugin_handler.cpp:712 archive finish write error: Can't restore time
14:23:12.007 MESSAGE plugin_loader.cpp:1143 Plugin is compatible by elf library scan: true
14:23:12.016 MESSAGE plugin_loader.cpp:246 PluginLoader: loading plugins from /home/marcb/.local/lib/opencpn;/usr/lib/opencpn
14:23:12.016 MESSAGE plugin_loader.cpp:162 Using LD_LIBRARY_PATH: /home/marcb/.local/lib/opencpn:/usr/lib/opencpn:/home/marcb/.local/lib/opencpn:/usr/lib/opencpn:/home/marcb/.local/lib/opencpn:/usr/lib/opencpn
14:23:12.016 MESSAGE plugin_loader.cpp:194 Using PATH: /home/marcb/.local/bin:/usr/bin:/home/marcb/.local/bin:/usr/bin:/home/marcb/.local/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin
14:23:12.016 MESSAGE plugin_loader.cpp:251 Loading plugins from dir: /home/marcb/.local/lib/opencpn
14:23:12.016 MESSAGE plugin_loader.cpp:444 PluginLoader searching for PlugIns in location /home/marcb/.local/lib/opencpn
14:23:12.017 MESSAGE plugin_loader.cpp:482 Found 1 candidates
14:23:12.017 MESSAGE plugin_loader.cpp:271 Checking plugin candidate: /home/marcb/.local/lib/opencpn/libpypilot_pi.so
14:23:12.017 MESSAGE plugin_loader.cpp:336 Checking plugin compatibility: /home/marcb/.local/lib/opencpn/libpypilot_pi.so
14:23:12.017 MESSAGE plugin_loader.cpp:1143 Plugin is compatible by elf library scan: true
14:23:12.017 MESSAGE plugin_loader.cpp:1206 PluginLoader: Loading PlugIn: /home/marcb/.local/lib/opencpn/libpypilot_pi.so
14:23:12.018 ERROR dlunix.cpp:120 Failed to load shared library '/home/marcb/.local/lib/opencpn/libpypilot_pi.so': /home/marcb/.local/lib/opencpn/libpypilot_pi.so: undefined symbol: _ZNK13wxGLCanvasEGL15IsShownOnScreenEv, version WXU_3.2
14:23:12.018 MESSAGE plugin_loader.cpp:1251 Ignoring blacklisted plugin libpypilot_pi
14:23:12.018 MESSAGE plugin_loader.cpp:1261 PluginLoader: Cannot load library: /home/marcb/.local/lib/opencpn/libpypilot_pi.so
14:23:12.018 MESSAGE plugin_loader.cpp:251 Loading plugins from dir: /usr/lib/opencpn
@seandepagnier
Copy link
Member

Is this still relevant? Does it occur building from source?

@marcobergman
Copy link
Author

marcobergman commented Dec 27, 2023

With 0.40.31.0 I'm afraid so; still the same message in the log as shown above. Ubuntu up to date (apt upgrade):

image

@marcobergman
Copy link
Author

marcobergman commented Dec 27, 2023

Compiling is very difficult for me on Ubuntu, even with this trick: https://syzeehond.blogspot.com/2023/11/various-tricks.html

Now I'm getting this:

-- CMakeLists: Adding target link libraries to pypilot_pi
CMake Error at CMakeLists.txt:235 (add_subdirectory):
  add_subdirectory given source "opencpn-libs/api-17" which is not an
  existing directory.

@seandepagnier
Copy link
Member

seandepagnier commented Dec 27, 2023 via email

@marcobergman
Copy link
Author

marcobergman commented Dec 27, 2023

That did the trick! You might want to put this in the README. The repository now shows a rather useless legal thing.

marcb@ubuntu2204:~/pypilot_pi$ git submodule init
Submodule 'opencpn-libs' (https://github.com/OpenCPN/opencpn-libs.git) registered for path 'opencpn-libs'
marcb@ubuntu2204:~/pypilot_pi$ git submodule update
Cloning into '/home/marcb/pypilot_pi/opencpn-libs'...
Submodule path '../opencpn-libs': checked out 'a001083af21de2e3faa970b245877a5ee5899aba'
marcb@ubuntu2204:~/pypilot_pi/build$ cmake ..

@marcobergman
Copy link
Author

And it works! It installs in /usr/local/lib/opencpn/ where it is not found by opencpn, which looks in /usr/lib/opencpn/. Copying it there does not work, but copying it to ~/.local/lib/opencpn/ did the trick:

image

@seandepagnier
Copy link
Member

Yes, well either the install script needs to go into ~/.local or opencpn should load plugins from /usr/local (I hacked mine so it does) Not sure what the eventual solution will be.

@rgleason
Copy link
Contributor

@marcobergman Marco, can you try the new version in PIM 0.40.31? Hopefully it works now. If so, please close this. Thanks.

@marcobergman
Copy link
Author

marcobergman commented Dec 27, 2023

I checked that (i.e. PIM 0.40.31) earlier and I just checked it again, but the one from the master plugin catalog invariantly creates the problems described in this issue. The one compiled straight from github doet not create those problems.

@rgleason
Copy link
Contributor

Thanks, sent to Dave, perhaps he has some ideas.

@bdbcat
Copy link
Contributor

bdbcat commented Dec 27, 2023

Marco...
Please clarify:
How did you build and install the version that works? Details, please?

@rgleason
Copy link
Contributor

rgleason commented Dec 27, 2023

Dave, Marco wrote 3 hrs ago:

I checked that (i.e. PIM 0.40.31) #37 (comment) and I just checked it again, but the one from the master plugin catalog invariantly creates the problems described in this issue. The one compiled straight from github doet not create those problems.

Its weird...

@rgleason
Copy link
Contributor

Marco, do other TP FE2 plugins from PIM fail like this? Climatology 1.6.31, Squiddio 1.3.91, Autopilot_route 0.4.31?

@dave: Also suggest reading what Sean wrote above about location.

@bdbcat
Copy link
Contributor

bdbcat commented Dec 27, 2023

I need to see Marco's exact configuration and CLI commands which built a working plugin. How, exactly, do they differ from the canonical CCI build and workflow?

@bdbcat
Copy link
Contributor

bdbcat commented Dec 27, 2023

For Sean:
This problem is unique to PyPilot. It is the only FE2 plugin that uses a "bare" wxGLCanvas, for the calibration windows. Nothing objectively wrong with this implementation on paper, but it generates a link error on Ubuntu 22.04. Sometimes...

The other new plugin builds mentioned by Rick above load and run on ubuntu 22.04 just fine.

@marcobergman
Copy link
Author

marcobergman commented Dec 27, 2023

Ok sorry for the delay, this is what I did:

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
cmake ..
vi ../cmake/PluginConfigure.cmake
cmake ..
make
sudo make install
cp /usr/lib/opencpn/libpypilot_pi.so ~/.local/lib/opencpn/

The edit that I made to PluginConfigure.cmake was to circumvent the problems I get within this constellation regarding wxwidgets. I have struggled before with that compiling plugins on Ubuntu, the solution appeared to disable GTK2, as described in this link. You and/or Rick could not recognize this issue in the past (I think, will dig up details after this), so I got the solution from somewhere else.

@marcobergman
Copy link
Author

Oh, and I added WaylandEnable=false to /etc/gdm3/custom.conf, further to this exchange.

@marcobergman
Copy link
Author

marcobergman commented Dec 27, 2023

If I undo the changes to PluginConfigure.cmake, I'll get this:

-- PluginConfigure: wxWidgets_Version:
-- PluginConfigure: wxWidgets components: base;core;net;xml;html;adv;aui;gl
CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES wxWidgets_INCLUDE_DIRS)
Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.22/Modules/FindwxWidgets.cmake:1025 (find_package_handle_standard_args)
  cmake/PluginConfigure.cmake:547 (find_package)
  CMakeLists.txt:138 (include)
-- Configuring incomplete, errors occurred!

@rgleason
Copy link
Contributor

Why aren't you installing the plugin from PIM (Plugin Manager?) and why didn't you make this clear to begin with?

@bdbcat
Copy link
Contributor

bdbcat commented Dec 27, 2023

Marco...
I follow your process.
I think you can avoid the need for editing PluginConfigure.cmake, if you do this in the shell running your build:

$ export BUILD_GTK3=TRUE
Will you confirm that please? My 22.04 machine is unavailable at the moment.

@marcobergman
Copy link
Author

Confirmed on 22.04, thx!

@bdbcat
Copy link
Contributor

bdbcat commented Dec 27, 2023

Marco...
OK. If possible can you run (on the working version)

$ ldd ~/.local/lib/opencpn/libpypilot.so

And, if not too much trouble, get the latest tarball from Cloudsmith, extract it, and run "ldd" against the libpypilot.so found in the tarball?
Here is a link to the current CI build, which fails to install.

https://dl.cloudsmith.io/public/opencpn/pypilot-prod/raw/names/pypilot_pi-0.40.31.0-ubuntu-x86_64-wx32-22.04-jammy-tarball/versions/v0.40.31.0/pypilot_pi-0.40.31.0-ubuntu-x86_64-22.04-jammy.tar.gz

Obviously, we are looking for differences in the output of "ldd" for the two cases.
Thanks
Dave

@marcobergman
Copy link
Author

marcobergman commented Dec 28, 2023

I presume you meant libpypilot_pi.so. If I strip the hex addresses off the output of ldd, the output is identical. The .so files have quite different sizes, though. This is what I did, output attached:

$ #After compile:
$ ldd ~/.local/lib/opencpn/libpypilot_pi.so > ~/compiled_from_source.txt
$ ls -al ~/.local/lib/opencpn/libpypilot_pi.so
-rw-r--r-- 1 marcb marcb 1232744 dec 27 14:44 /home/marcb/.local/lib/opencpn/libpypilot_pi.so
$ mv ~/compiled_from_source.txt ~/compiled_from_source_1232744.txt

$ #After reinstall from PIM
$ ls -al ~/.local/lib/opencpn/libpypilot_pi.so
-rw-r--r-- 1 marcb marcb 1042568 dec 26 23:25 /home/marcb/.local/lib/opencpn/libpypilot_pi.so
$ ldd ~/.local/lib/opencpn/libpypilot_pi.so > ~/from_pim_0.40.31.0_1042568.txt

$ diff  ~/compiled_from_source_1232744.txt ~/from_pim_0.40.31.0_1042568.txt > diff.txt

$ cut -d " " -f 3 compiled_from_source_1232744.txt > compiled_from_source.txt
$ cut -d " " -f 3 from_pim_0.40.31.0_1042568.txt > from_pim_0.40.31.0.txt
$ diff compiled_from_source.txt from_pim_0.40.31.0.txt
$ diff compiled_from_source.txt from_pim_0.40.31.0.txt > diff2.txt

compiled_from_source_1232744.txt
compiled_from_source.txt
from_pim_0.40.31.0_1042568.txt
from_pim_0.40.31.0.txt
diff.txt
from_tarball_1042568.txt
from_tarball.txt

diff2.txt is empty
the file from the tarball is identical to the one from PIM, al least the size and the modules; the hex addresses are different

@bdbcat
Copy link
Contributor

bdbcat commented Dec 29, 2023

Marco...
Thanks to your help, we have resolved this trouble. The root cause was that the CI builds were using the incorrect version of wxWidgets. CI was using 3.2.1, but it should have matched the OCPN build using 3.2.2.

Please update the plugin catalog, load pypilot_pi v0.40.31.2, and confirm/close.

Thanks again

@marcobergman
Copy link
Author

Good to hear, I checked it and issue closed. Thanks for all you guys' persistence!

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants