NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.27k stars 14.25k forks source link

apache-directory-studio unable to run #333377

Open Ypnose opened 3 months ago

Ypnose commented 3 months ago

Describe the bug

apache-directory-studio can't be launched. I have this error :

java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
    no swt-pi4-gtk-4940r23 in java.library.path: /nix/store/krmmziid35mj6qpzdsbrbcfgvzpfnal5-webkitgtk-2.44.2+abi=4.0/lib:/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
    no swt-pi4-gtk in java.library.path: /nix/store/krmmziid35mj6qpzdsbrbcfgvzpfnal5-webkitgtk-2.44.2+abi=4.0/lib:/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib

Steps To Reproduce

Steps to reproduce the behavior:

  1. Launch apache-directory-studio as usual
  2. It says :
ApacheDirectoryStudio:
An error has occurred. See the log file
/home/foo/.eclipse/1465834203_linux_gtk_x86_64/configuration/1723184305864.log

Expected behavior

The GUI should start.

Additional context

apache-directory-studio is installed with home-manager. It was working since October 2023.

Fix

swt should be added to this line :

{ lib, stdenv, fetchurl, jdk, makeWrapper, autoPatchelfHook, makeDesktopItem, glib, libsecret, webkitgtk }:

And adding lines in this block does the trick :

    makeWrapper "$dest/ApacheDirectoryStudio" \
        "$out/bin/ApacheDirectoryStudio" \
        --prefix PATH : "${jdk}/bin" \
        --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath ([ glib ])} \
        --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath ([ swt ])} \
        --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath ([ webkitgtk ])}

Notify maintainers

@bjornfor

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.43, NixOS, 24.11 (Vicuna), 24.11.20240804.cb9a96f`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.5`
 - nixpkgs: `/nix/store/4cpakzyvfw1rmm9v5i3387x6jd2h1v86-source`

Add a :+1: reaction to issues you find important.

bjornfor commented 3 months ago

I tried adding glib and swt. It helps, but it still fails for me:

$ ./result/bin/ApacheDirectoryStudio
SWT WebKitGDBus: error creating DBus server Error binding to address (GUnixSocketAddress): No such file or directory
SWT WebKit: error initializing DBus server, dBusServer == 0

(Apache Directory Studio:339942): GLib-GIO-CRITICAL **: 10:52:18.805: g_dbus_server_get_client_address: assertion 'G_IS_DBUS_SERVER (server)' failed
[...some more output before exiting...]

I looked a bit at strace output but haven't found the root cause.

bjornfor commented 3 months ago

I ran mkdir /tmp/SWT-GDBusServer/ and now it works. Hm...

bjornfor commented 3 months ago

/tmp/SWT-GDBusServer/

Searching for this path lead to this interesting comment: https://github.com/adoptium/adoptium-support/issues/785#issuecomment-1866680133

Ypnose commented 3 months ago

Thanks for taking the time to take a look. It sounds sketchy. What could we do ?

bjornfor commented 3 months ago

I looked at upgrading swt, but got stuck.

We can add swt and glib and use a/the wrapper to create the temporary directory. But other programs using swt will still have the bug.

Ypnose commented 3 months ago

Are you using a Wayland compositor ? On sway, I was able to reproduce what you said. But on X11 with i3, apache-directory-studio starts without issue here.

bjornfor commented 3 months ago

Yes, I'm using Wayland (in GNOME desktop).

Ypnose commented 2 months ago

Creating a wrapper would do the trick, isn't it ? I am thinking about creating a local apache-directory-studio with a wrapper.

bjornfor commented 2 months ago

Creating a wrapper would do the trick, isn't it ?

Yes.

I am thinking about creating a local apache-directory-studio with a wrapper.

What? Where? Just create the directory /tmp/SWT-GDBusServer/ and it'll work.

Ypnose commented 2 months ago

I was talking about the local apache-directory-studio because you didn't merge the lib.makeLibraryPath and swt lines we discussed earlier. I do not want to be a bore.

Thatoo commented 2 weeks ago

I face the same issue on unstable under Cosmic (Wayland).