Skip to content

Ubuntu 20.04 compile error for GLEWContextStruct #159

Open
@jesscel

Description

@jesscel

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions