Bug 225070 - Only link WTF from JavaScriptCore and only link PAL from WebCore in Mac CMake build
Summary: Only link WTF from JavaScriptCore and only link PAL from WebCore in Mac CMake...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-04-26 12:43 PDT by Alex Christensen
Modified: 2021-09-29 09:58 PDT (History)
14 users (show)

See Also:


Attachments
Patch (8.07 KB, patch)
2021-04-26 12:47 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (43.60 KB, patch)
2021-09-28 23:14 PDT, Alex Christensen
don.olmstead: review-
ews-feeder: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Christensen 2021-04-26 12:43:36 PDT
Only link WTF from JavaScriptCore and only link PAL from WebCore in Mac CMake build
Comment 1 Alex Christensen 2021-04-26 12:47:21 PDT
Created attachment 427082 [details]
Patch
Comment 2 Alex Christensen 2021-04-26 13:20:36 PDT
Comment on attachment 427082 [details]
Patch

I'm. going to try object libraries instead of this.
Comment 3 Alex Christensen 2021-04-27 09:59:02 PDT
Object libraries don't seem to work.  JavaScriptCore.framework needs to be linked with -force_load libWTF.a which doesn't seem to be able to be done with object libraries.
Comment 4 Don Olmstead 2021-04-27 20:26:56 PDT
(In reply to Alex Christensen from comment #3)
> Object libraries don't seem to work.  JavaScriptCore.framework needs to be
> linked with -force_load libWTF.a which doesn't seem to be able to be done
> with object libraries.

Can you show me what the linker errors are and what the patch looks like?

I would expect the WebKit library to build properly but it’s likely there will be problems with the executables around testing.
Comment 5 Radar WebKit Bug Importer 2021-05-03 12:44:13 PDT
<rdar://problem/77467972>
Comment 6 Alex Christensen 2021-09-28 23:14:21 PDT
Created attachment 439569 [details]
Patch
Comment 7 Don Olmstead 2021-09-29 08:17:26 PDT
Comment on attachment 439569 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=439569&action=review

The _FRAMEWORKS actually computes how to link the frameworks. So in the Mac case if you were linking WTF it would be linked through JavaScriptCore because that's the library that exposes WTF.

There may be an issue around making WebCoreTestSupport being SHARED but other than that it SHOULD work properly after you use OBJECT with bmalloc, WTF, PAL. If not then there's a bug in the macro with computing it.

> Source/WebKit/CMakeLists.txt:303
> -set(WebKit_FRAMEWORKS
> +set(WebKit_PRIVATE_LIBRARIES
>      JavaScriptCore
> -    PAL
> -    WTF
>      WebCore

This change is incorrect.

> Source/cmake/OptionsMac.cmake:-113
>  set(JavaScriptCore_LIBRARY_TYPE SHARED)
>  set(WebCore_LIBRARY_TYPE SHARED)
> -set(WebCoreTestSupport_LIBRARY_TYPE SHARED)

Please modify things so its

set(bmalloc_LIBRARY_TYPE OBJECT)
set(WTF_LIBRARY_TYPE OBJECT)
set(JavaScriptCore_LIBRARY_TYPE SHARED)
set(PAL_LIBRARY_TYPE OBJECT)
set(WebCore_LIBRARY_TYPE SHARED)

> Tools/TestWebKitAPI/CMakeLists.txt:206
>      set(TestWebCore_FRAMEWORKS
>          JavaScriptCore
> -        PAL
> -        WTF
> -        WebCore
> +        WebKit

This change is incorrect.
Comment 8 Alex Christensen 2021-09-29 09:58:28 PDT
Yeah, I'm not sure what's going on, but this patch gets it to compile and anything less doesn't.  I think it may be CMake linking all of a framework's dependencies when you link the framework unless you use PRIVATE when linking the framework.  We will eventually need to change the shared CMakeLists.txt to not link as many things.