Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 803533 - dev-libs/wayland has problems finding its build-time dependency wayland-scanner when cross-compiling
Summary: dev-libs/wayland has problems finding its build-time dependency wayland-scann...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo X packagers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-23 14:23 UTC by tt_1
Modified: 2021-12-10 05:49 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build log (build.log,6.33 KB, text/x-log)
2021-07-23 14:23 UTC, tt_1
Details
output from meson log (meson-log.txt,29.25 KB, text/plain)
2021-07-23 14:24 UTC, tt_1
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tt_1 2021-07-23 14:23:22 UTC
Created attachment 726121 [details]
build log

when I fire up this: 

emerge-armv7a-unknown-linux-gnueabihf -pv dev-libs/wayland  

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N     ] dev-util/wayland-scanner-1.19.0::gentoo  ABI_X86="(64) -32 (-x32)" 446 KiB
[ebuild  N     ] dev-libs/wayland-1.19.0::gentoo to /usr/armv7a-unknown-linux-gnueabihf/ USE="-doc" 0 KiB


the host installs dev-util/wayland-scanner, but in step 2, wayland itself fails to find the aforementioned /usr/bin/wayland-scanner 

I feel a little lost, since dev-util/wayland-scanner fails to cross compile for the same reason
Comment 1 tt_1 2021-07-23 14:24:23 UTC
Created attachment 726124 [details]
output from meson log
Comment 2 tt_1 2021-07-23 17:39:55 UTC
I don't speak very good meson, but it seems there is no obvious problem in the upstream config files? 

https://github.com/wayland-project/wayland/blob/main/src/meson.build#L73
Comment 3 tt_1 2021-07-23 18:03:44 UTC
so I was able to work around this: 

host amd64 is able to cross compile wayland to aarch64-unknown-linux-gnu
host amd64 is not able to cross compile to armv7a-unknown-linux-gnueabihf

this made me think twice, and by enabling USE="abi_x86_32" for the host, cross compile is now possible with the amd64 host to armv7a-unknown-linux-gnueabihf

is this a bug, or a feature? >_>
Comment 4 Matt Turner gentoo-dev 2021-07-23 19:34:27 UTC
The intention is that wayland-scanner produces the same output regardless of architecture, so for cross-compiling wayland, using a native wayland-scanner is not only 100% fine but actually intended.

(In reply to tt_1 from comment #3)
> so I was able to work around this: 
> 
> host amd64 is able to cross compile wayland to aarch64-unknown-linux-gnu
> host amd64 is not able to cross compile to armv7a-unknown-linux-gnueabihf
> 
> this made me think twice, and by enabling USE="abi_x86_32" for the host,
> cross compile is now possible with the amd64 host to
> armv7a-unknown-linux-gnueabihf
> 
> is this a bug, or a feature? >_>

That sounds like it might be related to the location of the wayland-scanner pkgconfig file. I bet that on aarch64 it's /usr/lib64/pkgconfig/wayland-scanner.pc and on armv7 it's /usr/lib/pkgconfig/wayland-scanner.pc and so the connection to abi_x86_32 makes sense.

A good test would be to move /usr/*/pkgconfig/wayland-scanner.pc to /usr/share/pkgconfig/wayland-scanner.pc. I suspect wayland will cross compile fine with that, regardless of the setting of ABI_X86.

I actually wanted to install the pc file only to /usr/share, but there was a problem in the transition to the split wayland-scanner package that necessitated the current situation. Perhaps it's now possible to correct that.
Comment 5 tt_1 2021-07-23 19:59:27 UTC
thanks for your fast answer, there are a few missunderstandings I believe: 

dev-libs/wayland has wayland-scanner in BDEPS, and that is correct as it is a binary and needs to be build on the hosts side. It can't find it, and that must be because of difficulties with resolving the correct libdir, since the only difference between 32bit and 64bit pkgconf file is libdir=${prefix}/lib vs libdir=${prefix}/lib64

In any case, I recompiled wayland-scanner without USE="abi_x86_32", and moved the 64bit pkgconfig to /usr/share/pkgconfig/ folder. That made armv7a and aarch64 cross compile possible: 

Build-time dependency wayland-scanner found: YES 1.19.0
Program /usr/bin/wayland-scanner found: YES (/usr/bin/wayland-scanner)

please note: due to the bug, it isn't even possible to cross-compile dev-util/wayland-scanner itself, as well as dev-libs/wayland-protocols.
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-07-23 20:01:01 UTC
(In reply to tt_1 from comment #5)
> thanks for your fast answer, there are a few missunderstandings I believe: 
> 
> dev-libs/wayland has wayland-scanner in BDEPS, and that is correct as it is
> a binary and needs to be build on the hosts side. It can't find it, and that
> must be because of difficulties with resolving the correct libdir, since the
> only difference between 32bit and 64bit pkgconf file is libdir=${prefix}/lib
> vs libdir=${prefix}/lib64
> 

I think Matt is in exact agreement here. It should be independent of libdir in theory, is his point.

> please note: due to the bug, it isn't even possible to cross-compile
> dev-util/wayland-scanner itself, as well as dev-libs/wayland-protocols.

Could you explain this part?
Comment 7 tt_1 2021-07-23 20:10:59 UTC
sure, dev-util/wayland-scanner is in BDEPS and only gets merged to the host. In case you wanted it to cross compile anyway, because maybe you do embedded stuff or what have you not, it is not possible at the moment, because dev-util/wayland-scanner doesn't find the wayland-scanner to build: 

emerge-armv7a-unknown-linux-gnueabihf -av wayland-scanner

Found pkg-config: /usr/bin/armv7a-unknown-linux-gnueabihf-pkg-config (0.29.2)
Run-time dependency expat found: YES 2.4.1
Configuring config.h using configuration
Configuring wayland-version.h using configuration
Found pkg-config: /usr/bin/x86_64-pc-linux-gnu-pkg-config (0.29.2)
Found CMake: /usr/bin/cmake (3.19.7)
Build-time dependency wayland-scanner found: NO (tried pkgconfig and cmake)

../wayland-1.19.0/src/meson.build:62:1: ERROR: Dependency "wayland-scanner" not found, tried pkgconfig and cmake

maybe meson config file is a bit too enthusiastic here? :-)
Comment 8 tt_1 2021-07-24 14:56:19 UTC
symlinking the 64bit package config file into /usr/share/pkgconfig/ is sufficent by the way, so seems as if dev-libs/wayland checks the /usr/share/pkgconfig dir first.
Comment 9 Larry the Git Cow gentoo-dev 2021-12-10 05:49:27 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bcccc1065cef9551515359072c4c9d1fcdd50fc3

commit bcccc1065cef9551515359072c4c9d1fcdd50fc3
Author:     Matt Turner <mattst88@gentoo.org>
AuthorDate: 2021-12-10 02:59:01 +0000
Commit:     Matt Turner <mattst88@gentoo.org>
CommitDate: 2021-12-10 05:48:40 +0000

    dev-util/wayland-scanner: Move .pc file to neutral location
    
    Allows us to drop multilib support too, which only existed to ease the
    wayland/wayland-scanner package split.
    
    Closes: https://bugs.gentoo.org/803533
    Signed-off-by: Matt Turner <mattst88@gentoo.org>

 dev-util/wayland-scanner/wayland-scanner-9999.ebuild | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)