If the tool is executed with a direct path in a script e.g.
#!/usr/bin/python

or the host path is hardcoded inside a binary, there's nothing you can do
(other than temporarily rename python to something else, and fix all
instances of breakage to use #!/usr/bin/env python).

If the execution relies on PATH, then native tool paths are always in the
front of host paths. So you only need to DEPEND on the native tool you
want, and it will be picked over the one from the host. Note that tools
from hosts are additionally sanitized via a whitelist, so only a limited
subset is available to begin with (see HOSTTOOLS variable).

Alex

On Wed, 22 Jan 2020 at 21:38, Konrad Weihmann <[email protected]> wrote:

> Hi all,
>
> it maybe a already solved, very trivial thing to do, but is there any
> way in bitbake to prevent that a tool from the build host is executed
> instead of the same tool (maybe) available via the sysroot-native?
>
> In shell I would typically do (e.g.) something like this
>
> python() { echo "Custom python used"; /path/to/my/custom/python $@ }
>
> python -c ...
>
> In bitbake this is somehow hard to catch, as tools are usually picked
> from PATH, which is extended while executing a parsed recipe and
> therefore involves the host way to much.
>
> Really useful would be if one could define such a thing within a recipe
> like
>
> HIDETOOL_python = "nativepython"
>
> which then will be translated into
>
> python() { nativepython $@ }
>
> or something similar, in the resulting run scripts, so it doesn't matter
> if any script sourced afterwards using some fixed shebang/assumption.
>
> This would clearly minimize the effort of making sources work within
> yocto, so one doesn't have to rely on multiple containers and CI to
> catch all those host->build-conterminations.
>
> One could surely inject it into the PATH-var, but what I want is to
> "redirect" certain calls to any reasonable binary I can think off,
> instead of relying on the PATH order.
> I had this multiple times with python scripts being "shebanged" onto a
> certain python version, although not really needed, which I currently
> can only solve by modifying the sources.
>
> Any thoughts, suggestions?
>
> Regards
>
> Konrad
>
> 
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#48092): https://lists.yoctoproject.org/g/yocto/message/48092
Mute This Topic: https://lists.yoctoproject.org/mt/69990070/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub  
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to