mirror of https://github.com/mosra/magnum.git
Browse Source
If a GL test library would link to MagnumOpenGLTesterTestLib (which has
CORRADE_GRACEFUL_ASSERT enabled to be able to verify assertions) and
then to MagnumDebugTools for DebugTools::bufferData(), it'd mean there's
one GL::Context global from MagnumGLTestLib and one from MagnumGL. Then,
depending on whatever random order the linker uses, different parts of
the library would see a different global, ultimately leading to a
dreaded
GL::Context::current(): no current context
assertion. Right now this only manifested on the macOS static CI build,
but depending on a phase of the moon could happen for any platform in
any circumstance.
First attempt was to switch to linking to MagnumDebugToolsTestLib and
then making MagnumDebugToolsTestLib depend on MagnumGLTestLib instead of
MagnumGL, HOWEVER because DebugTools also depend on Primitives and
Shaders and whatnot for some features, it just moved the conflict
between MagnumGL and MagnumGLTestLib elsewhere -- and ASan started
loudly complaining about GL::defaultFramebuffer being duplicated.
So instead there's now a dedicated subset of DebugTools just for the GL
test themselves, containing currently just DebugTools::bufferData(), as
nothing else is needed ATM. It may grow further when needed, such as
with textureImage(), or CompareImage, etc.
But of course that wouldn't be enough -- MagnumOpenGLTesterTestLib
actually still links to MagnumGL for Other Reasons, meaning we have to
pass it last to prefer symbols from MagnumGLTestLib which have graceful
asserts enabled. Hopefully this works well enough, otherwise I'd have to
figure out yet another variant of the fix.
gltestlib-symbol-duplication
2 changed files with 44 additions and 3 deletions
Loading…
Reference in new issue