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

Pangolin forgets HAVE_GLEW when installed #803

Open
alex-fu27 opened this issue Oct 18, 2022 · 2 comments
Open

Pangolin forgets HAVE_GLEW when installed #803

alex-fu27 opened this issue Oct 18, 2022 · 2 comments

Comments

@alex-fu27
Copy link

alex-fu27 commented Oct 18, 2022

Steps: I cloned the repo, built Pangolin from source. GLEW is found correctly,

$ grep 'GLEW' build/CMakeCache.txt 
GLEW_INCLUDE_DIR:PATH=/usr/include
//The GLEW library
GLEW_LIBRARY:FILEPATH=/usr/lib/libGLEW.so
pango_opengl_LIB_DEPENDS:STATIC=general;pango_core;general;pango_image;general;/usr/lib/libGLEW.so;general;/usr/lib/libOpenGL.so;general;/usr/lib/libGLX.so;general;/usr/lib/libGLU.so;

I built with ninja -v and -DHAVE_GLEW is correctly passed to the compiler.

I then created the following test.cpp:

#include <pangolin/pangolin.h>

and tried to compile with gcc -Wfatal-errors -Idest/usr/local/include test.cpp:

In file included from dest/usr/local/include/pangolin/gl/gl.h:324,
                 from dest/usr/local/include/pangolin/handler/handler.h:31,
                 from dest/usr/local/include/pangolin/display/widgets.h:32,
                 from dest/usr/local/include/pangolin/pangolin.h:40,
                 from test.cpp:1:
dest/usr/local/include/pangolin/gl/gl.hpp: In member function 'void pangolin::GlTexture::CopyFrom(const pangolin::GlTexture&)':
dest/usr/local/include/pangolin/gl/gl.hpp:348:5: error: 'glCopyImageSubDataNV' was not declared in this scope
  348 |     glCopyImageSubDataNV(tex.tid, GL_TEXTURE_2D, 0, 0, 0, 0,
      |     ^~~~~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.

This is because nothing sets HAVE_GLEW in that case and in glplatform.h:

#ifdef HAVE_GLEW
    #include <GL/glew.h>
#endif

is conditional.

For most other users it might work because

  • they coincidentally set -DHAVE_GLEW for other reasons,
  • they include GL/glew.h before they include pangolin.h,
  • or, they have these functions declared in GL/gl.h for some reasons which can be the case on some systems.

The first two can be used as a workaround.

@stevenlovegrove
Copy link
Owner

Sorry about that - I have a cmake-centric workflow and this (and many other) defines are configured as part of the CMake export interface (output here https://github.com/stevenlovegrove/Pangolin/blob/master/cmake/PangolinConfig.cmake.in#L6).

Since the library is split into many components, it saves me from having a seperate config.h.in file for each component, but I see it would cause problems for non-cmake users. I'm not sure what the most elegant solution is here. A workaround is to use CMake, but that won't suit everyone.

@xlb8
Copy link

xlb8 commented Apr 24, 2023

Sorry about that - I have a cmake-centric workflow and this (and many other) defines are configured as part of the CMake export interface (output here https://github.com/stevenlovegrove/Pangolin/blob/master/cmake/PangolinConfig.cmake.in#L6).

Since the library is split into many components, it saves me from having a seperate config.h.in file for each component, but I see it would cause problems for non-cmake users. I'm not sure what the most elegant solution is here. A workaround is to use CMake, but that won't suit everyone.

hi,steven .thanks to your nice code. and i use cmake 3.16 and the latest branch of pangolin ,it appears the kind of error "undefined gl*******" above.hope you can check this problem. the HAVE_GLEW defined in PangolinTargets.cmake seems not work .i defined it in my CMakeList.txt of my program to solve this tempararily..

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

3 participants