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
epoxy: explicitly search libGL path as fallback #38168
Conversation
Success on x86_64-linux (full log) Attempted: epoxy Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: epoxy Partial log (click to expand)
|
cc @xeji -- look okay? |
@GrahamcOfBorg test sddm slim |
Failure on x86_64-darwin (full log) Attempted: epoxy Partial log (click to expand)
|
Failure on x86_64-linux (full log) Attempted: tests.sddm, tests.slim Partial log (click to expand)
|
Failure on aarch64-linux (full log) Attempted: tests.sddm, tests.slim Partial log (click to expand)
|
''; | ||
patches = [ ./libgl-path.patch ]; | ||
|
||
NIX_CFLAGS_COMPILE = stdenv.lib.optional stdenv.isLinux ''-DLIBGL_PATH="${getLib libGL}/lib"''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Limiting to linux might not be necessary with your patch, I had to do that because patchelf fails on darwin.
Let's see if this builds on darwin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Patch looks good, should even work on darwin. Scary stuff though, and glibc provides zero official documentation on dlopen()
...
Don't rely on questionable impact of DT_RPATH on dlopen(). This is a bit of a messy subject, but probably the clearest reference to motivate *not* relying on how dlopen() behaves in the presence of RPATH or RUNPATH is the following: https://sourceware.org/ml/libc-hacker/2002-11/msg00011.html FWIW the dlopen() manpage only mentions the the RPATH and RUNPATH in the "executable file for the calling program"; no mention of the executable files for libraries-- this has been brought to the attention of the relevant parties and AFAICT nothing has been done. The best reference for glibc behavior is apparently to ... "try it and see". Luckily a generous soul did exactly that and reported the findings: https://www.spinics.net/lists/linux-man/msg02291.html Qt wrote on the subject a bit when they were bit by this, linking to the above articles (directly or indirectly). See: http://blog.qt.io/blog/2011/10/28/rpath-and-runpath/ -------- Since we know the path of libGL at build-time for libepoxy, there's a simple solution we can use to avoid all of this: simply teach libepoxy to explicitly look in the libGL path. This commit patches libepoxy to accomplish this, looking to "LIBGL_PATH" as a fallback if it cannot find the libraries otherwise. --------- This fixes use of libepoxy w/musl on NixOS!
881433a
to
503f8ef
Compare
Bumped removing the bit that conditionally set |
Success on x86_64-linux (full log) Attempted: epoxy Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: epoxy Partial log (click to expand)
|
Failure on x86_64-darwin (full log) Attempted: epoxy Partial log (click to expand)
|
Don't rely on questionable impact of DT_RPATH on dlopen().
This is a bit of a messy subject, but probably the clearest
reference to motivate not relying on how dlopen() behaves
in the presence of RPATH or RUNPATH is the following:
https://sourceware.org/ml/libc-hacker/2002-11/msg00011.html
FWIW the dlopen() manpage only mentions the the RPATH
and RUNPATH in the "executable file for the calling program";
no mention of the executable files for libraries--
this has been brought to the attention of the relevant
parties and AFAICT nothing has been done.
The best reference for glibc behavior is
apparently to ... "try it and see".
Luckily a generous soul did exactly that
and reported the findings:
https://www.spinics.net/lists/linux-man/msg02291.html
Qt wrote on the subject a bit when they were bit by this,
linking to the above articles (directly or indirectly).
See:
http://blog.qt.io/blog/2011/10/28/rpath-and-runpath/
Since we know the path of libGL at build-time for libepoxy,
there's a simple solution we can use to avoid all of this:
simply teach libepoxy to explicitly look in the libGL path.
This commit patches libepoxy to accomplish this,
looking to "LIBGL_PATH" as a fallback if it cannot find
the libraries otherwise.
This fixes use of libepoxy w/musl on NixOS!
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)I've tested this with a variety of NixOS tests on my dev branch,
confirming it fixes things w/musl and doesn't regress w/glibc.
FWIW the "slim" NixOS test actually is a good candidate for this,
as well as many qemu tests, by way of glamor--even though it
eventually fails to initialize in the successful case,
if it can't find libEGL.so.1 at all it errors out and test fails.
I've checked the "slim" test works as of this revision.