Bug 240755 - [CMake] Cannot link WebKitTestRunner in non-unified builds
Summary: [CMake] Cannot link WebKitTestRunner in non-unified builds
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Adrian Perez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-05-21 05:26 PDT by Adrian Perez
Modified: 2022-06-02 00:05 PDT (History)
11 users (show)

See Also:


Attachments
WIP patch (1.53 KB, patch)
2022-05-23 22:47 PDT, Fujii Hironori
no flags Details | Formatted Diff | Diff
Patch (3.17 KB, patch)
2022-05-25 13:47 PDT, Fujii Hironori
no flags Details | Formatted Diff | Diff
Patch (3.64 KB, patch)
2022-05-25 23:29 PDT, Fujii Hironori
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Perez 2022-05-21 05:26:21 PDT
ld.lld: error: undefined symbol: WebCore::InspectorFrontendClientLocal::InspectorFrontendClientLocal(WebCore::InspectorController*, WebCore::Page*, std::unique_ptr<WebCore::InspectorFrontendClientLocal::Settings, std::default_delete<WebCore::InspectorFrontendClientLocal::Settings> >)
>>> referenced by Internals.cpp:432 (/app/webkit/Source/WebCore/testing/Internals.cpp:432)
>>>               ../Source/WebCore/CMakeFiles/WebCoreTestSupport.dir/testing/Internals.cpp.o:(WebCore::InspectorStubFrontend::InspectorStubFrontend(WebCore::Page&, WTF::RefPtr<WebCore::DOMWindow, WTF::RawPtrTraits<WebCore::DOMWindow>, WTF::DefaultRefDerefTraits<WebCore::DOMWindow> >&&)) in archive lib/libWebCoreTestSupport.a

ld.lld: error: undefined symbol: WebCore::InspectorFrontendClientLocal::~InspectorFrontendClientLocal()
>>> referenced by Internals.cpp:444 (/app/webkit/Source/WebCore/testing/Internals.cpp:444)
>>>               ../Source/WebCore/CMakeFiles/WebCoreTestSupport.dir/testing/Internals.cpp.o:(WebCore::InspectorStubFrontend::~InspectorStubFrontend()) in archive lib/libWebCoreTestSupport.a

ld.lld: error: undefined symbol: WebCore::InspectorFrontendClientLocal::inspectedPage() const
>>> referenced by Internals.cpp:452 (/app/webkit/Source/WebCore/testing/Internals.cpp:452)
>>>               ../Source/WebCore/CMakeFiles/WebCoreTestSupport.dir/testing/Internals.cpp.o:(WebCore::InspectorStubFrontend::closeWindow()) in archive lib/libWebCoreTestSupport.a

ld.lld: error: undefined symbol: WebCore::MediaRecorderPrivateMock::MediaRecorderPrivateMock(WebCore::MediaStreamPrivate&)
>>> referenced by Internals.cpp:1661 (/app/webkit/Source/WebCore/testing/Internals.cpp:1661)
>>>               ../Source/WebCore/CMakeFiles/WebCoreTestSupport.dir/testing/Internals.cpp.o:(WebCore::createRecorderMockSource(WebCore::MediaStreamPrivate&, WebCore::MediaRecorderPrivateOptions const&)) in archive lib/libWebCoreTestSupport.a

ld.lld: error: undefined symbol: WebCore::MockMediaPlayerMediaSource::registerMediaEngine(void (*)(std::unique_ptr<WebCore::MediaPlayerFactory, std::default_delete<WebCore::MediaPlayerFactory> >&&))
>>> referenced by Internals.cpp:4228 (/app/webkit/Source/WebCore/testing/Internals.cpp:4228)
>>>               ../Source/WebCore/CMakeFiles/WebCoreTestSupport.dir/testing/Internals.cpp.o:(WebCore::Internals::initializeMockMediaSource()) in archive lib/libWebCoreTestSupport.a

ld.lld: error: undefined symbol: WebCore::parseHEVCCodecParameters(WTF::StringView)
>>> referenced by Internals.cpp:6040 (/app/webkit/Source/WebCore/testing/Internals.cpp:6040)
>>>               ../Source/WebCore/CMakeFiles/WebCoreTestSupport.dir/testing/Internals.cpp.o:(WebCore::Internals::parseHEVCCodecParameters(WTF::StringView)) in archive lib/libWebCoreTestSupport.a

ld.lld: error: undefined symbol: WebCore::createHEVCCodecParametersString(WebCore::HEVCParameters const&)
>>> referenced by Internals.cpp:6045 (/app/webkit/Source/WebCore/testing/Internals.cpp:6045)
>>>               ../Source/WebCore/CMakeFiles/WebCoreTestSupport.dir/testing/Internals.cpp.o:(WebCore::Internals::createHEVCCodecParametersString(WebCore::HEVCParameters const&)) in archive lib/libWebCoreTestSupport.a

ld.lld: error: undefined symbol: WebCore::parseDoViCodecParameters(WTF::StringView)
>>> referenced by Internals.cpp:6050 (/app/webkit/Source/WebCore/testing/Internals.cpp:6050)
>>>               ../Source/WebCore/CMakeFiles/WebCoreTestSupport.dir/testing/Internals.cpp.o:(WebCore::Internals::parseDoViCodecParameters(WTF::StringView)) in archive lib/libWebCoreTestSupport.a

ld.lld: error: undefined symbol: WebCore::createDoViCodecParametersString(WebCore::DoViParameters const&)
>>> referenced by Internals.cpp:6087 (/app/webkit/Source/WebCore/testing/Internals.cpp:6087)
>>>               ../Source/WebCore/CMakeFiles/WebCoreTestSupport.dir/testing/Internals.cpp.o:(WebCore::Internals::createDoViCodecParametersString(WebCore::Internals::DoViParameterSet const&)) in archive lib/libWebCoreTestSupport.a

ld.lld: error: undefined symbol: WebCore::parseVPCodecParameters(WTF::StringView)
>>> referenced by Internals.cpp:6092 (/app/webkit/Source/WebCore/testing/Internals.cpp:6092)
>>>               ../Source/WebCore/CMakeFiles/WebCoreTestSupport.dir/testing/Internals.cpp.o:(WebCore::Internals::parseVPCodecParameters(WTF::StringView)) in archive lib/libWebCoreTestSupport.a

ld.lld: error: undefined symbol: WebCore::makeSimpleRange(WebCore::AbstractRange const&)
>>> referenced by Internals.cpp:6635 (/app/webkit/Source/WebCore/testing/Internals.cpp:6635)
>>>               ../Source/WebCore/CMakeFiles/WebCoreTestSupport.dir/testing/Internals.cpp.o:(WebCore::Internals::rangeContainsNode(WebCore::AbstractRange const&, WebCore::Node&, WebCore::Internals::TreeType)) in archive lib/libWebCoreTestSupport.a
>>> referenced by Internals.cpp:6640 (/app/webkit/Source/WebCore/testing/Internals.cpp:6640)
>>>               ../Source/WebCore/CMakeFiles/WebCoreTestSupport.dir/testing/Internals.cpp.o:(WebCore::Internals::rangeContainsBoundaryPoint(WebCore::AbstractRange const&, WebCore::Node&, unsigned int, WebCore::Internals::TreeType)) in archive lib/libWebCoreTestSupport.a
>>> referenced by Internals.cpp:6645 (/app/webkit/Source/WebCore/testing/Internals.cpp:6645)
>>>               ../Source/WebCore/CMakeFiles/WebCoreTestSupport.dir/testing/Internals.cpp.o:(WebCore::Internals::rangeContainsRange(WebCore::AbstractRange const&, WebCore::AbstractRange const&, WebCore::Internals::TreeType)) in archive lib/libWebCoreTestSupport.a
>>> referenced 4 more times

ld.lld: error: undefined symbol: vtable for WebCore::InspectorFrontendClientLocal::Settings
>>> referenced by InspectorFrontendClientLocal.h:56 (/app/webkit/Source/WebCore/inspector/InspectorFrontendClientLocal.h:56)
>>>               ../Source/WebCore/CMakeFiles/WebCoreTestSupport.dir/testing/Internals.cpp.o:(WebCore::InspectorFrontendClientLocal::Settings::Settings()) in archive lib/libWebCoreTestSupport.a
>>> the vtable symbol may be undefined because the class is missing its key function (see https://lld.llvm.org/missingkeyfunction)

ld.lld: error: undefined symbol: WebCore::InspectorFrontendClientLocal::windowObjectCleared()
>>> referenced by Internals.cpp
>>>               ../Source/WebCore/CMakeFiles/WebCoreTestSupport.dir/testing/Internals.cpp.o:(vtable for WebCore::InspectorStubFrontend) in archive lib/libWebCoreTestSupport.a

ld.lld: error: undefined symbol: WebCore::InspectorFrontendClientLocal::frontendLoaded()
>>> referenced by Internals.cpp
>>>               ../Source/WebCore/CMakeFiles/WebCoreTestSupport.dir/testing/Internals.cpp.o:(vtable for WebCore::InspectorStubFrontend) in archive lib/libWebCoreTestSupport.a

ld.lld: error: undefined symbol: WebCore::InspectorFrontendClientLocal::pagePaused()
>>> referenced by Internals.cpp
>>>               ../Source/WebCore/CMakeFiles/WebCoreTestSupport.dir/testing/Internals.cpp.o:(vtable for WebCore::InspectorStubFrontend) in archive lib/libWebCoreTestSupport.a

ld.lld: error: undefined symbol: WebCore::InspectorFrontendClientLocal::pageUnpaused()
>>> referenced by Internals.cpp
>>>               ../Source/WebCore/CMakeFiles/WebCoreTestSupport.dir/testing/Internals.cpp.o:(vtable for WebCore::InspectorStubFrontend) in archive lib/libWebCoreTestSupport.a

ld.lld: error: undefined symbol: WebCore::InspectorFrontendClientLocal::moveWindowBy(float, float)
>>> referenced by Internals.cpp
>>>               ../Source/WebCore/CMakeFiles/WebCoreTestSupport.dir/testing/Internals.cpp.o:(vtable for WebCore::InspectorStubFrontend) in archive lib/libWebCoreTestSupport.a

ld.lld: error: undefined symbol: WebCore::InspectorFrontendClientLocal::inspectionLevel() const
>>> referenced by Internals.cpp
>>>               ../Source/WebCore/CMakeFiles/WebCoreTestSupport.dir/testing/Internals.cpp.o:(vtable for WebCore::InspectorStubFrontend) in archive lib/libWebCoreTestSupport.a

ld.lld: error: undefined symbol: WebCore::InspectorFrontendClientLocal::resetState()
>>> referenced by Internals.cpp
>>>               ../Source/WebCore/CMakeFiles/WebCoreTestSupport.dir/testing/Internals.cpp.o:(vtable for WebCore::InspectorStubFrontend) in archive lib/libWebCoreTestSupport.a

ld.lld: error: undefined symbol: WebCore::InspectorFrontendClientLocal::userInterfaceLayoutDirection() const
>>> referenced by Internals.cpp
>>>               ../Source/WebCore/CMakeFiles/WebCoreTestSupport.dir/testing/Internals.cpp.o:(vtable for WebCore::InspectorStubFrontend) in archive lib/libWebCoreTestSupport.a

ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
Comment 1 Adrian Perez 2022-05-21 14:24:58 PDT
Pull request: https://github.com/WebKit/WebKit/pull/885
Comment 2 Fujii Hironori 2022-05-23 22:47:12 PDT
Created attachment 459701 [details]
WIP patch

It seems that WebCore_LIBRARY_TYPE should be OBJECT to work WEBCORE_EXPORT as expected.
Does GTK port have a reason not to use OBJECT library for WebCore?
Comment 3 Fujii Hironori 2022-05-25 13:28:07 PDT
> Does GTK port have a reason not to use OBJECT library for WebCore?

If no one knows the answer, it's the right direction we should go.
Comment 4 Fujii Hironori 2022-05-25 13:47:27 PDT
Created attachment 459767 [details]
Patch
Comment 5 Adrian Perez 2022-05-25 15:37:59 PDT
Comment on attachment 459767 [details]
Patch

Thanks, Fujii! Patch LGTM with a small bit to do before landing.


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

> Source/WebCore/PlatformGTK.cmake:-9
> -set(WebCore_OUTPUT_NAME WebCoreGTK)

I have no about the reason for this. It was added in the patch
for bug #144364 but there is no explanation why 🤷‍♂️️ -- The WPE port
leaves the output name for WebCore unchanged and things work just
fine.

> Source/cmake/OptionsGTK.cmake:250
> +set(WebCore_LIBRARY_TYPE OBJECT)

We should apply the same change in OptionsWPE.cmake :)
Comment 6 Michael Catanzaro 2022-05-25 16:11:13 PDT
(In reply to Fujii Hironori from comment #2)
> Does GTK port have a reason not to use OBJECT library for WebCore?

We previously had trouble with using OBJECT for JSC in https://bugs.webkit.org/show_bug.cgi?id=181916#c68. I assume we'd likely hit the same issue with WebCore, but I'm not certain.
Comment 7 Michael Catanzaro 2022-05-25 16:31:53 PDT
OK, looking at the previous bug, Carlos Garcia found the problem in https://bugs.webkit.org/show_bug.cgi?id=181916#c90. Basically when we use OBJECT, we have to be careful that we're not linking twice by mistake. That is, we probably need to be sure that anything that links to WebKit does not also link directly to WebCore. It should be fine if we're careful about that, but that's also difficult to verify.

At least, I think so. I don't pretend to understand linking. Change seems worth the risk. If there's problems, they'll probably affect stuff under Tools/ rather than Source/.
Comment 8 Don Olmstead 2022-05-25 17:05:27 PDT
(In reply to Michael Catanzaro from comment #7)
> OK, looking at the previous bug, Carlos Garcia found the problem in
> https://bugs.webkit.org/show_bug.cgi?id=181916#c90. Basically when we use
> OBJECT, we have to be careful that we're not linking twice by mistake. That
> is, we probably need to be sure that anything that links to WebKit does not
> also link directly to WebCore. It should be fine if we're careful about
> that, but that's also difficult to verify.
> 
> At least, I think so. I don't pretend to understand linking. Change seems
> worth the risk. If there's problems, they'll probably affect stuff under
> Tools/ rather than Source/.

LGTM
Comment 9 Fujii Hironori 2022-05-25 17:12:52 PDT
Thank you for the comments, Michael. I will test my patch extensively before landing.
Comment 10 Fujii Hironori 2022-05-25 17:14:00 PDT
Comment on attachment 459767 [details]
Patch

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

Thank you for the review, Adrian.

>> Source/cmake/OptionsGTK.cmake:250
>> +set(WebCore_LIBRARY_TYPE OBJECT)
> 
> We should apply the same change in OptionsWPE.cmake :)

Good catch. I'm frequently forgetting WPE.
Comment 11 Fujii Hironori 2022-05-25 23:29:14 PDT
Created attachment 459777 [details]
Patch
Comment 12 Adrian Perez 2022-05-26 01:38:00 PDT
Comment on attachment 459777 [details]
Patch

r=me, and the EWS builders are green 💚️
Comment 13 EWS 2022-05-26 06:40:38 PDT
Found 2 new test failures: http/tests/media/hls/hls-webvtt-flashing.html, webgl/2.0.0/conformance2/textures/image_bitmap_from_image_bitmap/tex-2d-rg16f-rg-float.html
Comment 14 EWS 2022-05-26 10:25:48 PDT
Committed r294881 (251011@main): <https://commits.webkit.org/251011@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 459777 [details].
Comment 15 Radar WebKit Bug Importer 2022-05-26 10:26:14 PDT
<rdar://problem/93979578>