mitsuba icon indicating copy to clipboard operation
mitsuba copied to clipboard

Ubuntu 20.04 compile error for GLEWContextStruct

Open jesscel opened this issue 2 years ago • 2 comments

I was trying to compile mitsuba 0.6.0 on Ubuntu 20.04 machine. I have changed the compiler to -std=gnu++11 for this version of Ubuntu. Previously, I have successfully compiled mitsuba on Ubuntu 16.04 with the compiler set to -std=c++11.

However, on Ubuntu 20.04, I got the following error:

In file included from include/mitsuba/mitsuba.h:52,
                 from src/libhw/glrenderer.cpp:19:
src/libhw/glrenderer.cpp: In member function ‘virtual void mitsuba::GLRenderer::init(mitsuba::Device*, mitsuba::Renderer*)’:
src/libhw/glrenderer.cpp:148:39: warning: ?: using integer constants in boolean context [-Wint-in-bool-context]
  148 |         Log((m_warnLogLevel == EWarn) ? EInfo : m_warnLogLevel,
include/mitsuba/core/logger.h:40:31: note: in definition of macro ‘Log’
   40 |         if (logger != NULL && level >= logger->getLogLevel()) \
      |                               ^~~~~
src/libhw/glrenderer.cpp:197:39: warning: ?: using integer constants in boolean context [-Wint-in-bool-context]
  197 |         Log((m_warnLogLevel == EWarn) ? EInfo : m_warnLogLevel,
include/mitsuba/core/logger.h:40:31: note: in definition of macro ‘Log’
   40 |         if (logger != NULL && level >= logger->getLogLevel()) \
      |                               ^~~~~
In file included from include/mitsuba/mitsuba.h:51,
                 from src/libhw/glrenderer.cpp:19:
include/mitsuba/core/tls.h: In instantiation of ‘static void* mitsuba::PrimitiveThreadLocal<ValueType>::construct() [with ValueType = GLEWContextStruct]’:
include/mitsuba/core/tls.h:118:60:   required from ‘mitsuba::PrimitiveThreadLocal<ValueType>::PrimitiveThreadLocal() [with ValueType = GLEWContextStruct]’
src/libhw/glrenderer.cpp:33:57:   required from here
include/mitsuba/core/tls.h:140:16: error: invalid use of incomplete type ‘struct GLEWContextStruct’
  140 |         return new ValueType();
      |                ^~~~~~~~~~~~~~~
In file included from src/libhw/glrenderer.cpp:25:
include/mitsuba/hw/glrenderer.h:25:8: note: forward declaration of ‘struct GLEWContextStruct’
   25 | struct GLEWContextStruct;
      |        ^~~~~~~~~~~~~~~~~
In file included from include/mitsuba/mitsuba.h:51,
                 from src/libhw/glrenderer.cpp:19:
include/mitsuba/core/tls.h: In instantiation of ‘static void mitsuba::PrimitiveThreadLocal<ValueType>::destruct(void*) [with ValueType = GLEWContextStruct]’:
include/mitsuba/core/tls.h:119:32:   required from ‘mitsuba::PrimitiveThreadLocal<ValueType>::PrimitiveThreadLocal() [with ValueType = GLEWContextStruct]’
src/libhw/glrenderer.cpp:33:57:   required from here
include/mitsuba/core/tls.h:145:13: warning: possible problem detected in invocation of delete operator: [-Wdelete-incomplete]
  145 |             delete static_cast<ValueType *>(data);
      |             ^~~~~~
include/mitsuba/core/tls.h:145:45: warning: invalid use of incomplete type ‘struct GLEWContextStruct’
  145 |             delete static_cast<ValueType *>(data);
      |                                             ^~~~
In file included from src/libhw/glrenderer.cpp:25:
include/mitsuba/hw/glrenderer.h:25:8: note: forward declaration of ‘struct GLEWContextStruct’
   25 | struct GLEWContextStruct;
      |        ^~~~~~~~~~~~~~~~~
In file included from include/mitsuba/mitsuba.h:51,
                 from src/libhw/glrenderer.cpp:19:
include/mitsuba/core/tls.h:145:13: note: neither the destructor nor the class-specific operator delete will be called, even if they are declared when the class is defined
  145 |             delete static_cast<ValueType *>(data);
      |             ^~~~~~
scons: *** [build/release/libhw/glrenderer.os] Error 1
scons: building terminated because of errors.

Any idea how to fix that problem in Ubuntu 20.04?

jesscel avatar Mar 09 '22 05:03 jesscel

Just try this command: sudo apt-get install glew-utils libglewmx-dev

I fixed this error by using these dependencies.

LZleejean avatar Apr 18 '22 03:04 LZleejean

Just try this command: sudo apt-get install glew-utils libglewmx-dev

I fixed this error by using these dependencies.

I've also no idea for this problem for a long time until I saw the issue. That's work. Thanks!

indevn avatar Jun 24 '22 16:06 indevn