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

GLEW CMake config error in 2020 images #43

Open
michdolan opened this issue Apr 26, 2020 · 6 comments
Open

GLEW CMake config error in 2020 images #43

michdolan opened this issue Apr 26, 2020 · 6 comments

Comments

@michdolan
Copy link

While moving OCIO CI to GH Actions I encountered a linking error with the GLEW install in the aswf/ci-base:2020 images. When configuring a build with CMake within this container, GLEW is found through the default FindGLEW.cmake module with the following output:

-- Found GLEW: /usr/local/lib64/cmake/glew/glew-config.cmake

In the aswf/ci-base:2019 the same configure step finds GLEW at:

-- Found GLEW: /usr/local/include

The 2019 result links properly, but the 2020 result results in the following linking error during the OCIO build:

[ 73%] Linking CXX executable ociodisplay
../../libutils/oglbuilder/libOpenColorIOoglbuilder.a(glsl.cpp.o): In function `OpenColorIO_v2_0dev::OpenGLBuilder::Uniform::setUp(unsigned int)':
glsl.cpp:(.text+0x122): undefined reference to `__glewGetUniformLocation'
...
CMakeFiles/ociodisplay.dir/main.cpp.o: In function `main':
main.cpp:(.text.startup+0x65): undefined reference to `glewInit'
main.cpp:(.text.startup+0x6f): undefined reference to `glewIsSupported'
collect2: error: ld returned 1 exit status
gmake[2]: *** [src/apps/ociodisplay/ociodisplay] Error 1

I worked around the failure by deleting the GLEW CMake config before running cmake with:

sudo rm -rf /usr/local/lib64/cmake/glew

Following that, the find module behaves identically to the 2019 container.

@aloysbaillet
Copy link
Contributor

Would you be able to check if this problem still exists with the new 2020 images I've released today? They have changed quite a bit...

@michdolan
Copy link
Author

It exists in aswf/ocio-ci:2020 (which is the same digest as 2020.3 correct?). I used the above mentioned workaround to resolve it.

@jfpanisset
Copy link
Contributor

I can confirm that this also an issue with the aswf/ci-ocio:2021 Docker image. With the following test CMakeLists.txt:

project(foo)
find_package(GLEW)
message(STATUS "GLEW_LIBRARIES is ${GLEW_LIBRARIES}")
message(STATUS "GLEW_INCLUDE_DIRS is ${GLEW_INCLUDE_DIRS}")
message(STATUS "GLEW_FOUND is ${GLEW_FOUND}")

you get:

-- Found GLEW: /usr/local/lib64/cmake/glew/glew-config.cmake
-- GLEW_LIBRARIES is
-- GLEW_INCLUDE_DIRS is
-- GLEW_FOUND is TRUE

but if you remove /usr/local/lib64/cmake/glew/glew-config.cmake from the container, instead:

-- Found GLEW: /usr/local/include (found version "2.1.0")
-- GLEW_LIBRARIES is /usr/local/lib64/libGLEW.so
-- GLEW_INCLUDE_DIRS is /usr/local/include
-- GLEW_FOUND is TRUE

which allows the OpenGL apps and test suite to link correctly (not finding GLEW_INCLUDE_DIRS is not a problem since -I/usr/local/include presumably comes from somewhere else, but not finding the GLEW libraries causes linking errors).

It looks like this is the last thing needed to get OpenGL builds/runs using the Amazon CodeBuild infrastructure, so it would be great to figure this out.

@hodoulp
Copy link
Member

hodoulp commented Aug 20, 2020

Here is the code of glew-config.cmake which does not create the 'usual' variables. It only defines GLEW::GLEW.

Here is the cmake issue 19662 (fixed) related to GLEW to enhance the variables to have the missing GLEW_LIBRARIES and GLEW_INCLUDE_DIRS.

@aloysbaillet
Copy link
Contributor

Thanks @hodoulp ! Do you think we should apply this patch in the docker images? I'm OK either way.

@hodoulp
Copy link
Member

hodoulp commented Aug 21, 2020

@aloysbaillet The change is now in OCIO but if other projects need GLEW I think it's worth centralizing the change in the docker scripts.

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

4 participants