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

Linking against OpenGL using GLVND on Ubuntu 18.04 links wrongly against libOpenGL.so.0 #477

Open
hcorion opened this issue May 3, 2021 · 2 comments

Comments

@hcorion
Copy link
Contributor

hcorion commented May 3, 2021

See the recent relevant conversation that happened over here: linuxdeploy/linuxdeploy#152
And the relevant RPCS3-side issue here: RPCS3/rpcs3#10226

Essentially, when building using the following:

set(OpenGL_GL_PREFERENCE GLVND)
find_package(OpenGL REQUIRED)

add_library(3rdparty_opengl INTERFACE)
target_include_directories(3rdparty_opengl INTERFACE GL)

target_link_libraries(3rdparty_opengl INTERFACE ${OPENGL_LIBRARIES})

target_compile_definitions(3rdparty_opengl
	INTERFACE
	-DGL_GLEXT_PROTOTYPES
	-DGLX_GLXEXT_PROTOTYPES)

on Ubuntu 18.04, it links against libOpenGL.so.0 directly rather than libGL, which causes issues, due to it's distro-dependence. This will cause issues because the option to GLVND use is the default configuration for newer CMake.

Tagging @TheAssassin

@hcorion
Copy link
Contributor Author

hcorion commented May 3, 2021

The odd thing with this issue that I forgot to mention is that it it the above works fine if built on 16.04, but stops working properly in 18.04 for some reason.

@JulianGro
Copy link

I don't see how linking to libOpenGL.so.0 is wrong. You are supposed to link to libOpenGL which in turn will act as a wrapper for libGLdispatch.
Legacy behaviour would be to link libGL which will also act as a wrapper on modern systems. My understanding is that it only provides GLX compatibility and no EGL compatibility like libOpenGL does, though that might not be accurate.
Whatever the case, I am sure there is a reason for libGL being "provided for backwards-compatibility" only. (See their documentation https://github.com/NVIDIA/libglvnd)

By the way, the point of glvnd is that multiple graphics drivers can coexist on the same system. Before glvnd, an Nvidia proprietary driver for example had to provide its own libGL and libOpenGL. Then if you had another driver vendor like Mesa on the same system you ran into the conflict that they too had to provide these libraries, but Nvidias libaries were already present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants