houmain / keymapper

A cross-platform context-aware key remapper.
GNU General Public License v3.0
257 stars 21 forks source link

[BUG] Cannot build on Ubuntu 22.04 #145

Closed Kochise closed 1 month ago

Kochise commented 1 month ago
$>apt policy libappindicator3-dev
libappindicator3-dev:
  Installed: (none)
  Candidate: 12.10.1+20.10.20200706.1-0ubuntu1
  Version table:
     12.10.1+20.10.20200706.1-0ubuntu1 500
        500 http://fr.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages
$>sudo apt-get install -y libappindicator3-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libayatana-appindicator3-1 : Conflicts: libappindicator3-1
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
$>apt show libayatana-appindicator3-1
Package: libayatana-appindicator3-1
Version: 0.5.90-7ubuntu2
Priority: optional
Section: libs
Source: libayatana-appindicator
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Ayatana Packagers <pkg-ayatana-devel@lists.alioth.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 89,1 kB
Provides: libappindicator3-1 (= 12.10)
Depends: libayatana-indicator3-7 (>= 0.6.0), libc6 (>= 2.4), libdbusmenu-glib4 (>= 0.4.2), libdbusmenu-gtk3-4 (>= 0.4.2), libglib2.0-0 (>= 2.37.3), libgtk-3-0 (>= 3.0.0)
Conflicts: libappindicator3-1
Replaces: libappindicator3-1
Homepage: https://github.com/AyatanaIndicators/libayatana-appindicator
Task: ubuntu-desktop-minimal, ubuntu-desktop, xubuntu-core, xubuntu-desktop, lubuntu-desktop, ubuntukylin-desktop, ubuntu-mate-core, ubuntu-mate-desktop, ubuntu-budgie-desktop, ubuntu-budgie-desktop-raspi
Download-Size: 25,0 kB
APT-Manual-Installed: no
APT-Sources: http://fr.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
Description: Ayatana Application Indicators (GTK-3+ version)
 A library and indicator to take menus from applications and place them in
 the panel.
 .
 This package contains shared libraries to be used by applications compiled
 against GTK-3+.

Problem is known but still unresolved :

https://bugs.launchpad.net/ubuntu/+source/libayatana-appindicator/+bug/1964964

https://www.reddit.com/r/debian/comments/pn1oia/what_happened_to_libappindicator31_in_debian_11/

https://github.com/transmission/transmission/issues/594

Regards.

ristomatti commented 1 month ago

Maybe this is related to a PPA you've got installed? I just created an LXC container from Ubuntu 22.04 LTS (minimum) image and was able to install the dependencies listed on the README with no issues. I had no issues building either, although this was a minimum install with no desktop environment.

$ uname -a
Linux ubuntu2204 5.15.0-105-generic #115~20.04.1-Ubuntu SMP Mon Apr 15 17:33:04 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

$ cat /etc/issue
Ubuntu 22.04.4 LTS \n \l

$ grep -Ev '^(#|$)' /etc/apt/sources.list      
deb http://archive.ubuntu.com/ubuntu jammy main restricted
deb http://archive.ubuntu.com/ubuntu jammy-updates main restricted
deb http://archive.ubuntu.com/ubuntu jammy universe
deb http://archive.ubuntu.com/ubuntu jammy-updates universe
deb http://archive.ubuntu.com/ubuntu jammy multiverse
deb http://archive.ubuntu.com/ubuntu jammy-updates multiverse
deb http://archive.ubuntu.com/ubuntu jammy-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu jammy-security main restricted
deb http://security.ubuntu.com/ubuntu jammy-security universe
deb http://security.ubuntu.com/ubuntu jammy-security multiverse
Kochise commented 1 month ago

Have desktop environment, because I guess the required packages makes sense in that regard.

Thank for trying though.

ristomatti commented 1 month ago

If you don't need the recently added tray indicator, I believe you could avoid installing that particular dependency with a build flag:

cmake -B -DENABLE_APPINDICATOR=false ./build
cmake --build ./build --config Release
ristomatti commented 1 month ago

...however if I interpret the CMakeLists.txt correctly, building a DEB package might still fail:

if(CMAKE_SYSTEM_NAME MATCHES "Windows")
  # ...
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
  set(CPACK_DEBIAN_PACKAGE_DEPENDS "libudev1, libusb-1.0-0, libappindicator3-1") # <--
  set(CPACK_DEBIAN_PACKAGE_SECTION utils)
  set(CPACK_RPM_PACKAGE_REQUIRES "libusb1, libxkbcommon, libappindicator-gtk3")
  set(CPACK_RPM_PACKAGE_LICENSE "GPLv3")
  set(CPACK_RPM_PACKAGE_GROUP "System Environment/Daemons")
endif()
ristomatti commented 1 month ago

Does it also prevent installing the prebuilt release package?

Kochise commented 1 month ago

Not tested the prebuild, building should be straightforward, especially considering libappindicator is obviously supposed to be superseded by libayatana-appindicator since, like, early 2022.

Package dependencies are a mess anyway, why would one replace another without much enhancement, requesting everybody to force upgrade their source code in the process ?

ristomatti commented 1 month ago

Agree it's a mess. If you think this is not a distro level issue but something that could be fixed on Keymapper's codebase, you'll need to wait for @houmain himself to respond. I'm not a C/C++ developer, just trying to contribute with the knowledge and tools I can come up with. 🙂

ristomatti commented 1 month ago

BTW I'm running Keymapper on Ubuntu 20.04 with Regolith Desktop / Gnome and have no issues building or installing on this either. Previously I had to disable Wayland support via a build flag but that is no longer needed as Wayland libs are automatically skipped.

Kochise commented 1 month ago

Yeah, obviously the problem arose with Ubuntu 22.04. Just my release. Karma is such a bitch.

houmain commented 1 month ago

Hi, the latest version also builds with libayatana-appindicator. It should be automatically selected when it is found. The provided .debs still depend on libappindicator for now.

ristomatti commented 1 month ago

Now I get an error when trying to install the official Ubuntu 20.04 release package:

$ sudo apt install ./keymapper-4.3.0-Linux.deb
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'keymapper' instead of './keymapper-4.3.0-Linux.deb'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies.
 keymapper : Depends: appindicator3-1 but it is not installable
E: Unable to correct problems, you have held broken packages.

There's no such package on Ubuntu 20.04 repositories. What I have is libappindicator3-1:

$ dpkg -l | grep appindicator
ii  gir1.2-appindicator3-0.1                    12.10.1+20.04.20200408.1-0ubuntu1           amd64        Typelib files for libappindicator3-1.
ii  gir1.2-ayatanaappindicator3-0.1             0.5.4-2                                     amd64        Typelib files for libayatana-appindicator3-1 (GTK-3+ version)
ii  libappindicator1                            12.10.1+20.04.20200408.1-0ubuntu1           amd64        Application Indicators
ii  libappindicator3-1                          12.10.1+20.04.20200408.1-0ubuntu1           amd64        Application Indicators
ii  libappindicator3-dev                        12.10.1+20.04.20200408.1-0ubuntu1           amd64        Application Indicators
ii  libayatana-appindicator3-1                  0.5.4-2                                     amd64        Ayatana Application Indicators (GTK-3+ version)

Building from source went through as before but I noticed libayatana-appindicator was not detected even though I apparently have it installed as well.

I then tried creating a DEB package, no issues there, but I still ended up with a package I could not install. I had no issue installing after I changed line 243 of CMakeLists.txt to this:

set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libappindicator3-1")

Out of curiosity I tried getting the ayatana version by changing line 218 to this:

pkg_check_modules(AYATANA_APPINDICATOR libayatana-appindicator3-1)

...but it still didn't get detected. I don't know if pkg_check_modules even should be used with the lib prefix(?) though. I skimmed over pkg_check_modules from CMake docs and noticed that it uses pkg-config to do the check, so I tried this:

$ pkg-config --exists appindicator3-0.1; echo $?
0

Based on the return status, the package was found (in fact I was able to autocomplete it). pkg-config does not seem to detect ayatana-appindicator3-0.1 nor ayatana-appindicator3-1 (matching the lib version dpkg shows installed).

$ apt show libayatana-appindicator3-1  
Package: libayatana-appindicator3-1
Version: 0.5.4-2
Priority: optional
Section: universe/libs
Source: libayatana-appindicator
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Ayatana Packagers <pkg-ayatana-devel@lists.alioth.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 84.0 kB
Depends: libayatana-indicator3-7 (>= 0.6.0), libc6 (>= 2.4), libdbusmenu-glib4 (>= 0.4.2), libdbusmenu-gtk3-4 (>= 0.4.2), libglib2.0-0 (>= 2.37.3), libgtk-3-0 (>= 3.0.0)
Homepage: https://github.com/AyatanaIndicators/libayatana-appindicator
Download-Size: 21.8 kB
APT-Manual-Installed: no
APT-Sources: http://mirrors.nic.funet.fi/ubuntu focal/universe amd64 Packages
Description: Ayatana Application Indicators (GTK-3+ version)
 A library and indicator to take menus from applications and place them in
 the panel.
 .
 This package contains shared libraries to be used by applications compiled
 against GTK-3+.

This is not an issue to me though since it works with the other library but I thought this might be useful info.

houmain commented 1 month ago

I think just the dependency "appindicator3-1" was wrong and is fixed now. I tried it now in the virtual machine and did not see a problem with libayatana-appindicator. @ristomatti did you install the developer package with sudo apt install libayatana-appindicator3-dev? The README advises now to install libayatana-appindicator3-dev and the next packages will also be built with it.

ristomatti commented 1 month ago

@houmain :man_facepalming:. It didn't even occur to me. Now it got detected. Also build, packaging and install all went through. :ok_hand: