poky/scripts/oe-run-native
Jagadeesh Krishnanjanappa e8934a29c3 oe-run-native: Add *-native directories under STAGING_BINDIR_NATIVE to PATH environment
It helps to find/use native tools under ${STAGING_BINDIR_NATIVE}/*-native.

Solving below error:

$ oe-run-native python3-native python3
Running bitbake -e python3-native
Error: Unable to find 'python3' in .../tmp/work/x86_64-linux/python3-native/3.5.5-r1.0/recipe-sysroot-native/usr/bin:.../tmp/work/x86_64-linux/python3-native/3.5.5-r1.0/recipe-sysroot-native/bin:.../tmp/work/x86_64-linux/python3-native/3.5.5-r1.0/recipe-sysroot-native/usr/sbin:.../tmp/work/x86_64-linux/python3-native/3.5.5-r1.0/recipe-sysroot-native/sbin
Error: Have you run 'bitbake python3-native -caddto_recipe_sysroot'?
-- snip --

After this change we have native python3 to be found:

$ oe-run-native python3-native python3
Running bitbake -e python3-native
Python 3.5.5 (default, Aug  8 2018, 17:45:49)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
-- snip --

[YOCTO #12889]

(From OE-Core rev: a3e9b2224b31cfd836519d0b609f8064adb67cca)

Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa@mvista.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-08-23 07:50:00 +01:00

2.2 KiB
Executable File

#!/bin/bash

Copyright (c) 2016, Intel Corporation.

All Rights Reserved

This program is free software; you can redistribute it and/or modify

it under the terms of the GNU General Public License as published by

the Free Software Foundation; either version 2 of the License, or

(at your option) any later version.

This program is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See

the GNU General Public License for more details.

You should have received a copy of the GNU General Public License

along with this program; if not, see http://www.gnu.org/licenses/

This script is for running tools from native oe sysroot

if [ $# -lt 1 -o "$1" = '--help' -o "$1" = '-h' ] ; then echo 'oe-run-native: the following arguments are required: ' echo 'Usage: oe-run-native native-recipe tool [parameters]' echo '' echo 'OpenEmbedded run-native - runs native tools' echo '' echo 'arguments:' echo ' native-recipe The recipe which provoides tool' echo ' tool Native tool to run' echo '' exit 2 fi

native_recipe="$1" tool="$2"

if [ "${native_recipe%-native}" = "$native_recipe" ]; then echo Error: $native_recipe is not a native recipe echo Error: Use "oe-run-native -h" for help exit 1 fi

shift

SYSROOT_SETUP_SCRIPT=which oe-find-native-sysroot 2> /dev/null if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then echo "Error: Unable to find oe-find-native-sysroot script" exit 1 fi . $SYSROOT_SETUP_SCRIPT $native_recipe

OLD_PATH=$PATH

look for a tool only in native sysroot

PATH=$OECORE_NATIVE_SYSROOT/usr/bin:$OECORE_NATIVE_SYSROOT/bin:$OECORE_NATIVE_SYSROOT/usr/sbin:$OECORE_NATIVE_SYSROOT/sbin$(find $OECORE_NATIVE_SYSROOT/usr/bin/*-native -maxdepth 1 -type d -printf ":%p") tool_find=/usr/bin/which $tool 2>/dev/null

if [ -n "$tool_find" ] ; then # add old path to allow usage of host tools PATH=$PATH:$OLD_PATH "$@" else echo "Error: Unable to find '$tool' in $PATH" echo "Error: Have you run 'bitbake $native_recipe -caddto_recipe_sysroot'?" exit 1 fi