Instruct auto-patchelf to find certain libraries in a subdirectory

I’m packaging a binary-based JAVA application based on an upstream-provided JAR. Several libswt-related shared library (.so) objects files are packed inside the JAR file, and I’m using the autoPatchelf command provided by autoPatchelfHook to patch them.

One of the .so file (namely, libswt-awt-gtk-4922r32.so), and I found that jre provide it inside its sub-path lib/openjdk/lib/libjawt.so instead of lib/libjawt.so, and auto-patchelf have difficulty finding them if I just add jre intto buildInputs.

How do I teach auto-patchelf to look into ${lib.getLib jre}/lib/openjdk while keep using other libraries supplied by buildInputs?

I solved the problem by specifying the autoPatchelfLibs as an attribute (with __structuredAttrs = true;), prefixing the desired library path to the Bash array.

2 Likes