electron: [Bug]: Warning: Class WebSwapCGLLayer is implemented in both system library and electron distribution

Preflight Checklist

Electron Version

18.0.0

What operating system are you using?

macOS

Operating System Version

12.3.1

What arch are you using?

x64

Last Known Working Electron version

17.3.1

Expected Behavior

Starting electron using the npm script "app": "electron ." starts the app with no warnings.

Actual Behavior

Electron starts normally, but with the following warning:

Class WebSwapCGLLayer is implemented in both /System/Library/Frameworks/WebKit.framework/Versions/A/Frameworks/WebCore.framework/Versions/A/Frameworks/libANGLE-shared.dylib (0x7ffa5a006318) and /{path/to/app}/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libGLESv2.dylib (0x10f8a89c8). One of the two will be used. Which one is undefined.

({path/to/app} has been substituted for the actual path to the app on my system.)

Testcase Gist URL

No response

Additional Information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 27
  • Comments: 32 (8 by maintainers)

Most upvoted comments

I have the same problem

@miniak When fix will be available as built in electron package?

@codebytere LOL, we’ll just need to change it to yet another name here to avoid the conflict then.

Hi! electron@20.0.1 the same problem

image

need to add tag 20.x.y

Commenting is a way to bring attention. Sorry if this is not allowed, will subscribe now.

it can be fixed by applying this patch in third_party/angle

diff --git a/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h b/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h
index 783a3dff4..8cfca6aa6 100644
--- a/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h
+++ b/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h
@@ -17,8 +17,7 @@ typedef _CGLContextObject *CGLContextObj;
 struct __IOSurface;
 typedef __IOSurface *IOSurfaceRef;
 
-// WebKit's build process requires that every Objective-C class name has the prefix "Web".
-@class WebSwapCGLLayer;
+@class SwapCGLLayer;
 
 namespace rx
 {
@@ -87,7 +86,7 @@ class WindowSurfaceCGL : public SurfaceGL
                                               const gl::FramebufferState &state) override;
 
   private:
-    WebSwapCGLLayer *mSwapLayer;
+    SwapCGLLayer *mSwapLayer;
     SharedSwapState mSwapState;
     uint64_t mCurrentSwapId;
 
diff --git a/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm b/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm
index 21894682d..fd95c07df 100644
--- a/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm
+++ b/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm
@@ -24,7 +24,7 @@
 #    include "libANGLE/renderer/gl/StateManagerGL.h"
 #    include "libANGLE/renderer/gl/cgl/DisplayCGL.h"
 
-@interface WebSwapCGLLayer : CAOpenGLLayer {
+@interface SwapCGLLayer : CAOpenGLLayer {
     CGLContextObj mDisplayContext;
 
     bool initialized;
@@ -38,7 +38,7 @@ - (id)initWithSharedState:(rx::SharedSwapState *)swapState
             withFunctions:(const rx::FunctionsGL *)functions;
 @end
 
-@implementation WebSwapCGLLayer
+@implementation SwapCGLLayer
 - (id)initWithSharedState:(rx::SharedSwapState *)swapState
               withContext:(CGLContextObj)displayContext
             withFunctions:(const rx::FunctionsGL *)functions
@@ -213,9 +213,9 @@ - (void)drawInCGLContext:(CGLContextObj)glContext
     mSwapState.lastRendered   = &mSwapState.textures[1];
     mSwapState.beingPresented = &mSwapState.textures[2];
 
-    mSwapLayer = [[WebSwapCGLLayer alloc] initWithSharedState:&mSwapState
-                                                  withContext:mContext
-                                                withFunctions:mFunctions];
+    mSwapLayer = [[SwapCGLLayer alloc] initWithSharedState:&mSwapState
+                                               withContext:mContext
+                                             withFunctions:mFunctions];
     [mLayer addSublayer:mSwapLayer];
     [mSwapLayer setContentsScale:[mLayer contentsScale]];

Same issue here, any fix?

I think no~ because, i still console that with using the latest version, just now now now

@miniak any news? Issue is blocking update on current supported version. 17 is last working version, but not supported by electron team.

Does this warning cause any actual problems? I’m on a Mac and get this in my console, but it still seems to work fine. The warning says “which one is undefined” which seems to imply it could be using the wrong one, but so far the Electron app runs OK for me.