Function redefinitions in glimports.h when building for RPi
mbarnes opened this issue · comments
Matthew Barnes commented
Encountered several function redefinition errors in BGFX when building MAME for a Raspberry Pi.
- glDrawBuffer
- glReadBuffer
- glGenSamplers
- glDeleteSamplers
- glBindSampler
- glSamplerParameterf
- glSamplerParameteri
- glSamplerParameterfv
In this context, both BX_PLATFORM_LINUX
and BX_PLATFORM_RPI
are set.
These in turn define two more macros:
#define BGFX_USE_GL_DYNAMIC_LIB (0 \
|| BX_PLATFORM_BSD \
|| BX_PLATFORM_LINUX \
|| BX_PLATFORM_OSX \
|| BX_PLATFORM_WINDOWS \
)
# ifndef BGFX_CONFIG_RENDERER_OPENGLES_MIN_VERSION
# define BGFX_CONFIG_RENDERER_OPENGLES_MIN_VERSION (0 \
|| BX_PLATFORM_ANDROID \
? 30 : 1)
# endif // BGFX_CONFIG_RENDERER_OPENGLES_MIN_VERSION
# ifndef BGFX_CONFIG_RENDERER_OPENGLES
# define BGFX_CONFIG_RENDERER_OPENGLES (0 \
|| BX_PLATFORM_ANDROID \
|| BX_PLATFORM_EMSCRIPTEN \
|| BX_PLATFORM_IOS \
|| BX_PLATFORM_RPI \
|| BX_PLATFORM_NX \
? BGFX_CONFIG_RENDERER_OPENGLES_MIN_VERSION : 0)
# endif // BGFX_CONFIG_RENDERER_OPENGLES
#if BGFX_CONFIG_RENDERER_OPENGLES && BGFX_CONFIG_RENDERER_OPENGLES < 20
# undef BGFX_CONFIG_RENDERER_OPENGLES
# define BGFX_CONFIG_RENDERER_OPENGLES 20
#endif // BGFX_CONFIG_RENDERER_OPENGLES && BGFX_CONFIG_RENDERER_OPENGLES < 20
The above results in BGFX_USE_GL_DYNAMIC_LIB=1
and BGFX_CONFIG_RENDERER_OPENGLES=20
.
Consequently, glDrawBuffer for example is defined twice in glimports.h
at line 302 and also at line 587.
Here's the actual compiler output, again in the context of building MAME:
GCC 10.2.1 detected
Compiling 3rdparty/bgfx/src/glcontext_egl.cpp...
../../../../../3rdparty/bgfx/src/glimports.h:587:68: error: redefinition of ‘void (* bgfx::gl::glDrawBuffer)(GLenum)’
587 | GL_IMPORT______(true, PFNGLDRAWBUFFERPROC, glDrawBuffer);
| ^~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glcontext_egl.cpp:99:62: note: in definition of macro ‘GL_IMPORT’
99 | # define GL_IMPORT(_optional, _proto, _func, _import) _proto _func = NULL
| ^~~~~
../../../../../3rdparty/bgfx/src/glimports.h:587:1: note: in expansion of macro ‘GL_IMPORT______’
587 | GL_IMPORT______(true, PFNGLDRAWBUFFERPROC, glDrawBuffer);
| ^~~~~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glimports.h:302:68: note: ‘void (* bgfx::gl::glDrawBuffer)(GLenum)’ previously defined here
302 | GL_IMPORT______(true, PFNGLDRAWBUFFERPROC, glDrawBuffer);
| ^~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glcontext_egl.cpp:99:62: note: in definition of macro ‘GL_IMPORT’
99 | # define GL_IMPORT(_optional, _proto, _func, _import) _proto _func = NULL
| ^~~~~
../../../../../3rdparty/bgfx/src/glimports.h:302:1: note: in expansion of macro ‘GL_IMPORT______’
302 | GL_IMPORT______(true, PFNGLDRAWBUFFERPROC, glDrawBuffer);
| ^~~~~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glimports.h:588:68: error: redefinition of ‘void (* bgfx::gl::glReadBuffer)(GLenum)’
588 | GL_IMPORT______(true, PFNGLREADBUFFERPROC, glReadBuffer);
| ^~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glcontext_egl.cpp:99:62: note: in definition of macro ‘GL_IMPORT’
99 | # define GL_IMPORT(_optional, _proto, _func, _import) _proto _func = NULL
| ^~~~~
../../../../../3rdparty/bgfx/src/glimports.h:588:1: note: in expansion of macro ‘GL_IMPORT______’
588 | GL_IMPORT______(true, PFNGLREADBUFFERPROC, glReadBuffer);
| ^~~~~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glimports.h:384:68: note: ‘void (* bgfx::gl::glReadBuffer)(GLenum)’ previously defined here
384 | GL_IMPORT______(true, PFNGLREADBUFFERPROC, glReadBuffer);
| ^~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glcontext_egl.cpp:99:62: note: in definition of macro ‘GL_IMPORT’
99 | # define GL_IMPORT(_optional, _proto, _func, _import) _proto _func = NULL
| ^~~~~
../../../../../3rdparty/bgfx/src/glimports.h:384:1: note: in expansion of macro ‘GL_IMPORT______’
384 | GL_IMPORT______(true, PFNGLREADBUFFERPROC, glReadBuffer);
| ^~~~~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glimports.h:589:68: error: redefinition of ‘void (* bgfx::gl::glGenSamplers)(GLsizei, GLuint*)’
589 | GL_IMPORT______(true, PFNGLGENSAMPLERSPROC, glGenSamplers);
| ^~~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glcontext_egl.cpp:99:62: note: in definition of macro ‘GL_IMPORT’
99 | # define GL_IMPORT(_optional, _proto, _func, _import) _proto _func = NULL
| ^~~~~
../../../../../3rdparty/bgfx/src/glimports.h:589:1: note: in expansion of macro ‘GL_IMPORT______’
589 | GL_IMPORT______(true, PFNGLGENSAMPLERSPROC, glGenSamplers);
| ^~~~~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glimports.h:323:68: note: ‘void (* bgfx::gl::glGenSamplers)(GLsizei, GLuint*)’ previously defined here
323 | GL_IMPORT______(true, PFNGLGENSAMPLERSPROC, glGenSamplers);
| ^~~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glcontext_egl.cpp:99:62: note: in definition of macro ‘GL_IMPORT’
99 | # define GL_IMPORT(_optional, _proto, _func, _import) _proto _func = NULL
| ^~~~~
../../../../../3rdparty/bgfx/src/glimports.h:323:1: note: in expansion of macro ‘GL_IMPORT______’
323 | GL_IMPORT______(true, PFNGLGENSAMPLERSPROC, glGenSamplers);
| ^~~~~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glimports.h:590:68: error: redefinition of ‘void (* bgfx::gl::glDeleteSamplers)(GLsizei, const GLuint*)’
590 | GL_IMPORT______(true, PFNGLDELETESAMPLERSPROC, glDeleteSamplers);
| ^~~~~~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glcontext_egl.cpp:99:62: note: in definition of macro ‘GL_IMPORT’
99 | # define GL_IMPORT(_optional, _proto, _func, _import) _proto _func = NULL
| ^~~~~
../../../../../3rdparty/bgfx/src/glimports.h:590:1: note: in expansion of macro ‘GL_IMPORT______’
590 | GL_IMPORT______(true, PFNGLDELETESAMPLERSPROC, glDeleteSamplers);
| ^~~~~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glimports.h:287:68: note: ‘void (* bgfx::gl::glDeleteSamplers)(GLsizei, const GLuint*)’ previously defined here
287 | GL_IMPORT______(true, PFNGLDELETESAMPLERSPROC, glDeleteSamplers);
| ^~~~~~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glcontext_egl.cpp:99:62: note: in definition of macro ‘GL_IMPORT’
99 | # define GL_IMPORT(_optional, _proto, _func, _import) _proto _func = NULL
| ^~~~~
../../../../../3rdparty/bgfx/src/glimports.h:287:1: note: in expansion of macro ‘GL_IMPORT______’
287 | GL_IMPORT______(true, PFNGLDELETESAMPLERSPROC, glDeleteSamplers);
| ^~~~~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glimports.h:591:68: error: redefinition of ‘void (* bgfx::gl::glBindSampler)(GLuint, GLuint)’
591 | GL_IMPORT______(true, PFNGLBINDSAMPLERPROC, glBindSampler);
| ^~~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glcontext_egl.cpp:99:62: note: in definition of macro ‘GL_IMPORT’
99 | # define GL_IMPORT(_optional, _proto, _func, _import) _proto _func = NULL
| ^~~~~
../../../../../3rdparty/bgfx/src/glimports.h:591:1: note: in expansion of macro ‘GL_IMPORT______’
591 | GL_IMPORT______(true, PFNGLBINDSAMPLERPROC, glBindSampler);
| ^~~~~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glimports.h:247:68: note: ‘void (* bgfx::gl::glBindSampler)(GLuint, GLuint)’ previously defined here
247 | GL_IMPORT______(true, PFNGLBINDSAMPLERPROC, glBindSampler);
| ^~~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glcontext_egl.cpp:99:62: note: in definition of macro ‘GL_IMPORT’
99 | # define GL_IMPORT(_optional, _proto, _func, _import) _proto _func = NULL
| ^~~~~
../../../../../3rdparty/bgfx/src/glimports.h:247:1: note: in expansion of macro ‘GL_IMPORT______’
247 | GL_IMPORT______(true, PFNGLBINDSAMPLERPROC, glBindSampler);
| ^~~~~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glimports.h:592:68: error: redefinition of ‘void (* bgfx::gl::glSamplerParameterf)(GLuint, GLenum, GLfloat)’
592 | GL_IMPORT______(true, PFNGLSAMPLERPARAMETERFPROC, glSamplerParameterf);
| ^~~~~~~~~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glcontext_egl.cpp:99:62: note: in definition of macro ‘GL_IMPORT’
99 | # define GL_IMPORT(_optional, _proto, _func, _import) _proto _func = NULL
| ^~~~~
../../../../../3rdparty/bgfx/src/glimports.h:592:1: note: in expansion of macro ‘GL_IMPORT______’
592 | GL_IMPORT______(true, PFNGLSAMPLERPARAMETERFPROC, glSamplerParameterf);
| ^~~~~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glimports.h:390:68: note: ‘void (* bgfx::gl::glSamplerParameterf)(GLuint, GLenum, GLfloat)’ previously defined here
390 | GL_IMPORT______(true, PFNGLSAMPLERPARAMETERFPROC, glSamplerParameterf);
| ^~~~~~~~~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glcontext_egl.cpp:99:62: note: in definition of macro ‘GL_IMPORT’
99 | # define GL_IMPORT(_optional, _proto, _func, _import) _proto _func = NULL
| ^~~~~
../../../../../3rdparty/bgfx/src/glimports.h:390:1: note: in expansion of macro ‘GL_IMPORT______’
390 | GL_IMPORT______(true, PFNGLSAMPLERPARAMETERFPROC, glSamplerParameterf);
| ^~~~~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glimports.h:593:68: error: redefinition of ‘void (* bgfx::gl::glSamplerParameteri)(GLuint, GLenum, GLint)’
593 | GL_IMPORT______(true, PFNGLSAMPLERPARAMETERIPROC, glSamplerParameteri);
| ^~~~~~~~~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glcontext_egl.cpp:99:62: note: in definition of macro ‘GL_IMPORT’
99 | # define GL_IMPORT(_optional, _proto, _func, _import) _proto _func = NULL
| ^~~~~
../../../../../3rdparty/bgfx/src/glimports.h:593:1: note: in expansion of macro ‘GL_IMPORT______’
593 | GL_IMPORT______(true, PFNGLSAMPLERPARAMETERIPROC, glSamplerParameteri);
| ^~~~~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glimports.h:389:68: note: ‘void (* bgfx::gl::glSamplerParameteri)(GLuint, GLenum, GLint)’ previously defined here
389 | GL_IMPORT______(true, PFNGLSAMPLERPARAMETERIPROC, glSamplerParameteri);
| ^~~~~~~~~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glcontext_egl.cpp:99:62: note: in definition of macro ‘GL_IMPORT’
99 | # define GL_IMPORT(_optional, _proto, _func, _import) _proto _func = NULL
| ^~~~~
../../../../../3rdparty/bgfx/src/glimports.h:389:1: note: in expansion of macro ‘GL_IMPORT______’
389 | GL_IMPORT______(true, PFNGLSAMPLERPARAMETERIPROC, glSamplerParameteri);
| ^~~~~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glimports.h:594:68: error: redefinition of ‘void (* bgfx::gl::glSamplerParameterfv)(GLuint, GLenum, const GLfloat*)’
594 | GL_IMPORT______(true, PFNGLSAMPLERPARAMETERFVPROC, glSamplerParameterfv);
| ^~~~~~~~~~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glcontext_egl.cpp:99:62: note: in definition of macro ‘GL_IMPORT’
99 | # define GL_IMPORT(_optional, _proto, _func, _import) _proto _func = NULL
| ^~~~~
../../../../../3rdparty/bgfx/src/glimports.h:594:1: note: in expansion of macro ‘GL_IMPORT______’
594 | GL_IMPORT______(true, PFNGLSAMPLERPARAMETERFVPROC, glSamplerParameterfv);
| ^~~~~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glimports.h:391:68: note: ‘void (* bgfx::gl::glSamplerParameterfv)(GLuint, GLenum, const GLfloat*)’ previously defined here
391 | GL_IMPORT______(true, PFNGLSAMPLERPARAMETERFVPROC, glSamplerParameterfv);
| ^~~~~~~~~~~~~~~~~~~~
../../../../../3rdparty/bgfx/src/glcontext_egl.cpp:99:62: note: in definition of macro ‘GL_IMPORT’
99 | # define GL_IMPORT(_optional, _proto, _func, _import) _proto _func = NULL
| ^~~~~
../../../../../3rdparty/bgfx/src/glimports.h:391:1: note: in expansion of macro ‘GL_IMPORT______’
391 | GL_IMPORT______(true, PFNGLSAMPLERPARAMETERFVPROC, glSamplerParameterfv);
| ^~~~~~~~~~~~~~~
make[2]: *** [bgfx.make:531: ../../../../linux_gcc/obj/x64/Release/3rdparty/bgfx/src/glcontext_egl.o] Error 1
make[1]: *** [Makefile:73: bgfx] Error 2
make: *** [makefile:1286: linux_x64] Error 2
Matthew Barnes commented
Looks like #3117 fixed the issue, so closing.