Skip to contentSkip to conversation

Error while building python3.11 as an alternative for scarthgap (OpenSTLinux) #bitbake #yocto #openstlinux

DISCUSSION Abhijith 3 participants 10 messages Apr 3, 2025 – Apr 4, 2025

lore
Share & tools
lore

Abhijith

author
#0 lore raw

Hi,

I am currently building a custom recipe to install Python 3.11 alongside Python 3.12, which is the default version included with OpenSTLinux (Scarthgap). I’ve created the custom recipe based on Python 3.11.5 ( https://git.openembedded.org/openembedded-core/tree/meta/recipes-devtools/python/python3_3.11.5.bb?h=nanbield ).

When I try to compile the Python 3.11 recipe, I initially encounter the following error:

Quoted 84 lines

user@M047DTRV:~/Desktop/Testing/Ashish/02_STM32MCU/OpenSTLinux5/build-openstlinuxweston-stm32mp1$
bitbake python3.11
NOTE: Started PRServer with DBfile:
/home/user/Desktop/Testing/Ashish/02_STM32MCU/OpenSTLinux5/build-openstlinuxweston-stm32mp1/cache/prserv.sqlite3,
Address: 127.0.0.1:41249, PID: 2386020
Loading cache: 100%
|##########################################################################################################|
Time: 0:00:01
Loaded 4984 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies
Build Configuration:
BB_VERSION           = "2.8.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "arm-ostl-linux-gnueabi"
MACHINE              = "stm32mp1"
DISTRO               = "openstlinux-weston"
DISTRO_VERSION       = "5.0.3-snapshot-20250403"
TUNE_FEATURES        = "arm vfp cortexa7 neon vfpv4 thumb
callconvention-hard"
TARGET_FPU           = "hard"
DISTRO_CODENAME      = "scarthgap"
ACCEPT_EULA_stm32mp1 = "1"
GCCVERSION           = "13.%"
PREFERRED_PROVIDER_virtual/kernel = "linux-stm32mp"
meta-python
meta-oe
meta-gnome
meta-multimedia
meta-networking
meta-webserver       = "HEAD:1235dd4ed4a57e67683c045ad76b6a0f9e896b45"
meta-st-stm32mp      = "HEAD:dd13b8318b78f956086efade81de9c72c0e97187"
meta-st-openstlinux  = "HEAD:a25d4806880cdc73471e3c1824a87901b5a4e44f"
meta                 = "HEAD:236ac1b43308df722a78d3aa20aef065dfae5b2b"
meta-ust             = "<unknown>:<unknown>"
Sstate summary: Wanted 38 Local 27 Mirrors 0 Missed 11 Current 788 (71%
match, 98% complete)########################           | ETA:  0:00:00
Removing 1 stale sstate objects for arch x86_64: 100%
|########################################################################|
Time: 0:00:00
NOTE: Executing Tasks
ERROR: python3.11-3.11.5-r0 do_package: Error executing a python function
in exec_func_python() autogenerated:
The stack trace of python calls that resulted in this exception/failure
was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:extend_recipe_sysroot(d)
0003:
File:
'/home/user/Desktop/Testing/Ashish/02_STM32MCU/OpenSTLinux5/layers/openembedded-core/meta/classes-global/staging.bbclass',
lineno: 619, function: extend_recipe_sysroot
0615:                    if "/bin/" in l or "/sbin/" in l:
0616:                        # defer /*bin/* files until last in case they
need libs
0617:                        binfiles[l] = (targetdir, dest)
0618:                    else:
*** 0619:                        staging_copyfile(l, targetdir, dest,
postinsts, seendirs)
0620:
0621:    # Handle deferred binfiles
0622:    for l in binfiles:
0623:        (targetdir, dest) = binfiles[l]
File:
'/home/user/Desktop/Testing/Ashish/02_STM32MCU/OpenSTLinux5/layers/openembedded-core/meta/classes-global/staging.bbclass',
lineno: 165, function: staging_copyfile
0161:        os.symlink(linkto, dest)
0162:        #bb.warn(c)
0163:    else:
0164:        try:
*** 0165:            os.link(c, dest)
0166:        except OSError as err:
0167:            if err.errno == errno.EXDEV:
0168:                bb.utils.copyfile(c, dest)
0169:            else:
Exception: FileExistsError: [Errno 17] File exists:
'/home/user/Desktop/Testing/Ashish/02_STM32MCU/OpenSTLinux5/build-openstlinuxweston-stm32mp1/tmp-glibc/sysroots-components/x86_64/python3-native/usr/lib/libpython3.so'
-> '/home/user/Desktop/Testing/Ashish/02_STM32MCU/OpenSTLinux5/build-openstlinuxweston-stm32mp1/tmp-glibc/work/cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi/python3.11/3.11.5/recipe-sysroot-native/usr/lib/libpython3.so'

ERROR: Logfile of failure stored in:
/home/user/Desktop/Testing/Ashish/02_STM32MCU/OpenSTLinux5/build-openstlinuxweston-stm32mp1/tmp-glibc/work/cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi/python3.11/3.11.5/temp/log.do_package.2409035

Quoted 9 lines

ERROR: Task (/home/user/Desktop/Testing/Ashish/02_STM32MCU/OpenSTLinux5/layers/meta-ust/recipes-devtools/python/python3.11_3.11.5.bb:do_package) failed with exit code '1'
NOTE: Tasks Summary: Attempted 1892 tasks of which 1870 didn't need to be
rerun and 1 failed.
NOTE: Writing buildhistory
NOTE: Writing buildhistory took: 2 seconds

However, if I rerun the bitbake python3.11 command, it compiles successfully. This happens every time I perform a clean state for the Python 3.11 recipe and try building it again. On the first attempt, it fails, but on the second attempt, it works.

Could you help me understand what might be causing this issue?

Additionally, when I try to build the final image after successfully compiling Python 3.11, the build fails when I run bitbake st-image-weston. I’ve attached the error log related to this issue as well. I have attached the custom recipes for your reference.

Quoted 10 lines

Errors were encountered while processing:
/home/user/Desktop/Testing/Ashish/02_STM32MCU/OpenSTLinux5/build-openstlinuxweston-stm32mp1/tmp-glibc/work/stm32mp1-ostl-linux-gnueabi/st-image-weston/1.0/oe-rootfs-repo/cortexa7t2hf-neon-vfpv4/./python3.11_3.11.5-r0.15_armhf.deb

W: No sandbox user '_apt' on the system, can not drop privileges
E: Sub-process dpkg returned an error code (1)

Thank you in advance for your help!

#1 lore raw

Didn't several people tell you before: trying this is not a good idea, and will cause frustration even for very experienced yocto users.

Rather, you should fix the python code that (presumably) needs 3.11 to work with 3.12.

Alex

Quoted 103 lines · Abhijith via lists.yoctoproject.org

Hi,

I am currently building a custom recipe to install Python 3.11 alongside Python 3.12, which is the default version included with OpenSTLinux (Scarthgap). I’ve created the custom recipe based on Python 3.11.5.

When I try to compile the Python 3.11 recipe, I initially encounter the following error:

user@M047DTRV:~/Desktop/Testing/Ashish/02_STM32MCU/OpenSTLinux5/build-openstlinuxweston-stm32mp1$ bitbake python3.11
NOTE: Started PRServer with DBfile: /home/user/Desktop/Testing/Ashish/02_STM32MCU/OpenSTLinux5/build-openstlinuxweston-stm32mp1/cache/prserv.sqlite3, Address: 127.0.0.1:41249, PID: 2386020
Loading cache: 100% |##########################################################################################################| Time: 0:00:01
Loaded 4984 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies
Build Configuration:
BB_VERSION           = "2.8.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "arm-ostl-linux-gnueabi"
MACHINE              = "stm32mp1"
DISTRO               = "openstlinux-weston"
DISTRO_VERSION       = "5.0.3-snapshot-20250403"
TUNE_FEATURES        = "arm vfp cortexa7 neon vfpv4 thumb callconvention-hard"
TARGET_FPU           = "hard"
DISTRO_CODENAME      = "scarthgap"
ACCEPT_EULA_stm32mp1 = "1"
GCCVERSION           = "13.%"
PREFERRED_PROVIDER_virtual/kernel = "linux-stm32mp"
meta-python
meta-oe
meta-gnome
meta-multimedia
meta-networking
meta-webserver       = "HEAD:1235dd4ed4a57e67683c045ad76b6a0f9e896b45"
meta-st-stm32mp      = "HEAD:dd13b8318b78f956086efade81de9c72c0e97187"
meta-st-openstlinux  = "HEAD:a25d4806880cdc73471e3c1824a87901b5a4e44f"
meta                 = "HEAD:236ac1b43308df722a78d3aa20aef065dfae5b2b"
meta-ust             = "<unknown>:<unknown>"
Sstate summary: Wanted 38 Local 27 Mirrors 0 Missed 11 Current 788 (71% match, 98% complete)########################           | ETA:  0:00:00
Removing 1 stale sstate objects for arch x86_64: 100% |########################################################################| Time: 0:00:00
NOTE: Executing Tasks
ERROR: python3.11-3.11.5-r0 do_package: Error executing a python function in exec_func_python() autogenerated:
The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:extend_recipe_sysroot(d)
     0003:
File: '/home/user/Desktop/Testing/Ashish/02_STM32MCU/OpenSTLinux5/layers/openembedded-core/meta/classes-global/staging.bbclass', lineno: 619, function: extend_recipe_sysroot
     0615:                    if "/bin/" in l or "/sbin/" in l:
     0616:                        # defer /*bin/* files until last in case they need libs
     0617:                        binfiles[l] = (targetdir, dest)
     0618:                    else:
 *** 0619:                        staging_copyfile(l, targetdir, dest, postinsts, seendirs)
     0620:
     0621:    # Handle deferred binfiles
     0622:    for l in binfiles:
     0623:        (targetdir, dest) = binfiles[l]
File: '/home/user/Desktop/Testing/Ashish/02_STM32MCU/OpenSTLinux5/layers/openembedded-core/meta/classes-global/staging.bbclass', lineno: 165, function: staging_copyfile
     0161:        os.symlink(linkto, dest)
     0162:        #bb.warn(c)
     0163:    else:
     0164:        try:
 *** 0165:            os.link(c, dest)
     0166:        except OSError as err:
     0167:            if err.errno == errno.EXDEV:
     0168:                bb.utils.copyfile(c, dest)
     0169:            else:
Exception: FileExistsError: [Errno 17] File exists: '/home/user/Desktop/Testing/Ashish/02_STM32MCU/OpenSTLinux5/build-openstlinuxweston-stm32mp1/tmp-glibc/sysroots-components/x86_64/python3-native/usr/lib/libpython3.so' -> '/home/user/Desktop/Testing/Ashish/02_STM32MCU/OpenSTLinux5/build-openstlinuxweston-stm32mp1/tmp-glibc/work/cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi/python3.11/3.11.5/recipe-sysroot-native/usr/lib/libpython3.so'
ERROR: Logfile of failure stored in: /home/user/Desktop/Testing/Ashish/02_STM32MCU/OpenSTLinux5/build-openstlinuxweston-stm32mp1/tmp-glibc/work/cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi/python3.11/3.11.5/temp/log.do_package.2409035
ERROR: Task (/home/user/Desktop/Testing/Ashish/02_STM32MCU/OpenSTLinux5/layers/meta-ust/recipes-devtools/python/python3.11_3.11.5.bb:do_package) failed with exit code '1'
NOTE: Tasks Summary: Attempted 1892 tasks of which 1870 didn't need to be rerun and 1 failed.
NOTE: Writing buildhistory
NOTE: Writing buildhistory took: 2 seconds

However, if I rerun the bitbake python3.11 command, it compiles successfully. This happens every time I perform a clean state for the Python 3.11 recipe and try building it again. On the first attempt, it fails, but on the second attempt, it works.

Could you help me understand what might be causing this issue?

Additionally, when I try to build the final image after successfully compiling Python 3.11, the build fails when I run bitbake st-image-weston. I’ve attached the error log related to this issue as well. I have attached the custom recipes for your reference.

Errors were encountered while processing:
/home/user/Desktop/Testing/Ashish/02_STM32MCU/OpenSTLinux5/build-openstlinuxweston-stm32mp1/tmp-glibc/work/stm32mp1-ostl-linux-gnueabi/st-image-weston/1.0/oe-rootfs-repo/cortexa7t2hf-neon-vfpv4/./python3.11_3.11.5-r0.15_armhf.deb
W: No sandbox user '_apt' on the system, can not drop privileges
E: Sub-process dpkg returned an error code (1)

Thank you in advance for your help!

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#65069): https://lists.yoctoproject.org/g/yocto/message/65069
Mute This Topic: https://lists.yoctoproject.org/mt/112062927/1686489
Mute #openstlinux:https://lists.yoctoproject.org/g/yocto/mutehashtag/openstlinux Mute #bitbake:https://lists.yoctoproject.org/g/yocto/mutehashtag/bitbake Mute #yocto:https://lists.yoctoproject.org/g/yocto/mutehashtag/yocto Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

author
#2 lore raw

Re: [yocto] Error while building python3.11 as an alternative for scarthgap (OpenSTLinux) #openstlinux #bitbake #yocto

Hi Alex,

Unfortunately, that option isn’t feasible for me at the moment. As mentioned in my previous message, I am using the STM32MPU for learning purposes. The end goal is to have an image for the RZ/V2L with Python 3.11. However, the RZ/V2L currently only supports Python 3.8. I’ve reached out to Renesas regarding support for a higher version, and they informed me that I either have to wait until the end of the year for an official release with Python 3.12, or build it myself. Since I cannot wait until the end of the year for the official release, I am working on building an image with Python 3.11.

Since I don’t currently have access to RZ/V2L hardware, I’m using the STM32MPU to learn and build an image with Python 3.11. I understand your concern, but this task has been assigned to me by my company. Our client provides the models and Python code, and they’ve made it clear that they cannot proceed with Python 3.8. They require at least Python 3.10.

#3 lore raw

Re: [yocto] Error while building python3.11 as an alternative for scarthgap (OpenSTLinux) #openstlinux #bitbake #yocto

Quoted 3 lines · Abhijith via Lists.Yoctoproject.Org

Unfortunately, that option isn’t feasible for me at the moment. As mentioned in my previous message, I am using the STM32MPU for learning purposes. The end goal is to have an image for the RZ/V2L with Python 3.11. However, the RZ/V2L currently only supports Python 3.8. I’ve reached out to Renesas regarding support for a higher version, and they informed me that I either have to wait until the end of the year for an official release with Python 3.12, or build it myself. Since I cannot wait until the end of the year for the official release, I am working on building an image with Python 3.11.

Since I don’t currently have access to RZ/V2L hardware, I’m using the STM32MPU to learn and build an image with Python 3.11. I understand your concern, but this task has been assigned to me by my company. Our client provides the models and Python code, and they’ve made it clear that they cannot proceed with Python 3.8. They require at least Python 3.10.

This does not explain where 3.11 specifically is needed, and why standard 3.12 from scarthgap is not going to work. If you provide details about that, chances of getting help are much higher.

Alex

author
#4 lore raw

Re: [yocto] Error while building python3.11 as an alternative for scarthgap (OpenSTLinux) #openstlinux #bitbake #yocto

Hi Alex,

As I mentioned in my previous post, the RZ/V2L has superior hardware capabilities compared to the STM32MPU157F. However, one limitation with the RZ/V2L is that Renesas officially supports only Yocto version 3.1.31 (Dunfell) for that board. Unfortunately, the Scarthgap for this board isn't officially available.

Currently, I am working with OpenSTLinux and Scarthgap, as that's the board I have access to at the moment.

#5 lore raw

Re: [yocto] Error while building python3.11 as an alternative for scarthgap (OpenSTLinux) #openstlinux #bitbake #yocto

I really tried to read this multiple times, but I don't understand where this requirement for Python 3.11 comes from (which of course might be due to my lack of understanding). When your vendor gives Scarthgap support for your other board, that will also come with Python 3.12. Currently there aren't any Yocto versions that would support Python 3.11...

You mentioned that your customer needs at least Python 3.10 - Python 3.12 seems to fulfill that requirement. If you have anything that doesn't work with 3.12 for whatever reason, than this is the best time to fix it - you will have to do it anyway.

Quoted 24 lines · Abhijith via lists.yoctoproject.org

Hi Alex,

As I mentioned in my previous post, the RZ/V2L has superior hardware capabilities compared to the STM32MPU157F. However, one limitation with the RZ/V2L is that Renesas officially supports only Yocto version 3.1.31 (Dunfell) for that board. Unfortunately, the Scarthgap for this board isn't officially available.

Currently, I am working with OpenSTLinux and Scarthgap, as that's the board I have access to at the moment.

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#65077): https://lists.yoctoproject.org/g/yocto/message/65077
Mute This Topic: https://lists.yoctoproject.org/mt/112062927/6084445
Mute #openstlinux:https://lists.yoctoproject.org/g/yocto/mutehashtag/openstlinux Mute #bitbake:https://lists.yoctoproject.org/g/yocto/mutehashtag/bitbake Mute #yocto:https://lists.yoctoproject.org/g/yocto/mutehashtag/yocto Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

author
#6 lore raw

Re: [yocto] Error while building python3.11 as an alternative for scarthgap (OpenSTLinux) #openstlinux #bitbake #yocto

Hi Gyorgy,

I’m currently using OpenSTLinux (Scarthgap) on the STM32MP157F-DK2 development board to learn how to build an alternative Python 3 version in Yocto. My ultimate goal is to build a Yocto image for the RZ/V2L development board, with Python 3.11 as an alternative to the default Python 3.8.

The STM32MP157F-DK2 and the RZ/V2L come from different vendors (STMicroelectronics and Renesas, respectively), but I’m using the STM32MP157F-DK2 for now because I don’t have the RZ/V2L board yet. Once I get the RZ/V2L, I plan to apply what I’ve learned from building the image on the STM32MP157F-DK2 to create the final image for the RZ/V2L.

Renesas officially supports Yocto Dunfell for the RZ/V2L, which includes Python 3.8. However, for my project, I need at least Python 3.10, and ideally Python 3.11. Since the STM32MP157F-DK2 is available to me right now, I’m using it as a reference point to learn the process, with the intent to later apply it to the RZ/V2L once I have it.

I hope this clarifies the situation.
Abhijith

#7 lore raw

Re: [yocto] Error while building python3.11 as an alternative for scarthgap (OpenSTLinux) #openstlinux #bitbake #yocto

Quoted 15 lines · Abhijith via Lists.Yoctoproject.Org

Hi Gyorgy,

I’m currently using OpenSTLinux (Scarthgap) on the STM32MP157F-DK2 development board to learn how to build an alternative Python 3 version in Yocto. My ultimate goal is to build a Yocto image for the RZ/V2L development board, with Python 3.11 as an alternative to the default Python 3.8.

The STM32MP157F-DK2 and the RZ/V2L come from different vendors (STMicroelectronics and Renesas, respectively), but I’m using the STM32MP157F-DK2 for now because I don’t have the RZ/V2L board yet. Once I get the RZ/V2L, I plan to apply what I’ve learned from building the image on the STM32MP157F-DK2 to create the final image for the RZ/V2L.

Quoted 8 lines

Renesas officially supports Yocto Dunfell for the RZ/V2L, which includes Python 3.8. However, for my project, I need at least Python 3.10, and ideally Python 3.11. Since the STM32MP157F-DK2 is available to me right now, I’m using it as a reference point to learn the process, with the intent to later apply it to the RZ/V2L once I have it.

I hope this clarifies the situation.

Unfortunately it doesn't clarify anything about why Python 3.12 isn't suitable for you as the only Python installation, or why you are trying to install multiple Python versions instead of updating 3.8 completely.

There are reasons why everyone is trying to discourage you from this. The current recipe problems are only the first ones of the issues you are about to face, and there would be many more at runtime - and not only we are unable to help with those issues, most upstream maintainers would also be unable to do so unfortunately.

I won't push you however to share the original problem, if you don't want to for some reason.

Quoted 2 lines

Abhijith

author
#8 lore raw

Re: [yocto] Error while building python3.11 as an alternative for scarthgap (OpenSTLinux) #openstlinux #bitbake #yocto

Hi Gyorgy,

If we were to go with STM32MP157F-DF2 board, I didn't have to try to install python3.11 on it. I think the code would run just fine on python3.12. But we aren't using STM32MP157F-DF2 for the product, we will be using RZ/V2L and that have only python3.8. Python3.8 isn't feasable.

The reason why didn't try to upgrade python3.8 to python3.10 or higher was based on the online forums stating trying to upgrade the default python3.8 would cause issue with other packages. I thought I would having to build an alternative python would much be much easier than upgrading one. Anyways I'll try that as well.

#9 lore raw

Re: [yocto] Error while building python3.11 as an alternative for scarthgap (OpenSTLinux) #openstlinux #bitbake #yocto

Quoted 3 lines · Abhijith via lists.yoctoproject.org

If we were to go with STM32MP157F-DF2 board, I didn't have to try to install python3.11 on it. I think the code would run just fine on python3.12. But we aren't using STM32MP157F-DF2 for the product, we will be using RZ/V2L and that have only python3.8. Python3.8 isn't feasable.

The reason why didn't try to upgrade python3.8 to python3.10 or higher was based on the online forums stating trying to upgrade the default python3.8 would cause issue with other packages. I thought I would having to build an alternative python would much be much easier than upgrading one. Anyways I'll try that as well.

Just try to use the standard 3.12 from scrathgap. Please, pretty please. How many times do we need to tell you that? If you run into issues with 3.12, show them here, and we'll try to help. Seriously.

Alex