find versioned libGL, libEGL, libX11 on linux #39
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As asked about here
Additional context: symlinks and .so files on linux - what you need to know
On linux systems without an
-develpackage, the symlinks for unversioned library access are often(?) not available, and-develpackages are not installed by default on most distros.So on a fresh install, both moderngl and glcontext are not able to find the unversioned
libEGL.so,libGL.so, andlibX11.so.To deal with that, I first patched moderngl to use python's
ctypes.util.find_library, which looks at what the dynamic linker has available when given a base name.Since moderngl's test suite relies heavily on glcontext, I had to port that functionality to over there as well.
glcontext is written in C, and a "find" function for dynamic libraries does not exist, thus the solution here is more limited and inflexible. It tries both the versioned and unversioned names for all modules that use
dlopen.On my system, both glcontext and moderngl test successfully.
In the process I also removed a few warnings and made the error messages about loading the shared libraries between
glcontext.eglandglcontext.x11more consistent.Sadly, glcontext is not part of moderngl, so two PRs are needed, and checks of moderngl won't pass until the functionality is in glcontext first.
Besides functionality checks, if any of this breaks style guides, please let me know.