Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kitty: fix loading of library #74874

Merged
merged 2 commits into from Dec 7, 2019
Merged

kitty: fix loading of library #74874

merged 2 commits into from Dec 7, 2019

Conversation

Luflosi
Copy link
Contributor

@Luflosi Luflosi commented Dec 3, 2019

When trying to play a sound, kitty prints an error message because it cannot find libcanberra.so:

Failed to load libcanberra.so, cannot play beep sound, with error: libcanberra.so.0.2.5: cannot open shared object file: No such file or directory

This is fixed by patching the path to the library.

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @tex @rvolosatovs @Ma27

When trying to play a sound, kitty prints an error message because it cannot find `libcanberra.so`:
```
Failed to load libcanberra.so, cannot play beep sound, with error: libcanberra.so.0.2.5: cannot open shared object file: No such file or directory
```
This is fixed by patching the path to the library.
@Luflosi
Copy link
Contributor Author

Luflosi commented Dec 3, 2019

BTW, is there a good way to do this upstream in kitty so that we don't need this patch?

@Br1ght0ne
Copy link
Member

Testing build on darwin
@GrahamcOfBorg build kitty

Copy link
Member

@Br1ght0ne Br1ght0ne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works on NixOS unstable (tested with nix-review).
printf \\a in kitty makes a sound, no warning about libcanberra.

Still, Darwin build should be checked too.

@Luflosi
Copy link
Contributor Author

Luflosi commented Dec 3, 2019

Could libEGL.so.1 also be loaded with LD_LIBRARY_PATH?

Copy link
Contributor

@jtojnar jtojnar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of the reasons we prefer patches to environment variables is that env vars get inherited by child programs. This is especially bad with terminal emulator, which will be running other programs. LD_LIBRARY_PATH will take precedence over their DT_RUNPATH entries, which Nix heavily relies on.

Copy link
Contributor

@jtojnar jtojnar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of the reasons we prefer patches to environment variables is that env vars get inherited by child programs. This is especially bad with terminal emulator, which will be running other programs. LD_LIBRARY_PATH will take precedence over their DT_RUNPATH entries, which Nix heavily relies on.

Copy link
Contributor

@jtojnar jtojnar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of the reasons we prefer patches to environment variables is that env vars get inherited by child programs. This is especially bad with terminal emulator, which will be running other programs. LD_LIBRARY_PATH will take precedence over their DT_RUNPATH entries, which Nix heavily relies on.

@worldofpeace
Copy link
Contributor

worldofpeace commented Dec 3, 2019

++ to @jtojnar requested changes here. I actually ran into issues because my preferred terminal program had a wrapper with LD_LIBRARY_PATH, it was pretty confusing until I figured this out.

Though this isn't meant to trivialize @Ma27 generosity for helping here ❤️

Also about #74874 (comment), you can split the patch into a separate file and apply it conditionally.

@Ma27
Copy link
Member

Ma27 commented Dec 3, 2019

One of the reasons we prefer patches to environment variables is that env vars get inherited by child programs. This is especially bad with terminal emulator, which will be running other programs. LD_LIBRARY_PATH will take precedence over their DT_RUNPATH entries, which Nix heavily relies on.

I see, thanks for elaborating! I can confirm that the author's change fixes the issue, so I'd suggest I alter the patch to apply the librarie's changes on Linux only, then this should be good to go.

As the issue exists on release-19.09 as well (the libcanberra dependency was introduced somewhere in 0.14), I'd also do the backport :)

@Ma27 Ma27 added the 9.needs: port to stable A PR needs a backport to the stable release. label Dec 3, 2019
Copy link
Member

@Ma27 Ma27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original change fixes the issue, I pushed a fix to ensure that stuff like libcanberra is only patched on linux. @jtojnar anything to add? :)

@ofborg ofborg bot requested a review from Ma27 December 3, 2019 19:01
@Luflosi
Copy link
Contributor Author

Luflosi commented Dec 7, 2019

@jtojnar thanks for pointing out the issue with LD_LIBRARY_PATH.
@Ma27 thanks for making this Linux-specific. :)

Is there anything that needs to be done, before this can be merged?

@Ma27
Copy link
Member

Ma27 commented Dec 7, 2019

Is there anything that needs to be done, before this can be merged?

Not from my side, I actually wanted to wait until @jtojnar approves, but as it seems fine from my side, I'd merge tomorrow :)

@Ma27 Ma27 merged commit 6bd93d5 into NixOS:master Dec 7, 2019
@Ma27
Copy link
Member

Ma27 commented Dec 7, 2019

Btw I was wrong about the backport, it seems as the lazy loading of libcanberra has been introduced in 0.15.0 (previously it was a build dependency): kovidgoyal/kitty#2089

@Ma27 Ma27 removed the 9.needs: port to stable A PR needs a backport to the stable release. label Dec 7, 2019
@Luflosi Luflosi deleted the fix-kitty-lib branch December 7, 2019 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants