I was attempting to cross-compile mesa with wayland-egl (with sysroots defined and such) and it was failing to find wayland-scanner, breaking the build. I am cross-compiling mesa in Yocto-based fashion on an Intel-based linux host, with an Intel-based target. This wayland-scanner.pc.in bug is one of two bugs that are blocking me from building latest mesa master (the second bug unveiled lies in a Yocto bitbake package recipe that I'll be fixing separately). pkg-config will automagically prepend the sysrootdir path whenever pkg-config is passed -I or -L (include paths, ld paths respectively). However, in cases where arbitrary pkg-config variables are set-- as in the wayland_scanner case-- the sysrootdir _is not_ automatically prepended. This is what nipped me and started me down this debug path. Put visually, when mesa master (as of commit mentioned above) is configured, 'bitbake mesa' config.log is populated like this: config.log (before filthy hack to prove the bug, ): WAYLAND_LIBS='-L/home/jbkonno/snip/poky/build/tmp/sysroots/intel-snip-corei7-64/usr/lib64 -lwayland-client -lwayland-server' WAYLAND_SCANNER='/usr/bin/wayland-scanner' After hacking the wayland-scanner.pc file in the _target_ sysroot, running 'bitbake mesa' again produced a config.log populated this way: WAYLAND_LIBS='-L/home/jbkonno/snip/poky/build/tmp/sysroots/intel-snip-corei7-64/usr/lib64 -lwayland-client -lwayland-server' WAYLAND_SCANNER='/home/jbkonno/snip/poky/build/tmp/sysroots/intel-snip-corei7-64/usr/bin/wayland-scanner' Note the diff in the WAYLAND_SCANNER values. I'll be posting the patch on the mailing list soon, but for those who like spoilers, I had to prepend ${pc_sysrootdir} to the wayland_scanner variable in the .pc file. Quick shout out to the following sites for helping me narrow down the possibles: * https://autotools.io/pkgconfig/cross-compiling.html * http://dev.gentoo.org/~mgorny/pkg-config-spec.html
Patch posted to mailing list: * Message-Id: 1473978132-3965-1-git-send-email-joe.konno@linux.intel.com
Thanks for the feedback, Pekka. As stated on the mailing list, I'll reply once I convince myself this is the right (or wrong) approach.
Arnaud's feedback was really good, thanks so much: """ I believe your patch is not right, as pq says the sysroot normally contains the code compiled for the target, which might not be compatible with the host. I think the proper way to do this is to compile wayland for the host separately, and use ${CHOST}-pkg-config instead of pkg-config to get the wayland-scanner path. In practice you would call x86_64-linux-gnu-pkg-config --variable=wayland_scanner. The x86_64-linux-gnu-pkg-config utility will look for pkgconfig files in the host sysroot, instead of the target sysroot, allowing this use case to work. Unfortunately not many packages do this correctly... """ I'll go ahead and close this bug as invalid. Thanks again for the reviews and feedback!
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.