Bug 241131 - BitmapTextureGL.cpp: undefined reference to WebCore::openGLFunctionTable when WEBGL=no
Summary: BitmapTextureGL.cpp: undefined reference to WebCore::openGLFunctionTable when...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-31 09:20 PDT by Dennis Nezic
Modified: 2022-06-07 09:21 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Nezic 2022-05-31 09:20:43 PDT
When WEBGL=no, but OPENGL=yes and TEXTURE_MAPPER_GL=yes, the opengl function calls in Source/WebCore/platform/graphics/texmap/BitmapTextureGL.cpp fail during the final ld linking stage of libwebkit2gtk-4.0.so, I guess because Source/WebCore/platform/graphics/OpenGLShims.cpp is only included when WEBGL=yes.

Getting rid of that #if ENABLE(WEBGL) preprocessing in OpenGLShims.cpp allowed things to link/compile for me.

Linking CXX shared library lib/libwebkit2gtk-4.0.so...
FAILED: lib/libwebkit2gtk-4.0.so....

ld: Source/WebCore/CMakeFiles/WebCore.dir/./platform/graphics/texmap/BitmapTextureGL.cpp.o: in function `WebCore::BitmapTextureGL::initializeStencil()':
BitmapTextureGL.cpp: undefined reference to `WebCore::openGLFunctionTable()'
ld: BitmapTextureGL.cpp: undefined reference to `WebCore::openGLFunctionTable()'
ld: BitmapTextureGL.cpp: undefined reference to `WebCore::openGLFunctionTable()'
ld: BitmapTextureGL.cpp: undefined reference to `WebCore::openGLFunctionTable()'
ld: BitmapTextureGL.cpp: undefined reference to `WebCore::openGLFunctionTable()'
ld: Source/WebCore/CMakeFiles/WebCore.dir/./platform/graphics/texmap/BitmapTextureGL.cpp.o:BitmapTextureGL.cpp: more undefined references to `WebCore::openGLFunctionTable()' follow
ld: Source/WebCore/CMakeFiles/WebCore.dir/./platform/graphics/GLContext.cpp.o: in function `WebCore::initializeOpenGLShimsIfNeeded()':
GLContext.cpp: undefined reference to `WebCore::initializeOpenGLShims()'
ld: Source/WebCore/CMakeFiles/WebCore.dir/./platform/graphics/GLContext.cpp.o: in function `WebCore::GLContext::version()':
GLContext.cpp: undefined reference to `WebCore::openGLFunctionTable()'
ld: Source/WebCore/CMakeFiles/WebCore.dir/./platform/graphics/glx/GLContextGLX.cpp.o: in function `WebCore::GLContextGLX::~GLContextGLX()':
GLContextGLX.cpp: undefined reference to `WebCore::openGLFunctionTable()'
collect2: error: ld returned 1 exit status
Comment 1 Michael Catanzaro 2022-05-31 09:35:11 PDT
WebKitGTK is not expected to build with ENABLE_WEBGL=OFF. Please limit yourself to using the public build options, not the private (CMake ADVANCED) options.
Comment 2 Michael Catanzaro 2022-05-31 09:36:37 PDT
(In reply to Michael Catanzaro from comment #1)
> WebKitGTK is not expected to build with ENABLE_WEBGL=OFF.

Well, it's not expected to build if you also use ENABLE_OPENGL=ON, which implies ENABLE_WEBGL=ON. If you have a very small patch or PR to fix the build in your configuration, we could consider it, but it'll probably break again in the future.
Comment 3 Dennis Nezic 2022-05-31 09:46:18 PDT
(In reply to Michael Catanzaro from comment #2)
> (In reply to Michael Catanzaro from comment #1)
> > WebKitGTK is not expected to build with ENABLE_WEBGL=OFF.
> 
> Well, it's not expected to build if you also use ENABLE_OPENGL=ON, which
> implies ENABLE_WEBGL=ON. If you have a very small patch or PR to fix the
> build in your configuration, we could consider it, but it'll probably break
> again in the future.

Yea I was wondering about that. Shouldn't we then have the cmake configuration script enforce that dependency?

I assumed the dependency was the other way around, that webgl was the higher level (and unecessary imho) thing that depended on opengl. Maybe I don't even need opengl - I don't do anything 3d with my browser - does it help with 2d stuff?
Comment 4 Michael Catanzaro 2022-05-31 09:49:01 PDT
(In reply to Dennis Nezic from comment #3)
> Yea I was wondering about that. Shouldn't we then have the cmake
> configuration script enforce that dependency?

We only enforce dependencies for public options. Private options are a free-for-all: trying to set rules for them would be a little silly, since only WebKit developers should be using them.

> I assumed the dependency was the other way around, that webgl was the higher
> level (and unecessary imho) thing that depended on opengl. Maybe I don't
> even need opengl - I don't do anything 3d with my browser - does it help
> with 2d stuff?

I think OpenGL enabled should result in faster rendering.
Comment 5 Adrian Perez 2022-05-31 12:59:06 PDT
(In reply to Michael Catanzaro from comment #4)
> (In reply to Dennis Nezic from comment #3)
> > Yea I was wondering about that. Shouldn't we then have the cmake
> > configuration script enforce that dependency?
> 
> We only enforce dependencies for public options. Private options are a
> free-for-all: trying to set rules for them would be a little silly, since
> only WebKit developers should be using them.
> 
> > I assumed the dependency was the other way around, that webgl was the higher
> > level (and unecessary imho) thing that depended on opengl. Maybe I don't
> > even need opengl - I don't do anything 3d with my browser - does it help
> > with 2d stuff?
> 
> I think OpenGL enabled should result in faster rendering.

Some websites will not work correctly without OpenGL, because it's used
for accelerated compositing, and accelerated compositing in turn gets
used for web content that uses e.g. CSS 3D transforms. And also compositing
tiles in the GPU results in a smoother user experience a number of situations.