Bug 209946 - Do not link with OpenGL on Apple platforms
Summary: Do not link with OpenGL on Apple platforms
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: ANGLE (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Keith Rollin
URL:
Keywords: InRadar
Depends on:
Blocks: 209890
  Show dependency treegraph
 
Reported: 2020-04-02 19:12 PDT by Keith Rollin
Modified: 2020-04-03 17:39 PDT (History)
9 users (show)

See Also:


Attachments
Patch (2.68 KB, patch)
2020-04-02 19:15 PDT, Keith Rollin
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Keith Rollin 2020-04-02 19:12:59 PDT
OpenGL is not used in our build of ANGLE. Attempting to link with it causes warnings, which can turn to errors in some cases (in particular with building with Xcode's "new" build system).
Comment 1 Radar WebKit Bug Importer 2020-04-02 19:13:11 PDT
<rdar://problem/61237956>
Comment 2 Keith Rollin 2020-04-02 19:15:51 PDT
Created attachment 395337 [details]
Patch
Comment 3 EWS Watchlist 2020-04-02 19:16:37 PDT
Note that there are important steps to take when updating ANGLE. See http://trac.webkit.org/wiki/UpdatingANGLE
Comment 4 EWS 2020-04-03 11:00:38 PDT
Committed r259475: <https://trac.webkit.org/changeset/259475>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 395337 [details].
Comment 5 Kenneth Russell 2020-04-03 13:05:27 PDT
How are references to functions like CGLCreateContext resolved after this patch?
Comment 6 Dean Jackson 2020-04-03 17:12:41 PDT
(In reply to Kenneth Russell from comment #5)
> How are references to functions like CGLCreateContext resolved after this
> patch?

Yeah. ANGLE only dynamically loads /System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib

All the CGL stuff is in /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL

So how did this pass tests?
Comment 7 Dean Jackson 2020-04-03 17:19:58 PDT
Oh. It's because it is linked into WebCore which links OpenGL.
Comment 8 Dean Jackson 2020-04-03 17:20:55 PDT
However, this change shouldn't have been necessary. If the new build system can't link against OpenGL, it can't build WebCore or WebKit.
Comment 9 Dean Jackson 2020-04-03 17:23:12 PDT
Did you find out what was actually causing the compiler warning?

Because if it was unused functions when linking, then we also have a bunch of those in other projects.

e.g. 
ld: warning: linking with (/System/Library/Frameworks/CoreAudio.framework/CoreAudio) but not using any symbols from it
ld: warning: linking with (/System/Library/Frameworks/VideoToolbox.framework/VideoToolbox) but not using any symbols from it
ld: warning: linking with (/System/Library/Frameworks/CoreMedia.framework/CoreMedia) but not using any symbols from it
ld: warning: linking with (/System/Library/PrivateFrameworks/URLFormatting.framework/URLFormatting) but not using any symbols from it
ld: warning: linking with (/usr/lib/libAccessibility.dylib) but not using any symbols from it
Comment 10 Keith Rollin 2020-04-03 17:39:09 PDT
(In reply to Dean Jackson from comment #8)
> However, this change shouldn't have been necessary. If the new build system
> can't link against OpenGL, it can't build WebCore or WebKit.

It's not that it can't link against OpenGL. I'm pretty sure that it's because it can't link against an OpenGL that doesn't exist. OpenGL.framework is not in the iphonesimulator SDK. That's where the error was occurring.

WebCore is able to link because it only links against OpenGL on the macOS:

WebCore.xcconfig
108:WK_OPENGL_LDFLAGS_iphoneos = -framework OpenGLES;
109:WK_OPENGL_LDFLAGS_iphonesimulator = -framework OpenGLES;
114:WK_OPENGL_LDFLAGS_maccatalyst = -framework OpenGL;
115:WK_OPENGL_LDFLAGS_macosx = -framework OpenGL;

Thanks for clarifying all of this. I was going crazy today trying to figure out how macOS was linking!