Created attachment 532108 [details] mpv build.log The build script for USE="zsh-completion" requires running the compiled `mpv` binary, which fails the build when using the various portage sandbox features due to sandbox access violations: [439/439] Compiling TOOLS/zsh.pl 02:17:52 runner ' "/usr/bin/perl" "/var/tmp/portage/media-video/mpv-9999/work/mpv-9999/TOOLS/zsh.pl" "/var/tmp/portage/media-video/mpv-9999/work/mpv-9999/build/mpv" > "etc/_mpv" ' * ACCESS DENIED: open_wr: /dev/dri/renderD128 * ACCESS DENIED: open_wr: /dev/dri/renderD128 * ACCESS DENIED: open_wr: /dev/dri/renderD128 * ACCESS DENIED: open_wr: /dev/dri/renderD128 * ACCESS DENIED: open_wr: /dev/dri/renderD128 * ACCESS DENIED: open_wr: /dev/dri/renderD128 * ACCESS DENIED: open_wr: /dev/dri/renderD128 * ACCESS DENIED: open_wr: /dev/dri/renderD128 * ACCESS DENIED: open_wr: /dev/dri/renderD128 * ACCESS DENIED: open_wr: /dev/dri/renderD128 * ACCESS DENIED: open_wr: /dev/dri/renderD128 * ACCESS DENIED: open_wr: /dev/dri/renderD128 Waf: Leaving directory `/var/tmp/portage/media-video/mpv-9999/work/mpv-9999/build' This happens when ffmpeg is built with USE="opencl". Ultimately, this means that `libavcodec.so` links against `libOpenCL.so`: $ ldd /usr/lib/libavcodec.so | grep OpenCL libOpenCL.so.1 => /usr/lib64/OpenCL/vendors/mesa/libOpenCL.so.1 (0x00007feea006e000) On systems running mesa, this `libOpenCL.so` resolves to mesa's implementation, which always tries accessing `/dev/dri` and various other GPU-related device files on `dlopen()`: $ echo 'int main() {}' > test.c && gcc -o test test.c -lOpenCL && strace -e open ./test open("/dev/dri", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 4 open("/dev/dri", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 4 open("/dev/dri", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 4 open("/dev/dri", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 4 open("/sys/dev/char/226:128/device/drm", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 4 open("/sys/dev/char/226:128/device/drm", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 5 open("/dev/dri", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 5 open("/etc/nsswitch.conf", O_RDONLY|O_CLOEXEC) = 5 open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 5 open("/sys/devices/system/cpu/online", O_RDONLY|O_CLOEXEC) = 5 open("/sys/dev/char/226:128/device/drm", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 5 open("/sys/dev/char/226:128/device/drm", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 5 open("/sys/dev/char/226:128/device/drm", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 5 +++ exited with 0 +++ While this behavior for libOpenCL.so surprises me, and I'd personally feel this is an upstream bug, it still technically only affects the gentoo mpv build so I'm filing it here first.
Created attachment 532110 [details] emerge --info mpv
Created attachment 532112 [details] emerge --info ffmpeg
Created attachment 532114 [details] emerge --info mesa
I've also pointed out the (IMHO) strange behavior upstream: https://bugs.freedesktop.org/show_bug.cgi?id=106572 We'll see what they have to say. It's also worth mentioning that IRC (via #dri-devel) suggests that `--enable-opencl-icd` might be a solution. I tried changing the mesa ebuild to set this flag (which is currently hard-coded to `--disable-opencl-icd`), but that causes `libOpenCL.so` to not get built, which means `eselect opencl mesa` fails with an error starting like this: !!! Error: The mesa OpenCL implementation doesn't seem to provide libOpenCL.so file.
Related discussion in g-dev ML: https://archives.gentoo.org/gentoo-dev/message/c51b0a248cbebc2a242b4c72ec92efaa
Similar violations will probably occur when merging mpv-bash-completion as well. Niklas, could you please test this?
> Similar violations will probably occur when merging mpv-bash-completion as well. Confirmed.
> https://github.com/gentoo/gentoo/pull/8493 Fixed the issue for me (amd64, media-video/mpv-0.27.2). Thanks.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ea7ba7c42a3f1564e612298e781e6fe8963b1e81 commit ea7ba7c42a3f1564e612298e781e6fe8963b1e81 Author: Ilya Tumaykin <itumaykin@gmail.com> AuthorDate: 2018-05-20 14:56:42 +0000 Commit: Mikle Kolyada <zlogene@gentoo.org> CommitDate: 2018-05-27 08:50:57 +0000 media-video/mpv: addpredict /dev/dri with USE=zsh-completion Closes: https://bugs.gentoo.org/656086 Package-Manager: Portage-2.3.38, Repoman-2.3.9 media-video/mpv/mpv-0.27.2.ebuild | 4 ++++ media-video/mpv/mpv-0.28.2.ebuild | 4 ++++ media-video/mpv/mpv-9999.ebuild | 4 ++++ 3 files changed, 12 insertions(+) Additionally, it has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2078adf9f0884b0e954163e09924775bf4ec0170 commit 2078adf9f0884b0e954163e09924775bf4ec0170 Author: Ilya Tumaykin <itumaykin@gmail.com> AuthorDate: 2018-05-20 15:00:36 +0000 Commit: Mikle Kolyada <zlogene@gentoo.org> CommitDate: 2018-05-27 08:50:57 +0000 app-shells/mpv-bash-completion: addpredict /dev/dri Bug: https://bugs.gentoo.org/656086 Package-Manager: Portage-2.3.38, Repoman-2.3.9 app-shells/mpv-bash-completion/mpv-bash-completion-3.3.16.ebuild | 4 ++++ 1 file changed, 4 insertions(+)