Bug 247985 - [GTK][WPE] Fix relocation issues running the MiniBrowser or the layout tests when the path on disk changes
Summary: [GTK][WPE] Fix relocation issues running the MiniBrowser or the layout tests ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WPE WebKit (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Carlos Alberto Lopez Perez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-16 10:26 PST by Carlos Alberto Lopez Perez
Modified: 2023-08-02 18:49 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Alberto Lopez Perez 2022-11-16 10:26:54 PST
When WebKit is built the path of the repository (where you have the checkout) is stored in the binaries in different ways:

 - The path to the WebKit libraries is stored as an rpath on the ELF binaries
 - The CMake system also defines some constant strings to the build like WEBKIT_EXEC_PATH and WEBKIT_INJECTED_BUNDLE_PATH that end going into the binaries as default values.
   This default values can be overriden at run-time via environment variables, but the current tooling is not doing that.

This means that if you build WebKit in a directory and then move the directory to a different path (without rebuilding) you are going to find errors and crashes:

Example of error:
                 Release/bin/MiniBrowser: error while loading shared libraries: libwebkit2gtk-4.0.so.37: cannot open shared object file: No such file or directory


This is not an issue with the flatpak build, because the flatpak build maps the buildirectory to /app so the path doesn't change in that case even if you move the directory.

But it is an issue for builds not using flatpak. Specifically I found this on a bots that I'm working on where the builder builds on a different path than the tester (and the tester downloads the build product from the builder, doesn't build it)
Comment 1 Carlos Alberto Lopez Perez 2022-11-16 11:09:17 PST
Pull request: https://github.com/WebKit/WebKit/pull/6557
Comment 2 EWS 2022-11-17 10:13:02 PST
Committed 256795@main (79f5dfafe126): <https://commits.webkit.org/256795@main>

Reviewed commits have been landed. Closing PR #6557 and removing active labels.