Skip to contentSkip to conversation

Failure with python + ncurses combination with Yocto 5.0 (and even 4.3) upgrades #yocto

yocto Mayank Pandey 2 participants 4 messages Jun 13, 2024 – Jun 14, 2024

lore
Share & tools
lore
#0 lore raw

Hello Yocto experts

I am trying to upgrade my custom bsp layer working on Yocto 4.0 (kirkstone) branch to Yocto 5.0 (scarthgap). I have made all the necessary modifications to the custom recipes based on the 5.0 patch notes. I am facing an error with the python3 version of scarthgap not being able to build ncurses module due to implicit declaration error. I tried the same with 4.3 branch (nanbield) as well, which gave me the same error. The error snippet is as follows (error is from python3 do_install step)

Quoted 13 lines

NOTE: Skipping as already exists in sysroot: ['openssl', 'expat', 'gettext-minimal-native', 'glibc', 'libxcrypt', 'ncurses', 'util-linux-libuuid', 'zlib', 'binutils-cross-aarch64', 'cmake-native', 'gcc-cross-aarch64', 'gcc-runtime', 'libgcc', 'libedit', 'libtool-cross', 'libtool-native', 'm4-native', 'opkg-utils', 'quilt-native', 'bzip2', 'libnsl2', 'libtirpc', 'texinfo-dummy-native', 'xz', 'linux-libc-headers', 'gdbm', 'libffi', 'sqlite3', 'openssl-native', 'expat-native', 'ncurses-native', 'util-linux-libuuid-native', 'zlib-native', 'autoconf-archive-native', 'autoconf-native', 'automake-native', 'flex-native', 'gnu-config-native', 'libedit-native', 'make-native', 'patch-native', 'perl-native', 'pkgconfig-native', 'pseudo-native',

Quoted 8 lines

'python3-native', 'bzip2-native', 'libnsl2-native', 'libtirpc-native', 'xz-native', 'zstd-native', 'attr-native', 'gdbm-native', 'gmp-native', 'libffi-native', 'libmpc-native', 'mpfr-native', 'sqlite3-native']DEBUG:
Python function extend_recipe_sysroot finishedDEBUG: Executing python function autotools_aclocalsDEBUG: SITE files ['endian-little', 'bit-64', 'arm-common', 'arm-64', 'common-linux', 'common-glibc', 'aarch64-linux', 'common']DEBUG: Python function autotools_aclocals finishedDEBUG:
Executing shell function do_installFailed to build these modules:_curses

Now I dug a little deeper to get the error from the do_install step, and found that the _curses module had failed in compilation step itself but the compilation continuer, and then it failed in the do_install step. The do_compile logs are as below:

Quoted 7 lines

/dvs/container/cm/git-master_yocto/yocto/build/tmp/work/armv8a-gnu-linux/python3/3.11.5/Python-3.11.5/Modules/_cursesmodule.c:3398:35:
error: implicit declaration of function 'setupterm'; did you mean
'set_term'? [-Werror=implicit-function-declaration] 3398 |     if
(!initialised_setupterm && setupterm((char *)term, fd, &err) == ERR) {
|                                   ^~~~~~~~~      |
set_term

Does anyone know what could be the root cause of this issue?
One more thing to not is that the error is intermittent - but with a very low passing rate of ~5-10% (90-95 % of the build fails with the upgrade). Thanks for any inputs

#1 lore raw

This requires investigating where setupterm() is supposed to come from and why it isn't picked up. It helps to set up a plain poky build with one of the qemu machines to get a stable working reference point.

Alex

Quoted 26 lines · Mayank Pandey via lists.yoctoproject.org

Hello Yocto experts

I am trying to upgrade my custom bsp layer working on Yocto 4.0 (kirkstone) branch to Yocto 5.0 (scarthgap). I have made all the necessary modifications to the custom recipes based on the 5.0 patch notes. I am facing an error with the python3 version of scarthgap not being able to build ncurses module due to implicit declaration error. I tried the same with 4.3 branch (nanbield) as well, which gave me the same error. The error snippet is as follows (error is from python3 do_install step)

NOTE: Skipping as already exists in sysroot: ['openssl', 'expat', 'gettext-minimal-native', 'glibc', 'libxcrypt', 'ncurses', 'util-linux-libuuid', 'zlib', 'binutils-cross-aarch64', 'cmake-native', 'gcc-cross-aarch64', 'gcc-runtime', 'libgcc', 'libedit', 'libtool-cross', 'libtool-native', 'm4-native', 'opkg-utils', 'quilt-native', 'bzip2', 'libnsl2', 'libtirpc', 'texinfo-dummy-native', 'xz', 'linux-libc-headers', 'gdbm', 'libffi', 'sqlite3', 'openssl-native', 'expat-native', 'ncurses-native', 'util-linux-libuuid-native', 'zlib-native', 'autoconf-archive-native', 'autoconf-native', 'automake-native', 'flex-native', 'gnu-config-native', 'libedit-native', 'make-native', 'patch-native', 'perl-native', 'pkgconfig-native', 'pseudo-native', 'python3-native', 'bzip2-native', 'libnsl2-native', 'libtirpc-native', 'xz-native', 'zstd-native', 'attr-native', 'gdbm-native', 'gmp-native', 'libffi-native', 'libmpc-native', 'mpfr-native', 'sqlite3-native']DEBUG: Python function extend_recipe_sysroot finishedDEBUG: Executing python function autotools_aclocalsDEBUG: SITE files ['endian-little', 'bit-64', 'arm-common', 'arm-64', 'common-linux', 'common-glibc', 'aarch64-linux', 'common']DEBUG: Python function autotools_aclocals finishedDEBUG: Executing shell function do_installFailed to build these modules:_curses

Now I dug a little deeper to get the error from the do_install step, and found that the _curses module had failed in compilation step itself but the compilation continuer, and then it failed in the do_install step. The do_compile logs are as below:

/dvs/container/cm/git-master_yocto/yocto/build/tmp/work/armv8a-gnu-linux/python3/3.11.5/Python-3.11.5/Modules/_cursesmodule.c:3398:35: error: implicit declaration of function 'setupterm'; did you mean 'set_term'? [-Werror=implicit-function-declaration] 3398 | if (!initialised_setupterm && setupterm((char *)term, fd, &err) == ERR) { | ^~~~~~~~~ | set_term

Does anyone know what could be the root cause of this issue?
One more thing to not is that the error is intermittent - but with a very low passing rate of ~5-10% (90-95 % of the build fails with the upgrade). Thanks for any inputs
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#63337): https://lists.yoctoproject.org/g/yocto/message/63337
Mute This Topic: https://lists.yoctoproject.org/mt/106648183/1686489
Mute #yocto:https://lists.yoctoproject.org/g/yocto/mutehashtag/yocto
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw

Hi Alex
Thanks for the input. The thing is, the issue is not coming in the plain poky build, that I had tried already. In the custom build that we have, the issue is coming. We don't get this in kirkstone (4.0) but beyond that we are getting the problem with the upgrades. Any pointers as to where we should look at to fix this? I read a suggestion on a forum that we can disable Wimplicit-function-declaration for this specific case, but that is pretty much a hack and won't be building the curses module with Python. Any other suggestions on where to look for?

#3 lore raw
Quoted 2 lines · Mayank Pandey via Lists.Yoctoproject.Org

Thanks for the input. The thing is, the issue is not coming in the plain poky build, that I had tried already. In the custom build that we have, the issue is coming. We don't get this in kirkstone (4.0) but beyond that we are getting the problem with the upgrades. Any pointers as to where we should look at to fix this? I read a suggestion on a forum that we can disable Wimplicit-function-declaration for this specific case, but that is pretty much a hack and won't be building the curses module with Python. Any other suggestions on where to look for?

You need to narrow down the difference between working build and broken build. Start with the working build: inspect the build directory of python3 and find out where setupterm() is declated, and how that declaration is picked up by the compiler when it builds _cursesmodule.c. Or maybe _cursesmodule.c isn't built at all?

Then look at the broken build and find out what is happening there. Is there a difference in how the compiler is invoked (log.do_compile)? Are the includes conditional and the condition for the needed one is false? Or curses is enabled in the broken build and disabled in the working one?

Investigating build failures like this are a necessary skill with Yocto, you have to develop it. Formulate a set of questions, then answer them in order, eliminating possibilities. Or hire a consultant.

Alex