How to add python2 as native package in openembedded sdk

I need to cross compile python2 packages using openembedded sdk. The sdk
resulting package contains only python 3.5.3 (in older version it contains
python 2.7.3 as well).

# ls -l sysroots/x86_64-angstromsdk-linux/usr/bin/python*
  lrwxrwxrwx 1 root root    9 Oct 11 21:39 python3 -> python3.5*
  -rwxr-xr-x 1 root root  267 Oct 11 21:39 python3.5*
  lrwxrwxrwx 1 root root   17 Oct 11 21:39 python3.5-config -> python3.5m-config*
  -rwxr-xr-x 2 root root  15K Oct 11 21:39 python3.5m*
  -rwxr-xr-x 1 root root 3.3K Oct 11 21:39 python3.5m-config*
  -rwxr-xr-x 2 root root  15K Oct 11 21:39 python3.5.real*
  lrwxrwxrwx 1 root root   16 Oct 11 21:39 python3-config -> python3.5-config*__

Is there a way to add also this native python version to my sdk?

I’m using toradex-bsp-platform at tag “Colibri-iMX6_LXDE-Image_2.8b3.111-20180627”.


I assume you build the SDK by using the ‘bitbake -c populate_sdk ‘’‘image_recipe’’’ ’ task.
I expect the following to add python2 to the host tools in the SDK. Add to either the the image recipe or local.conf:

    nativesdk-python-core \
    nativesdk-python-modules \
    nativesdk-python-misc \
    nativesdk-python-git \

Please have a look here for the relevant Yocto documentation.
Alternatively have a look at this bbappend:
This will add to all SDK’s build without the need to add something to the image recipe.


@max.tx: Thank you!

Now I see python2 in sysroots:

 # ls -l sysroots/x86_64-angstromsdk-linux/usr/bin/python*
 lrwxrwxrwx 1 root root     7 ott 15 21:53 python -> python2
 lrwxrwxrwx 1 root root     9 ott 15 21:53 python2 -> python2.7
 -rwxr-xr-x 1 root root   297 ott 15 21:52 python2.7
 -rwxr-xr-x 1 root root  1739 ott 15 21:52 python2.7-config
 -rwxr-xr-x 1 root root 10240 ott 15 21:53 python2.7.real
 lrwxrwxrwx 1 root root    16 ott 15 21:53 python2-config -> python2.7-config
 lrwxrwxrwx 1 root root    14 ott 15 21:53 python-config -> python2-config

But the sdk bash script exit with error, it only unpacks the sysroots and then stalls:

 # ./ -d 4.9
 Angstrom SDK installer version nodistro.0
 You are about to install the SDK to "/opt/toradex_sdk/imx6/4.9". Proceed[Y/n]?
 Extracting SDK.........................................................................................................done
 Setting it cannot access '/opt/toradex_sdk/imx6/4.9/environment-setup-*': No such file or directory

Do you have any idea what is the problem?


How / where did you append to TOOLCHAIN_HOST_TASK?

What you describe sounds familiar. You did not convert the _append operator to “+=”, did you?


@max.tx: you are right! I used “+=”.

Thank you very much for the support!