Skip to content

unresolved symbol: app_indicator_new on Fedora #68

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

Closed
1 task done
sblantipodi opened this issue Nov 8, 2024 · 2 comments
Closed
1 task done

unresolved symbol: app_indicator_new on Fedora #68

sblantipodi opened this issue Nov 8, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@sblantipodi
Copy link

Please agree to the following

Summary

Simple code sample on the wiki throws an exception.

What software is involved?

Fedora 41

libayatana-appindicator-gtk2      0.5.93-6.fc41                                                                     
 libayatana-appindicator-gtk3     0.5.93-6.fc41                                                                     

OpenJDK 23

Classifier

libappindicator-full

Steps to Reproduce

I added this code to my Java FX app.

public void initTray() {
        try (var arena = Arena.ofConfined()) {
            var arenaAuto = Arena.ofAuto();
            var indicator = AppIndicator.newIndicator("example-simple-client",
                    "indicator-message",
                    APP_INDICATOR_CATEGORY_APPLICATION_STATUS());
            var gtkSeparator = Gtk.newMenuItem();
            var gtkMenu = Gtk.newMenu();
            var gtkSubmenu = Gtk.newMenu();
            var gtkMenuItem = Gtk.newMenuItem();
            Gtk.menuItemSetLabel(gtkMenuItem, "More");
            var gtkSMenuItem = Gtk.newMenuItem();
            Gtk.menuItemSetLabel(gtkSMenuItem, "Change icon");
            var gtkSMenuItem1 = Gtk.newMenuItem();
            Gtk.menuItemSetLabel(gtkSMenuItem1, "Quit");
            Gtk.menuShellAppend(gtkSubmenu, gtkSMenuItem);
            Gtk.menuShellAppend(gtkSubmenu, gtkSeparator);
            Gtk.menuShellAppend(gtkSubmenu, gtkSMenuItem1);
            Gtk.menuItemSetSubmenu(gtkMenuItem, gtkSubmenu);
//            GObject.signalConnectObject(gtkSMenuItem1, "activate", GCallback.allocate(new QuitCallback(), arenaAuto), gtkMenu, 0);
//            GObject.signalConnectObject(gtkSMenuItem, "activate", GCallback.allocate(new ChangeIconCallback(indicator), arenaAuto), gtkMenu, 0);
            Gtk.menuShellAppend(gtkMenu, gtkMenuItem);
            Gtk.widgetShowAll(gtkMenu);
            AppIndicator.setMenu(indicator, gtkMenu);
            AppIndicator.setAttentionIcon(indicator, "indicator-messages-new");
            AppIndicator.setStatus(indicator, APP_INDICATOR_STATUS_ACTIVE());
        }
}

Expected Behavior

tray icon working

Actual Behavior

exception is thrown

Reproducibility

Always

Relevant Log Output

Exception in Application start method
Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
	at javafx.graphics@23/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:893)
	at javafx.graphics@23/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
	at java.base/java.lang.Thread.run(Thread.java:1575)
Caused by: java.lang.UnsatisfiedLinkError: unresolved symbol: app_indicator_new
	at [email protected]/org.purejava.appindicator.app_indicator_h_21.lambda$findOrThrow$0(app_indicator_h_21.java:33)
	at java.base/java.util.Optional.orElseThrow(Optional.java:403)
	at [email protected]/org.purejava.appindicator.app_indicator_h_21.findOrThrow(app_indicator_h_21.java:33)
	at [email protected]/org.purejava.appindicator.app_indicator_h_1$app_indicator_new.<clinit>(app_indicator_h_1.java:1467)
	at [email protected]/org.purejava.appindicator.app_indicator_h_1.app_indicator_new(app_indicator_h_1.java:1496)
	at [email protected]/org.purejava.appindicator.AppIndicator.newIndicator(AppIndicator.java:81)
	at org.dpsoftware/org.dpsoftware.gui.TrayIconManager.initTray(TrayIconManager.java:242)
	at org.dpsoftware/org.dpsoftware.FireflyLuciferin.start(FireflyLuciferin.java:261)
	at javafx.graphics@23/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:839)
	at javafx.graphics@23/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:483)
	at javafx.graphics@23/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:456)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at javafx.graphics@23/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:455)
	at javafx.graphics@23/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
	at javafx.graphics@23/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
	at javafx.graphics@23/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$10(GtkApplication.java:264)
	... 1 more

Anything else?

am I doing something wrong?

@sblantipodi sblantipodi added the bug Something isn't working label Nov 8, 2024
@purejava
Copy link
Owner

purejava commented Nov 9, 2024

Hi @sblantipodi,

thanks for bringing this up. No, you are not doing anything wrong. It is unable to load the libayatana-appindicator-gtk3 shared library, although you have it installed. That leads to the java.lang.UnsatisfiedLinkError you see.

I looked into this and noticed, that Fedora has a different layout to store its 64bit libraries. They are located in /usr/lib64, not in /usr/lib or a path mentioned in /etc/ld.so.conf.d/, like other distributions like Arch Linux or the Debian family handle this.

I need to fix this in these Java bindings by adding /usr/lib64 to the library search path on library loading and create a new release of the bindings containing the fix.

As a workaround, you might consider to symlink the installed library like ln -s /usr/lib64/libayatana-appindicator3.so.1 /usr/lib/.

@purejava purejava changed the title unresolved symbol: app_indicator_new unresolved symbol: app_indicator_new on Fedora Nov 9, 2024
@purejava
Copy link
Owner

purejava commented Nov 9, 2024

Fixed with 6dbc6a4, 224a4e5 and 8ddc2e5 and fixes released as Release 1.4.2.

@purejava purejava closed this as completed Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants