<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 29 May 2017 at 18:10, Emil Velikov <span dir="ltr"><<a href="mailto:emil.l.velikov@gmail.com" target="_blank">emil.l.velikov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="m_3768875786364575769gmail-HOEnZb"><div class="m_3768875786364575769gmail-h5">On 29 May 2017 at 14:05, Jussi Kukkonen <<a href="mailto:jussi.kukkonen@intel.com" target="_blank">jussi.kukkonen@intel.com</a>> wrote:<br>
> On 29 May 2017 at 15:20, Emil Velikov <<a href="mailto:emil.l.velikov@gmail.com" target="_blank">emil.l.velikov@gmail.com</a>> wrote:<br>
>><br>
>> On 26 May 2017 at 14:55, Jussi Kukkonen <<a href="mailto:jussi.kukkonen@intel.com" target="_blank">jussi.kukkonen@intel.com</a>> wrote:<br>
>> > On 26 May 2017 at 14:32, Emil Velikov <<a href="mailto:emil.l.velikov@gmail.com" target="_blank">emil.l.velikov@gmail.com</a>> wrote:<br>
>> >><br>
>> >> On 26 May 2017 at 08:52, Jussi Kukkonen <<a href="mailto:jussi.kukkonen@intel.com" target="_blank">jussi.kukkonen@intel.com</a>><br>
>> >> wrote:<br>
>> >> ><br>
>> >> ><br>
>> >> > On 24 May 2017 at 16:39, Emil Velikov <<a href="mailto:emil.l.velikov@gmail.com" target="_blank">emil.l.velikov@gmail.com</a>><br>
>> >> > wrote:<br>
>> >> AFAICT there are a couple of alternative solutions - have you<br>
>> >> considered/tried any of them?<br>
>> >><br>
>> >> a) w/o a wrapper script<br>
>> >> $ export PKG_CONFIG_PATH= // you need this if using the system<br>
>> >> pkgo-config. if the local/native one is used, this should be optional<br>
>> >> $ export<br>
>> >><br>
>> >> PKG_CONFIG_LIBDIR=$path_to_non<wbr>_system_host_pkgconfig:${SYSRO<wbr>OT}/usr/{lib,share}/pkgconfig<br>
>> >> $ export PKG_CONFIG_SYSROOT_DIR=${SYSRO<wbr>OT}<br>
>> ><br>
>> > We're using a natively built pkg-config which sets all the pkg-config<br>
>> > variables to what I believe are the correct values: the problem is that<br>
>> > none<br>
>> > of those variable is for the _native_ sysroot location so they don't<br>
>> > help in<br>
>> > this case. There is now way to say in a .pc file that this path should<br>
>> > be<br>
>> > prefixed with something like "${pc_native_sysroot_dir}" if it's<br>
>> > defined.<br>
>> ><br>
>> >> b) with a wrapper script - see [1].<br>
>> >> I think that the "export PKG_CONFIG_DIR=" is a typo (should be ..PATH<br>
>> >> instead) and is not strictly required - feel free to check either way.<br>
>> >> Note that the exec at the end might need to be amended to<br>
>> >> /path/to/$(CHOST)-pkg-config.<br>
>> ><br>
>> > We don't provide a target wrapper -- I believe because it provides no<br>
>> > value<br>
>> > at all on top of the setup we have (the pkg-config that autotools finds<br>
>> > has<br>
>> > all the environment variables set correctly. It is essentially<br>
>> > $(CHOST)-pkg-config already).<br>
>> ><br>
>> > If I've missed something, I'd be happy to hear that. At the moment I<br>
>> > think<br>
>> > pkg-config just does not help in this case.<br>
>> ><br>
>> I'm confused a bit - did you try the above suggestions? If so can you<br>
>> share which one and how it fails?<br>
><br>
><br>
> I'm sorry but I do not see what I could test that could help: I mentioned<br>
> that the pkg-config that gets used by PKG_CHECK_MODULES() is essentially a<br>
> wrapped one: In more detail the build tool sets these variables:<br>
><br>
</div></div>Giving it a try won't hurt, right ;-)<br>
<br>
But on a more serious note:<br>
[1] Like any project in the wild Yocto might have bugs, please try w/o it.<br>
[2] A simple test [w/o Yocto] with my earlier suggestion seems to work fine<br>
<br></blockquote><div><br></div><div class="gmail_extra">You're right, definitely doesn't hurt to try (and yocto surely has bugs in it). I'll take a step back, have another look at the whole pkg-config setup and try some tests -- your comment about PKG_CONFIG_DIR seems completely correct.</div><div class="gmail_extra"><br></div><div class="gmail_extra">The example test you gave still doesn't seem to work right though, see below.<br></div><div class="gmail_extra"><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Thanks<br>
Emil<br>
<br>
[1] From a quick look Yocto seems to be doing things a bit strange, wrong even?<br>
This is the first time I'm looking through it, so I may be wrong.<br>
<br>
Some examples, with the first and foremost being the prime suspect why<br>
things don't work as expected.<br>
* Yocto uses PKG_CONFIG_DIR. The variable is not a thing used by<br>
pkg-config (or pkgconf).<br>
Yes sometimes it's used only to be fed into LIBDIR/PATH<br>
(meta/conf/bitbake.conf), but it does not seem consistent.<br>
IMHO a good first step would be is to drop or rename it to PATH.<br>
<br>
* The native pkg-config has correct PATH/LIBDIR burned into the binary<br>
* A pkg-config-native wrapper also sets the PATH/LIBDIR variables<br>
- those are the default already stored within the binary<br>
- SYSROOT_DIR is explicitly discarded<br>
* Any PKG_CHECK_MODULES(.*) calls are discarded(??) - see <a href="http://wayland_1.11.0.bb" rel="noreferrer" target="_blank">wayland_1.11.0.bb</a></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
[2] The following seems to work based on a quick test.<br>
<br>
-- Layout<br>
<br>
/usr/bin/{pkg-config,wayland-s<wbr>canner}<br>
/usr/lib/pkgconfig/wayland-sca<wbr>nner.pc<br>
<br>
/native/usr/bin/{pkg-config,wa<wbr>yland-scanner}<br>
/native/usr/lib/pkgconfig/wayl<wbr>and-scanner.pc<br>
<br>
/target/usr/bin/{pkg-config,wa<wbr>yland-scanner} // just an example, one<br>
or both can be missing<br>
/target/usr/lib/pkgconfig/wayl<wbr>and-scanner.pc<br>
<br>
-- cat $(CHOST)-pkg-config<br>
#!/bin/sh<br>
<br>
export SYSROOT=/target/<br>
export PKG_CONFIG_LIBDIR=/native/usr/<wbr>lib/pkgconfig/:${SYSROOT}/usr/<wbr>lib/pkgconfig<br>
export PKG_CONFIG_SYSROOT_DIR=${SYSRO<wbr>OT}<br>
<br>
/native/usr/bin/pkg-config "$@"<br>
</blockquote></div><br></div><div class="gmail_extra">The test above does work for wayland-scanner lookup specifically but you've now added into PKG_CONFIG_LIBDIR a new directory with .pc files that are meant for compiling native binaries when we're trying to build target binaries. </div><div class="gmail_extra">E.g. adding these now:</div><div class="gmail_extra"><br></div><div class="gmail_extra">/native/usr/lib/pkgconfig/zlib<wbr>.pc</div><div class="gmail_extra">/target/usr/lib/pkgconfig/<wbr>zlib.pc<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Leads to "$(CHOST)-pkg-config --libs zlib" giving out answers from the native pc file (this happens with waylands own libs too unless you happen to use --disable-libraries like we do for native). The values may in some circumstances look ok but there's no guarantee of that. Same goes for --cflags of course: you may now be using flags meant for a completely different architecture.</div><div class="gmail_extra"><br></div><div class="gmail_extra">I think adding both native and target pkgconfig directories into PKG_CONFIG_LIBDIR at the same time is just wrong: we're compiling mesa for target so we should be using target .pc files. The fact that we need to find a native tool to do that should not mean we use pc files meant for building for another arch.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Thanks,</div><div class="gmail_extra"> Jussi</div></div>