Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 770193 - x11-misc/primus-0.2-r2: Segfault with primus_vk on GLVND systems
Summary: x11-misc/primus-0.2-r2: Segfault with primus_vk on GLVND systems
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL: https://github.com/felixdoerre/primus...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-12 09:32 UTC by Benjamin Resch
Modified: 2022-07-24 08:31 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Resch 2021-02-12 09:32:22 UTC
When [primus_vk](https://github.com/felixdoerre/primus_vk), which uses primus as backend, is built from source and "pvkrun vkcube" is run, this ends with a segfault.

After some [debugging](https://github.com/felixdoerre/primus_vk/issues/88) together with the owner of primus_vk, it turned out that on systems with GLVND enabled, applications should always use the libglvnd-provided libGL.so.1 library which then determines the correct vendor-specifig libGL. The vendor-specific GLVND-compatible libGLs are apparently not required to export all the GL-related symbols.

Therefore, we considered the injection of the primus-0.2-r2.ebuild of
~~~bash
export PRIMUS_libGLa='/usr/$LIB/libGLX_nvidia.so.0'
export PRIMUS_libGLd='/usr/$LIB/libGLX.so.0'
~~~
into primusrun when libglvnd is considered active to be a bug, especially due to the fact that the segfault problens disappear when primusrun is modified to contain
~~~bash
export PRIMUS_libGLa='/usr/$LIB/libGL.so.1'
export PRIMUS_libGLd='/usr/$LIB/libGL.so.1'
~~~

Please refer to the original [bug report](https://github.com/felixdoerre/primus_vk/issues/88) for details.

Reproducible: Always

Steps to Reproduce:
1. Install [primus_vk](https://github.com/felixdoerre/primus_vk) from source - you will have to patch the libdir in the Makefile as well as one include in primus_vp.cpp.
2. Run "pvkrun vkcube"
Actual Results:  
vkcube segfaults in /usr/lib64/libGLX_nvidia.so.0

Expected Results:  
vkcube runs on the dedicated GPU

Refer to https://github.com/felixdoerre/primus_vk/issues/88 for details on how to reproduce the bug, on how we tracked it down and on some background information of how glvnd is supposed to work with references to its specifications.
Comment 1 Benjamin Resch 2021-02-12 09:44:59 UTC
There's also a suggestion of primus_vk's author in https://github.com/felixdoerre/primus_vk/issues/88 to avoid all this "export PRIMUS_libGL..." for finding the correct libraries in primus and configure it correctly in bumblebee.conf, because primus seems to fetch it from optirun when it has no own values set - so this would be the general solution.

Does it make more sense to fix it step by step (first export the correct libraries for primusrun, then fix bumblebee, then remove exports from primusrun again) or should this better be a combined effort where both packages are updated at once?