vividnightmare / g510s

Graphical utility for Logitech G510 and G510s keyboards on Linux.
GNU General Public License v3.0
20 stars 3 forks source link

Package 'appindicator3-0.1', required by 'virtual:world', not found #28

Open Nocturna22 opened 10 months ago

Nocturna22 commented 10 months ago

Hello, i got some serious Problems.

humanity@0-Milky-Way:~/Programme/g510s$ make
cc  -fcommon -Wall `pkg-config --cflags gtk+-3.0 appindicator3-0.1` -c g510s.c -o g510s.o
Package appindicator3-0.1 was not found in the pkg-config search path.
Perhaps you should add the directory containing `appindicator3-0.1.pc'
to the PKG_CONFIG_PATH environment variable
Package 'appindicator3-0.1', required by 'virtual:world', not found
g510s.c:26:10: fatal error: gtk/gtk.h: Datei oder Verzeichnis nicht gefunden
   26 | #include <gtk/gtk.h>
      |          ^~~~~~~~~~~
compilation terminated.
make: *** [Makefile:4: g510s.o] Fehler 1

There are more dependency problems. I managed to fix them all, just to let the compile fail once again. So i deleted everything. Above is the first error without modifying anything.

This is the latest error i got, after trying hard to fix the problem.:

cc  -fcommon -Wall -c g510s-keys.c -o g510s-keys.o
g510s-keys.c: In function ‘process_keys’:
g510s-keys.c:114:14: error: ‘G15_KEY_PLAY’ undeclared (first use in this function); did you mean ‘G15_KEY_L5’?
  114 |   if ((key & G15_KEY_PLAY) && (key & G15_EXTENDED_KEY)
      |              ^~~~~~~~~~~~
      |              G15_KEY_L5
g510s-keys.c:114:14: note: each undeclared identifier is reported only once for each function it appears in
g510s-keys.c:114:38: error: ‘G15_EXTENDED_KEY’ undeclared (first use in this function)
  114 |   if ((key & G15_KEY_PLAY) && (key & G15_EXTENDED_KEY)
      |                                      ^~~~~~~~~~~~~~~~
g510s-keys.c:122:14: error: ‘G15_KEY_STOP’ undeclared (first use in this function); did you mean ‘G15_KEY_L5’?
  122 |   if ((key & G15_KEY_STOP) && (key & G15_EXTENDED_KEY)
      |              ^~~~~~~~~~~~
      |              G15_KEY_L5
g510s-keys.c:130:14: error: ‘G15_KEY_NEXT’ undeclared (first use in this function); did you mean ‘G15_KEY_LIGHT’?
  130 |   if ((key & G15_KEY_NEXT) && (key & G15_EXTENDED_KEY)
      |              ^~~~~~~~~~~~
      |              G15_KEY_LIGHT
g510s-keys.c:138:14: error: ‘G15_KEY_PREV’ undeclared (first use in this function); did you mean ‘G15_KEY_MR’?
  138 |   if ((key & G15_KEY_PREV) && (key & G15_EXTENDED_KEY)
      |              ^~~~~~~~~~~~
      |              G15_KEY_MR
g510s-keys.c:146:14: error: ‘G15_KEY_MUTE’ undeclared (first use in this function); did you mean ‘G15_KEY_MR’?
  146 |   if ((key & G15_KEY_MUTE) && (key & G15_EXTENDED_KEY)
      |              ^~~~~~~~~~~~
      |              G15_KEY_MR
g510s-keys.c:154:14: error: ‘G15_KEY_RAISE_VOLUME’ undeclared (first use in this function)
  154 |   if ((key & G15_KEY_RAISE_VOLUME) && (key & G15_EXTENDED_KEY)
      |              ^~~~~~~~~~~~~~~~~~~~
g510s-keys.c:162:14: error: ‘G15_KEY_LOWER_VOLUME’ undeclared (first use in this function)
  162 |   if ((key & G15_KEY_LOWER_VOLUME) && (key & G15_EXTENDED_KEY)
      |              ^~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:13: g510s-keys.o] Fehler 1
humanity@0-Milky-Way:~/Desktop/g510s (1)$ 

Now i don't know further.

vividnightmare commented 10 months ago

https://github.com/vividnightmare/g510s#build-deps

Nocturna22 commented 10 months ago

https://github.com/vividnightmare/g510s#build-deps

I know. I installed all of that. The problem is the appindicator3-0.1.


humanity@0-Milky-Way:~/Desktop/g510s-0.0.3$ sudo apt install libappindicator3-dev
Package lists are read... Done
Dependency tree is built... Done
Status information is read in... Done
Note: "libayatana-appindicator3-dev" is selected instead of "libappindicator3-dev".
libayatana-appindicator3-dev is already the latest version (0.5.92-1).
0 updated, 0 newly installed, 0 to be removed and 0 not updated.```
vividnightmare commented 10 months ago

https://packages.ubuntu.com/jammy/libappindicator3-dev

It's available for every active release of Ubuntu.

gderber commented 7 months ago

It's no longer available in debian trixie. Debian trixie has replaced it with https://packages.debian.org/trixie/libayatana-appindicator3-1

As of bullseye, libappinditactor3-1 was showing as a transitional package: https://packages.debian.org/bullseye/libappindicator3-1

vividnightmare commented 7 months ago

Strange that it is still provided in current Ubuntu, likely for this reason.

And, historically Debian has been against this type of migration for this exact reason. (This is why they still provide libusb 0.1 and libusb 1.0 instead of compat)

Either way, if there are dependency or compiler issues that result from the transition of one package to another, where said package is marked as "provided-by" the transitioned package, the bug lies against the newly transitioned package.

Unfortunately, I work upwards of 60 hours a week and I don't have the time to remedy this.

Patches, however, would be welcomed.

gderber commented 7 months ago

I'm willing to give it a try. I've never written straight C before (Mostly python these days, with very limited C++ about 20 years ago), so I would like some feedback as I go along. I have had to make some changes to libg15 as well, all in the debian folder, mostly updates to match the current debian version of libg15.

Changes thus far:

With g510s, libayatana-appindicator does not currently create a '/usr/lib/x86_64-linux-gnu/pkgconfig/libayatana-appindicator*.pc' so I've added the directory directly in the Makefile.

Currently the build fails at the last build step of the Makefile with:

cc  -fcommon -Wall g510s.o g510s-clock.o g510s-config.o g510s-keys.o g510s-list.o g510s-misc.o g510s-net.o g510s-signals.o g510s-threads.o -o g510s -lg15 -lg15render -lpthread -rdynamic `pkg-config --libs gtk+-3.0` -I/usr/include/libayata
na-appindicator3-0.1
/usr/bin/ld: g510s.o: in function `main':
g510s.c:(.text+0x1474): undefined reference to `app_indicator_new'
/usr/bin/ld: g510s.c:(.text+0x1494): undefined reference to `app_indicator_set_attention_icon'
/usr/bin/ld: g510s.c:(.text+0x14c3): undefined reference to `app_indicator_set_menu'
/usr/bin/ld: g510s.c:(.text+0x1e3e): undefined reference to `app_indicator_set_status'
/usr/bin/ld: g510s.c:(.text+0x1e54): undefined reference to `app_indicator_set_status'
/usr/bin/ld: g510s-threads.o: in function `key_function':
g510s-threads.c:(.text+0x3ff): undefined reference to `app_indicator_set_status'
/usr/bin/ld: g510s-threads.c:(.text+0x50a): undefined reference to `app_indicator_set_status'
/usr/bin/ld: g510s-threads.c:(.text+0x604): undefined reference to `app_indicator_set_status'
collect2: error: ld returned 1 exit status
make: *** [Makefile:31: g510s] Error 1

In general I don't like to submit "Work In Progress" patches, but I also would like feedback as I go. How would you like to handle this?

gderber commented 7 months ago

I will add, my current solution adjusting the makefile feels 'hackish' and I don't really like it. I haven't thought of a better solution yet.

vividnightmare commented 7 months ago

For the Debian package, I would just use their package and patch it. There is only one change between mine and the upstream, which corrects the buffer length to prevent double pressing keys.

https://github.com/vividnightmare/libg15/blob/132f4433347eb45b331abee9f5f06dce44db9ec8/libg15.c#L1317C2-L1320C6

The build issue is either that you need to #include the header for libayatana or that it doesn't provide those functions. In the latter case you could comment them out (if possible) or replace them with relevant functions that it provides. The proper way to do so would be to #ifdef HAVE_AYATANA or the like. I'd just get it to work and then figure out a proper solution.

https://github.com/AyatanaIndicators/libayatana-appindicator/blob/238c8b02718fa5b4af95ede72beeed762094f4cc/src/app-indicator.h#L260

Seems like it's present so it's probably not being included properly. Try pkg-config --libs gtk+-3.0 libayatana-appindicator3-0.1 (errors at linking)

gderber commented 7 months ago

Thank you! I got it to build, at least using make. It turns out, that debian is not very consistent with the libayatana- packages. for libayatana-ido3 installs 'libayatana-ido3.pc'. For libayatana-appindicator3 it install 'ayatana-appindicator3*.pc' (No leading 'lib') so I didn't think they provided that file. Once I found it, using that instead of my hackish solution helped things work.

dpkg-buildpackage fails. I'm running that down along with a couple other bugs.

Nocturna22 commented 4 months ago

Hello, it's me again. I've just tried again and got the same error... Is there anything I can do to fix it? :)

vividnightmare commented 4 months ago

Is your problem solved using the branch from gderber?

https://github.com/gderber/g510s/tree/bugfix/appindicator

vividnightmare commented 4 months ago
git clone --single-branch --branch bugfix/appindicator https://github.com/gderber/g510s.git
cd g510s
make
Nocturna22 commented 4 months ago
git clone --single-branch --branch bugfix/appindicator https://github.com/gderber/g510s.git
cd g510s
make

Yes, thanks, I was there too... But I'm having a different problem right now and I don't know if it's my fault, so I deleted the last post. I don't know if I installed libg15 correctly, because I get the following error with the commands you wrote:


(base) humanity@0-Milky-Way:~$ git clone --single-branch --branch bugfix/appindicator https://github.com/gderber/g510s.git
cd g510s
make
Klone nach 'g510s'...
remote: Enumerating objects: 82, done.
remote: Counting objects: 100% (15/15), done.
remote: Compressing objects: 100% (11/11), done.
remote: Total 82 (delta 6), reused 9 (delta 4), pack-reused 67
Empfange Objekte: 100% (82/82), 66.19 KiB | 1.95 MiB/s, fertig.
Löse Unterschiede auf: 100% (29/29), fertig.
cc  -fcommon -Wall `pkg-config --cflags gtk+-3.0 ayatana-appindicator3-0.1` -c g510s.c -o g510s.o
cc  -fcommon -Wall -c g510s-clock.c -o g510s-clock.o
cc  -fcommon -Wall -c g510s-config.c -o g510s-config.o
g510s-config.c: In function ‘check_dir’:
g510s-config.c:144:17: warning: the comparison will always evaluate as ‘false’ for the address of ‘home_path’ will never be NULL [-Waddress]
  144 |   if (home_path == NULL) {
      |                 ^~
g510s-config.c:137:8: note: ‘home_path’ declared here
  137 |   char home_path[255];
      |        ^~~~~~~~~
g510s-config.c:150:39: warning: argument to ‘sizeof’ in ‘strncpy’ call is the same expression as the source; did you mean to use the size of the destination? [-Wsizeof-pointer-memaccess]
  150 |   strncpy(full_path, home_path, sizeof(home_path));
      |                                       ^
g510s-config.c: In function ‘load_config’:
g510s-config.c:174:17: warning: the comparison will always evaluate as ‘false’ for the address of ‘home_path’ will never be NULL [-Waddress]
  174 |   if (home_path == NULL) {
      |                 ^~
g510s-config.c:167:8: note: ‘home_path’ declared here
  167 |   char home_path[255];
      |        ^~~~~~~~~
g510s-config.c:180:39: warning: argument to ‘sizeof’ in ‘strncpy’ call is the same expression as the source; did you mean to use the size of the destination? [-Wsizeof-pointer-memaccess]
  180 |   strncpy(full_path, home_path, sizeof(home_path));
      |                                       ^
g510s-config.c:181:39: warning: argument to ‘sizeof’ in ‘strncat’ call is the same expression as the source; did you mean to use the size of the destination? [-Wsizeof-pointer-memaccess]
  181 |   strncat(full_path, file_name, sizeof(file_name));
      |                                       ^
g510s-config.c: In function ‘save_config’:
g510s-config.c:205:17: warning: the comparison will always evaluate as ‘false’ for the address of ‘home_path’ will never be NULL [-Waddress]
  205 |   if (home_path == NULL) {
      |                 ^~
g510s-config.c:198:8: note: ‘home_path’ declared here
  198 |   char home_path[255];
      |        ^~~~~~~~~
g510s-config.c:211:39: warning: argument to ‘sizeof’ in ‘strncpy’ call is the same expression as the source; did you mean to use the size of the destination? [-Wsizeof-pointer-memaccess]
  211 |   strncpy(full_path, home_path, sizeof(home_path));
      |                                       ^
g510s-config.c:212:39: warning: argument to ‘sizeof’ in ‘strncat’ call is the same expression as the source; did you mean to use the size of the destination? [-Wsizeof-pointer-memaccess]
  212 |   strncat(full_path, file_name, sizeof(file_name));
      |                                       ^
cc  -fcommon -Wall -c g510s-keys.c -o g510s-keys.o
cc  -fcommon -Wall -c g510s-list.c -o g510s-list.o
cc  -fcommon -Wall -c g510s-misc.c -o g510s-misc.o
cc  -fcommon -Wall -c g510s-net.c -o g510s-net.o
g510s-net.c: In function ‘g15_recv’:
g510s-net.c:222:9: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
  222 |         memset(msgbuf, 0, 20);
      |         ^~~~~~
cc  -fcommon -Wall `pkg-config --cflags gtk+-3.0` -c g510s-signals.c -o g510s-signals.o
cc  -fcommon -Wall `pkg-config --cflags ayatana-appindicator3-0.1` -c g510s-threads.c -o g510s-threads.o
cc  -fcommon -Wall g510s.o g510s-clock.o g510s-config.o g510s-keys.o g510s-list.o g510s-misc.o g510s-net.o g510s-signals.o g510s-threads.o -o g510s -lg15 -lg15render -lpthread -rdynamic `pkg-config --libs gtk+-3.0 ayatana-appindicator3-0.1`
/usr/bin/ld: g510s.o: in function `main':
g510s.c:(.text+0x287): undefined reference to `setupLibG15'
/usr/bin/ld: g510s.c:(.text+0x2ba): undefined reference to `setupLibG15'
/usr/bin/ld: g510s-threads.o: in function `key_function':
g510s-threads.c:(.text+0x438): undefined reference to `setupLibG15'
/usr/bin/ld: g510s-threads.c:(.text+0x46b): undefined reference to `setupLibG15'
/usr/bin/ld: g510s-threads.c:(.text+0x532): undefined reference to `setupLibG15'
/usr/bin/ld: g510s-threads.o:g510s-threads.c:(.text+0x565): more undefined references to `setupLibG15' follow
collect2: error: ld returned 1 exit status
make: *** [Makefile:31: g510s] Fehler 1
vividnightmare commented 4 months ago

Right, setupLibG15 is defined in libg15.h

And I just built the branch, it builds but I can't confirm function at the moment.

Nocturna22 commented 4 months ago

Is there anything i can do, to test things out? 😊

vividnightmare commented 4 months ago

In what regard?

Were you able to get it built?

If so, do you have a functional tray icon? I had no tray icon but my assumption is that is related to KDE, so a solution that supports both GNOME and KDE would be required.

I wont have time to investigate how it works under modern GNOME for several days though.

Nocturna22 commented 4 months ago

Unfortunately, I did not get it installed. I installed libg15 and libg15.h was copied to '/usr/include'.

With the make command on g510s, libg15.h is also included. But now when it wants to do setupLibG15, I get the error that it is an undefined reference...

I'm on KDE rn. No pressure, i have time :)

vividnightmare commented 4 months ago

Alright, the problem you're having is that Debian/Ubuntu ported libg15 to libusb 1.0.

You want/need my libg15 anyway, as it resolves the double key press issue that is present on G510/G510s.

You can snag the packages via direct download from the my PPA listed in the README.md (or build it from source).

However, tray icons are not being drawn on KDE or GNOME/Ubuntu Desktop. Besides that everything appears functional.

I see no need to port to libusb 1.0 as libusb 0.1 is still available from what I can tell and it "just works."

Nocturna22 commented 4 months ago

Alright, the problem you're having is that Debian/Ubuntu ported libg15 to libusb 1.0.

You want/need my libg15 anyway, as it resolves the double key press issue that is present on G510/G510s.

You can snag the packages via direct download from the my PPA listed in the README.md (or build it from source).

However, tray icons are not being drawn on KDE or GNOME/Ubuntu Desktop. Besides that everything appears functional.

I see no need to port to libusb 1.0 as libusb 0.1 is still available from what I can tell and it "just works."

Hey, that worked. I didn't know I could just do it like that. I downloaded libg15 and libg15-dev from your PPA and installed them via the package manager. I thought this project would also use the display, but color is okay 😅.

Screenshot_20240621_104329

Icons seem to work on KDE Plasma X11

EDIT: O there is a clock file in the Project. So it does not display a clock on my Display. That might be a bug..

vividnightmare commented 4 months ago

Yes, without additional screens it has only the built in clock. You should have a clock display.

vividnightmare commented 4 months ago

Screen data is sent over a socket on port 15550.

You could use wireshark to see the data its sending, if it exists.