nonguix: binary-build-system: Use add-rpath instead of set-rpath.

Fixes #369.

Previously we were using "patchelf --set-rpath" in binary-build-system for
binaries to find dependencies in Guix.  However, this will override any
previous setting, including if "$ORIGIN" was in RUNPATH.

For Electron applications specifically (like signal-desktop and heroic),
bundled libraries were not found without wrapping with LD_LIBRARY_PATH.  While
this does work, it is not ideal and led to issues in child processes that
inherit LD_LIBRARY_PATH, namely breaking games using Wine/Proton in Heroic.

A possible consequence of this commit is that Guix added paths to RUNPATH are
after what was originally set, perhaps leading to library
loading/compatibility issues.  However, we always try to replace all needed
libraries with Guix packages (just that Electron applications seem to require
bundled libraries in $ORIGIN).

* nonguix/build/binary-build-system.scm (patchelf): Use add-rpath instead of set-rpath.
* nongnu/packages/game-client.scm (heroic-client)[arguments]<#:phases>: Remove
'wrap-where-patchelf-does-not-work phase as it is no longer needed (needed
libraries are found with $ORIGIN preserved in RUNPATH).
* nongnu/packages/messaging.scm (element-desktop, signal-desktop): Likewise.
* nongnu/packages/editors.scm (vscodium): Likewise.
This commit is contained in:
John Kehayias 2025-02-02 17:53:09 -05:00
parent 5c6ef7cafd
commit e65677969e
No known key found for this signature in database
GPG Key ID: 499097AE5EA815D9
4 changed files with 5 additions and 37 deletions

View File

@ -83,15 +83,7 @@
#:startup-w-m-class "Code" #:startup-w-m-class "Code"
#:comment #:comment
'(("en" "Code Editing. Redefined.") '(("en" "Code Editing. Redefined.")
(#f "Code Editing. Redefined.")))))) (#f "Code Editing. Redefined.")))))))))
(add-after 'install-wrapper 'wrap-where-patchelf-does-not-work
(lambda _
(wrap-program (string-append #$output "/bin/codium")
`("LD_LIBRARY_PATH" ":"
prefix
(,(string-join
(list (string-append #$output "/opt/vscodium"))
":")))))))))
(supported-systems '("armhf-linux" "aarch64-linux" "x86_64-linux")) (supported-systems '("armhf-linux" "aarch64-linux" "x86_64-linux"))
(native-inputs (native-inputs
(list tar)) (list tar))

View File

@ -97,15 +97,7 @@
(lambda _ (lambda _
(mkdir-p (string-append #$output "/bin")) (mkdir-p (string-append #$output "/bin"))
(symlink (string-append #$output "/lib/Heroic/heroic") (symlink (string-append #$output "/lib/Heroic/heroic")
(string-append #$output "/bin/heroic")))) (string-append #$output "/bin/heroic")))))))
(add-after 'install-wrapper 'wrap-where-patchelf-does-not-work
(lambda _
(wrap-program (string-append #$output "/lib/Heroic/heroic")
`("LD_LIBRARY_PATH" ":" prefix
(,(string-join
(list
(string-append #$output "/lib/Heroic"))
":")))))))))
(home-page "https://heroicgameslauncher.com") (home-page "https://heroicgameslauncher.com")
(synopsis "A Native GOG, Amazon and Epic Games Launcher") (synopsis "A Native GOG, Amazon and Epic Games Launcher")
(description "Heroic is an Open Source Game Launcher. Right now it supports launching (description "Heroic is an Open Source Game Launcher. Right now it supports launching

View File

@ -69,15 +69,7 @@
(lambda _ (lambda _
(mkdir-p (string-append #$output "/bin")) (mkdir-p (string-append #$output "/bin"))
(symlink (string-append #$output "/lib/Element/element-desktop") (symlink (string-append #$output "/lib/Element/element-desktop")
(string-append #$output "/bin/element-desktop")))) (string-append #$output "/bin/element-desktop")))))))
(add-after 'install-wrapper 'wrap-where-patchelf-does-not-work
(lambda _
(wrap-program (string-append #$output "/lib/Element/element-desktop")
`("LD_LIBRARY_PATH" ":" prefix
(,(string-join
(list
(string-append #$output "/lib/Element"))
":")))))))))
(home-page "https://github.com/vector-im/element-desktop") (home-page "https://github.com/vector-im/element-desktop")
(synopsis "Matrix collaboration client for desktop") (synopsis "Matrix collaboration client for desktop")
(description "Element Desktop is a Matrix client for desktop with Element Web at (description "Element Desktop is a Matrix client for desktop with Element Web at
@ -123,15 +115,7 @@ its core.")
(lambda _ (lambda _
(mkdir-p (string-append #$output "/bin")) (mkdir-p (string-append #$output "/bin"))
(symlink (string-append #$output "/lib/Signal/signal-desktop") (symlink (string-append #$output "/lib/Signal/signal-desktop")
(string-append #$output "/bin/signal-desktop")))) (string-append #$output "/bin/signal-desktop")))))))
(add-after 'install-wrapper 'wrap-where-patchelf-does-not-work
(lambda _
(wrap-program (string-append #$output "/lib/Signal/signal-desktop")
`("LD_LIBRARY_PATH" ":" prefix
(,(string-join
(list
(string-append #$output "/lib/Signal"))
":")))))))))
(home-page "https://signal.org/") (home-page "https://signal.org/")
(synopsis "Private messenger using the Signal protocol") (synopsis "Private messenger using the Signal protocol")
(description "Signal Desktop is an Electron application that links with Signal on Android (description "Signal Desktop is an Electron application that links with Signal on Android

View File

@ -113,7 +113,7 @@ The inputs are optional when the file is an executable."
(make-rpath name))) (make-rpath name)))
runpath) runpath)
":"))) ":")))
(invoke "patchelf" "--set-rpath" rpath binary))) (invoke "patchelf" "--add-rpath" rpath binary)))
#t) #t)
(display "Using patchelf version: ") (display "Using patchelf version: ")