Skip to content

USE_SYSTEM_GLEW isn't respected by avogadrolibs if a system copy is installed #157

@matterhorn103

Description

@matterhorn103

I finally tracked down the thing that was preventing me building on openSUSE Tumbleweed due to failures in the final linking step – Avogadro::Rendering was building against my system copy of libGLEW.so.2.2, despite the default configuration of USE_SYSTEM_GLEW=OFF and despite the fact that GLEW was still being built from source.

It seems that a mismatch in version symbols between the built library and system library was then causing ld to fail, resulting in linking errors like:

...
[100%] Linking CXX executable ../bin/avogadro2
/usr/lib64/gcc/x86_64-suse-linux/14/../../../../x86_64-suse-linux/bin/ld: ./build/prefix/lib64/libAvogadroRendering.so.1.100.0: undefined reference to `__glewCompileShader@G_'
/usr/lib64/gcc/x86_64-suse-linux/14/../../../../x86_64-suse-linux/bin/ld: ./build/prefix/lib64/libAvogadroRendering.so.1.100.0: undefined reference to `__glewGenBuffers@G_'
...
/usr/lib64/gcc/x86_64-suse-linux/14/../../../../x86_64-suse-linux/bin/ld: ./build/prefix/lib64/libAvogadroRendering.so.1.100.0: undefined reference to `__glewCreateShader@G_'
collect2: error: ld returned 1 exit status
gmake[5]: *** [avogadro/CMakeFiles/avogadro.dir/build.make:301: bin/avogadro2] Error 1
...

I found a way to ensure the GLEW put in the prefix directory at ./build/prefix/lib/libGLEW.so.2.2 is the one used at runtime over the system one, but this was only a half-fix as I couldn't work out how to prevent the system library being used to build Avogadro::Rendering at build time.

The easiest solution, for anyone who ever has the same issue, is to simply uninstall the system copy of the library. In the end, this is what I did, and I gave up on trying to fix the wider issue.

I would have thought the same issue applies to other third-party dependencies too, but the build seems to complete successfully even if the Open Babel from the Tumbleweed repos is installed, so maybe it's only GLEW it's a problem for.

Since the issue only crops up in a very specific set of circumstances, and the plan is to move off GLEW anyway, I suspect this isn't worth fixing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions