Hi, first off i’d like to say I might have bitten off more than I can chew with this. I am trying to package a program called sdr-trunk, which is a JavaFX application. So far my current package definition “works”, autopatchelf does patch the binaries and the application will start. However, when it tries to load the glass GTK library the application won’t load the GUI. It does not crash, it just fails to start the GUI.
I have gotten lost and don’t know where to go from here; I have tried using makeWrapper to set LD_LIBRARY_PATH, and made edits to the script that launches the java binary using substituteInPlace. Neither have fixed the issue, although the later change seems correct to me (unless i learn otherwise ). I would appreciate any guidance on a fix, it’s my first time trying to package anything. I will include the app log and nix file below.
The nix file (sdrtrunk.nix):
{ stdenv, lib, fetchzip, autoPatchelfHook, jdk23, glib, gtk3, xorg, ffmpeg_6-full, sdrplay, glibc}:
let
version = "0.6.1";
in
stdenv.mkDerivation {
pname = "sdrtrunk";
version = version;
#Yeah, the source code exists, I can't hack it. I can't figure out how to package a gradle build in nix.
src = fetchzip {
url = "https://github.com/DSheirer/sdrtrunk/releases/download/v${version}/sdr-trunk-linux-x86_64-v${version}.zip";
hash = "sha256-iMnR8d7fnnpcBAKoPn8zyuTWzcklqy4oyAKsTHljOPc=";
};
nativeBuildInputs = [
(jdk23.override { enableJavaFX = true; })
autoPatchelfHook
glib
gtk3
xorg.libXxf86vm
xorg.libX11
ffmpeg_6-full
sdrplay
glibc
];
preBuild = ''
addAutoPatchelfSearchPath ${jdk23}
addAutoPatchelfSearchPath ${gtk3}
addAutoPatchelfSearchPath ${glib}
'';
autoPatchelfIgnoreMissingDeps = [ "libavcodec.so.5*" "libavformat.so.5*" "libavcodec-ffmpeg.so.5*" "libavformat-ffmpeg.so.5*"];
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r * $out
rm $out/bin/sdr-trunk.bat
# point shell script to correct lib folder
substituteInPlace $out/bin/sdr-trunk \
--replace 'APP_HOME="`pwd -P`"' 'APP_HOME="'$out'"'
runHook postInstall
'';
meta = with lib; {
description = "A cross-platform java application for decoding, monitoring, recording and streaming trunked mobile and related radio protocols using Software Defined Radios (SDR).";
homepage = "https://github.com/DSheirer/sdrtrunk";
license = licenses.gpl3Only;
platforms = platforms.unix;
maintainers = with maintainers; [bigdale123];
mainProgram = "sdrtrunk";
};
}
And the application log:
[dylan@nixos:~/sdrtrunk-pkg]$ ./result/bin/sdr-trunk
WARNING: Using incubator modules: jdk.incubator.vector
2025-02-04 16:56:07.473 INFO i.g.d.icon.IconModel - loading icons file [/home/dylan/SDRTrunk/settings/icons.xml] [15MB/232MB 6%]
2025-02-04 16:56:07.479 INFO i.g.d.icon.IconModel - Icons file not found at [/home/dylan/SDRTrunk/settings/icons.xml] [15MB/232MB 6%]
2025-02-04 16:56:07.749 INFO i.g.d.log.ApplicationLog - Application Log File: /home/dylan/SDRTrunk/logs/sdrtrunk_app.log [23MB/232MB 10%]
2025-02-04 16:56:07.820 INFO i.g.d.log.ApplicationLog - SDRTrunk Version : 0.6.1 [8MB/20MB 42%]
2025-02-04 16:56:07.821 INFO i.g.d.log.ApplicationLog - Gradle Version : Gradle 8.10 [8MB/20MB 42%]
2025-02-04 16:56:07.821 INFO i.g.d.log.ApplicationLog - Build Timestamp : 2024-12-03T16:31:53.486-0500 [8MB/20MB 42%]
2025-02-04 16:56:07.821 INFO i.g.d.log.ApplicationLog - Build-JDK : 23 (BellSoft 23+38 [8MB/20MB 42%]
2025-02-04 16:56:07.822 INFO i.g.d.log.ApplicationLog - Build OS : Linux (amd64 6.8.0-49-generic [8MB/20MB 42%]
2025-02-04 16:56:07.822 INFO i.g.d.log.ApplicationLog - [8MB/20MB 42%]
2025-02-04 16:56:07.822 INFO i.g.d.log.ApplicationLog - ******************************************************************* [8MB/20MB 42%]
2025-02-04 16:56:07.822 INFO i.g.d.log.ApplicationLog - **** sdrtrunk: a trunked radio and digital decoding application *** [8MB/20MB 42%]
2025-02-04 16:56:07.823 INFO i.g.d.log.ApplicationLog - **** website: https://github.com/dsheirer/sdrtrunk *** [8MB/20MB 42%]
2025-02-04 16:56:07.823 INFO i.g.d.log.ApplicationLog - ******************************************************************* [8MB/20MB 42%]
2025-02-04 16:56:07.823 INFO i.g.d.log.ApplicationLog - Memory Logging Format: [Used/Allocated PercentUsed%] [8MB/20MB 42%]
2025-02-04 16:56:07.824 INFO i.g.d.log.ApplicationLog - Host OS Name: Linux [8MB/20MB 42%]
2025-02-04 16:56:07.824 INFO i.g.d.log.ApplicationLog - Host OS Arch: amd64 [8MB/20MB 42%]
2025-02-04 16:56:07.824 INFO i.g.d.log.ApplicationLog - Host OS Version: 6.6.74 [8MB/20MB 42%]
2025-02-04 16:56:07.825 INFO i.g.d.log.ApplicationLog - Host CPU Cores: 8 [8MB/20MB 42%]
2025-02-04 16:56:07.825 INFO i.g.d.log.ApplicationLog - Host Max Java Memory: 3 GB [8MB/20MB 42%]
2025-02-04 16:56:07.826 INFO i.g.d.log.ApplicationLog - Storage Directories: [8MB/20MB 42%]
2025-02-04 16:56:07.826 INFO i.g.d.log.ApplicationLog - Application Root: /home/dylan/SDRTrunk [8MB/20MB 42%]
2025-02-04 16:56:07.827 INFO i.g.d.log.ApplicationLog - Application Log: /home/dylan/SDRTrunk/logs [8MB/20MB 42%]
2025-02-04 16:56:07.827 INFO i.g.d.log.ApplicationLog - Event Log: /home/dylan/SDRTrunk/event_logs [8MB/20MB 42%]
2025-02-04 16:56:07.828 INFO i.g.d.log.ApplicationLog - Playlist: /home/dylan/SDRTrunk/playlist [8MB/20MB 42%]
2025-02-04 16:56:07.829 INFO i.g.d.log.ApplicationLog - Recordings: /home/dylan/SDRTrunk/recordings [8MB/20MB 42%]
2025-02-04 16:56:07.849 INFO i.g.d.s.t.s.a.SDRPlayLibraryHelper - SDRPlay API native library not found at: /usr/local/lib/libsdrplay_api.so [9MB/20MB 46%]
2025-02-04 16:56:07.959 INFO i.g.d.util.ThreadPool - Application thread pool created SCHEDULED and CACHED executors threads [12MB/20MB 60%]
2025-02-04 16:56:07.960 INFO i.g.d.p.SystemProperties - SystemProperties - loaded [/home/dylan/SDRTrunk/SDRTrunk.properties] [12MB/20MB 60%]
2025-02-04 16:56:08.278 INFO i.g.d.s.t.m.TunerManager - Discovering tuners ... [16MB/28MB 59%]
2025-02-04 16:56:08.287 INFO i.g.d.s.t.m.TunerManager - LibUsb API Version: 1.0.262 [17MB/28MB 61%]
2025-02-04 16:56:08.288 INFO i.g.d.s.t.m.TunerManager - LibUsb Version: 1.0.22.11312 [17MB/28MB 61%]
2025-02-04 16:56:08.299 INFO i.g.d.s.t.m.TunerManager - LibUsb - discovered [25] potential usb devices [17MB/28MB 61%]
2025-02-04 16:56:08.311 INFO i.g.d.s.t.m.TunerManager - Discovered tuner at USB Bus [2] Port [4.2.1.3] Tuner Class [RTL-2832] [8MB/28MB 28%]
2025-02-04 16:56:08.319 INFO i.g.d.s.t.m.TunerManager - Tuner: USB Tuner - RTL-2832 USB Bus:2 Port:4.2.1.3 - Added / Starting ... [8MB/28MB 28%]
2025-02-04 16:56:09.432 INFO i.g.d.d.f.c.ComplexPolyphaseChannelizerM2 - Sample Rate [2400000.0] providing [96] channels at [25000.0] Hz each [11MB/28MB 41%]
2025-02-04 16:56:09.572 INFO i.g.d.s.t.m.TunerManager - LibUsb - starting HotPlug detection [12MB/28MB 43%]
2025-02-04 16:56:09.580 INFO i.g.d.s.t.m.TunerManager - Tuner plug-in detected at USB Bus [2] Port [3] Tuner Class [RTL-2832] [12MB/28MB 44%]
2025-02-04 16:56:09.585 INFO i.g.d.s.t.s.api.SDRplay - API library is not available - unsupported version: 0.0 [12MB/28MB 44%]
2025-02-04 16:56:09.593 INFO i.g.d.s.SettingsManager - SettingsManager - settings does not exist [/home/dylan/SDRTrunk/settings/settings.xml] [12MB/28MB 44%]
2025-02-04 16:56:09.638 INFO i.g.d.m.DiagnosticMonitor - Diagnostic monitoring enabled running every 30 seconds [13MB/28MB 49%]
Exception in thread "main" java.lang.UnsupportedOperationException: Unable to load glass GTK library.
at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$new$5(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.<init>(Unknown Source)
at javafx.graphics/com.sun.glass.ui.gtk.GtkPlatformFactory.createApplication(Unknown Source)
at javafx.graphics/com.sun.glass.ui.Application.run(Unknown Source)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.startup(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(Unknown Source)
at javafx.swing/javafx.embed.swing.JFXPanel.initFx(Unknown Source)
at javafx.swing/javafx.embed.swing.JFXPanel.<init>(Unknown Source)
at io.github.dsheirer.gui.JavaFxWindowManager.createJFXPanel(JavaFxWindowManager.java:180)
at io.github.dsheirer.gui.JavaFxWindowManager.setup(JavaFxWindowManager.java:153)
at io.github.dsheirer.gui.JavaFxWindowManager.<init>(JavaFxWindowManager.java:106)
at io.github.dsheirer.gui.SDRTrunk.<init>(SDRTrunk.java:209)
at io.github.dsheirer.gui.SDRTrunk.main(SDRTrunk.java:937)
^C