Bug 232933 - FindGObjectIntrospection.cmake: prefix variables obtained from pkg-config with PKG_CONFIG_SYSROOT_DIR
Summary: FindGObjectIntrospection.cmake: prefix variables obtained from pkg-config wit...
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-10 02:46 PST by Alexander Kanavin
Modified: 2022-04-15 10:23 PDT (History)
8 users (show)

See Also:


Attachments
Patch (1.45 KB, patch)
2021-11-10 02:50 PST, Alexander Kanavin
no flags Details | Formatted Diff | Diff
Patch (1.83 KB, patch)
2022-02-16 13:12 PST, Alexander Kanavin
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Kanavin 2021-11-10 02:46:30 PST
FindGObjectIntrospection.cmake: prefix variables obtained from pkg-config with PKG_CONFIG_SYSROOT_DIR
Comment 1 Alexander Kanavin 2021-11-10 02:50:54 PST
Created attachment 443789 [details]
Patch
Comment 2 Michael Catanzaro 2022-02-15 05:18:24 PST
Comment on attachment 443789 [details]
Patch

It took me a little while to convince myself that this was correct, but I suppose there's no way for cross-compilation to work otherwise, so OK.

That said, not all pkg-config variables are paths, but you're prepending this to all of them, e.g. version numbers are now going to contain filesystem paths. Also, it's generally not appropriate to prepend this variable even to most filesystem paths: it only makes sense in this particular case because you're executing those binaries during the build itself. Now, because the macro is only used immediately below, we know that's not a problem with how it is currently used, but it is still a semantic problem that we need to solve before landing. You can fix it in either of two ways: you could rename the macro to indicate it is only supposed to be used to get paths to binaries for use during compilation (this might result in a weird name, _GIR_GET_ PKGCONFIG_VAR_BUT_ONLY_IF_ITS_A_PATH_TO_A_BINARY_THAT_WE_ARE_ABOUT_TO_EXECUTE does not sound very swell), or maybe it would be better to do the append later after calling the macro so that we can leave it as a generic macro for getting any variable. Either way would work.
Comment 3 Alexander Kanavin 2022-02-16 12:21:11 PST
A change has landed that removes the code altogether, so I need to check if this patch is still relevant, and rework accordingly.
Comment 4 Alexander Kanavin 2022-02-16 13:12:43 PST
Created attachment 452238 [details]
Patch
Comment 5 Alexander Kanavin 2022-02-22 02:52:09 PST
Ping :)
Comment 6 Michael Catanzaro 2022-02-22 07:58:28 PST
Comment on attachment 452238 [details]
Patch

This looks fine to me, but Adrian mentioned something about not liking this. Adrian?
Comment 7 Alexander Kanavin 2022-04-04 11:09:19 PDT
Ping!
Comment 8 Adrian Perez 2022-04-05 15:11:38 PDT
(In reply to Michael Catanzaro from comment #6)
> Comment on attachment 452238 [details]
> Patch
> 
> This looks fine to me, but Adrian mentioned something about not liking this.
> Adrian?

So what's suspicious about this is that when cross-compiling, the sysroot
refers to the location of the *target platform* files (libraries, headers,
etc.) but in the case of programs to execute during the build, we cannot
(typically, at least) run them on the *build host*. Prefixing the sysroot
is the wrong thing to do in the general case, what one does is passing
-DCMAKE_PROGRAM_PATH= to tell if where to look for programs used during
compilation and that will run in the *build host*.

Now, I do know that GI is cross-compilation trouble, and at least Yocto
and Buildroot use qemu's userspace emulation to run the tools; but how to
treat the particularities of GI tooling is the choice of each particular
build system. I would rather not have a workaround for some compilation
system in the WebKit source tree—such a think should not be needed, and
proof of that is Buildroot can builds WebKitGTK with introspection enabled
without a patch like this:

  https://git.busybox.net/buildroot/tree/package/webkitgtk/webkitgtk.mk?h=2022.02.x#n68
Comment 9 Adrian Perez 2022-04-05 15:12:25 PDT
(ooops, s/think/thing/ in my previous comment)
Comment 10 Alexander Kanavin 2022-04-11 23:36:13 PDT
Right, this actually makes sense. I can withdraw this patch and mark it as yocto-specific in our tree to prevent further submissions.
Comment 11 Adrian Perez 2022-04-12 00:26:31 PDT
(In reply to Alexander Kanavin from comment #10)
> Right, this actually makes sense. I can withdraw this patch and mark it as
> yocto-specific in our tree to prevent further submissions.

👍️

Of course if you run into any other issues, please do ask and we can try
to help out --
Comment 12 Adrian Perez 2022-04-12 00:27:00 PDT
(In reply to Alexander Kanavin from comment #10)
> Right, this actually makes sense. I can withdraw this patch and mark it as
> yocto-specific in our tree to prevent further submissions.

👍️

Of course if you run into any other issues, please do ask and we can try
to help out -- we do want people to be able to package and cross build
WebKit after all :)
Comment 13 Michael Catanzaro 2022-04-12 08:07:31 PDT
(In reply to Alexander Kanavin from comment #10)
> Right, this actually makes sense. I can withdraw this patch and mark it as
> yocto-specific in our tree to prevent further submissions.

And add a link to this bug too, if you don't mind, so people can find this discussion in the future.