Commit 83d69521 authored by Bjørn Forsman's avatar Bjørn Forsman
Browse files

apache-directory-studio: add missing glib

Fix loading the SWT library by adding glib to the runtime library
search path.

Before:

  $ ./result/bin/ApacheDirectoryStudio
  ApacheDirectoryStudio:
  An error has occurred. See the log file
  /home/bf/.eclipse/1900982865_linux_gtk_x86_64/configuration/1740319909191.log.

where the log file contains

  !SESSION 2025-02-23 15:11:49.037 -----------------------------------------------
  eclipse.buildId=unknown
  java.version=21.0.5
  java.vendor=N/A
  BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
  Framework arguments:  /studio-rcp/resources/icons/linux/studio.xpm
  Command-line arguments:  -os linux -ws gtk -arch x86_64 /studio-rcp/resources/icons/linux/studio.xpm

  !ENTRY org.eclipse.osgi 4 0 2025-02-23 15:11:49.771
  !MESSAGE Application error
  !STACK 1
  java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
  	no swt-pi4-gtk-4940r23 in java.library.path: /nix/store/l1rnlmalihpfg7aj9lxh4mv5ffnqx6qi-webkitgtk-2.46.6+abi=4.0/lib:/etc/sane-libs:/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
  	no swt-pi4-gtk in java.library.path: /nix/store/l1rnlmalihpfg7aj9lxh4mv5ffnqx6qi-webkitgtk-2.46.6+abi=4.0/lib:/etc/sane-libs:/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
  	Can't load library: /home/bf/.swt/lib/linux/x86_64/libswt-pi4-gtk-4940r23.so
  	Can't load library: /home/bf/.swt/lib/linux/x86_64/libswt-pi4-gtk.so

  	at org.eclipse.swt.internal.Library.loadLibrary(Library.java:338)
  	at org.eclipse.swt.internal.Library.loadLibrary(Library.java:257)
  	at org.eclipse.swt.internal.gtk.OS.<clinit>(OS.java:96)
  	at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:209)
  	at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:155)
  	at org.eclipse.swt.widgets.Display.<clinit>(Display.java:163)
  	at org.eclipse.ui.internal.Workbench.createDisplay(Workbench.java:726)
  	at org.eclipse.ui.PlatformUI.createDisplay(PlatformUI.java:168)
  	at org.apache.directory.studio.Application.start(Application.java:47)
  	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
  	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
  	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
  	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
  	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
  	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
  	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
  	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
  	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
  	at org.eclipse.equinox.launcher.Main.run(Main.java:1461)
  	at org.eclipse.equinox.launcher.Main.main(Main.java:1434)

It's worth noting, that when the program fails to load
libswt-pi4-gtk-*.so, it has libswt-pi3-gtk-*.so available (it is put
there by the application):

  $ tree ~/.swt
  /home/bf/.swt
  └── lib
      └── linux
          └── x86_64
              └── libswt-pi3-gtk-4940r23.so

After:

  (a different runtime error, possibly only seen on some DEs -- will be
  fixed in next commit)
parent 6fa5cb30
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -59,7 +59,12 @@ stdenv.mkDerivation rec {
    makeWrapper "$dest/ApacheDirectoryStudio" \
        "$out/bin/ApacheDirectoryStudio" \
        --prefix PATH : "${jdk}/bin" \
        --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath ([ webkitgtk_4_0 ])}
        --prefix LD_LIBRARY_PATH : ${
          lib.makeLibraryPath ([
            glib
            webkitgtk_4_0
          ])
        }
    install -D icon.xpm "$out/share/pixmaps/apache-directory-studio.xpm"
    install -D -t "$out/share/applications" ${desktopItem}/share/applications/*
  '';