Bug 15519 - Bitbake failing to start server on ubuntu 22.04
Summary: Bitbake failing to start server on ubuntu 22.04
Status: RESOLVED OBSOLETE
Alias: None
Product: Runtime
Classification: Build System, Metadata & Runtime
Component: build-appliance (show other bugs)
Version: unspecified
Hardware: All Multiple
: Undecided normal
Target Milestone: 0.0.0
Assignee: Unassigned
QA Contact:
URL:
Whiteboard:
: 15520 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-06-18 10:58 UTC by Ashwin Naik
Modified: 2024-06-24 12:55 UTC (History)
2 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ashwin Naik 2024-06-18 10:58:07 UTC

    
Comment 1 Ashwin Naik 2024-06-18 11:38:56 UTC
I was working with yoctoproject which is cloned on 2017 from fsl-comunity-bsp
on host machine  Ubuntu 18.04.6 LTS and we have a board of NXP(we can't disclose the board name) which is very old. 
which supports 
kernel version 4.1.46
U-boot version 2.17.11
gcc version 7.3.0
glibc version 2.27
busybox version 1.29.2
python3 version 3.5.3

Which is already present in cloned  fsl-comunity-bsp(yocto)
we can build in host machine Ubuntu 18.04.6 LTS.

the yocto has BitBake Build Tool Core version 1.36.0

installed deps of Ubuntu 18.04.6 LTS are.
Python  - 2.7.17
Python3 - 3.6.9
gcc     - 7.5.0

Now the problem is
------------------

I need to build the same packages which is built in ubuntu 18 machine,
using ubuntu 22.04 OS.
we have cloned the same repository which is present in ubuntu 18 machine
and source the envirinment-file

when we run 
bitbake core-image-base

we got the bellow error

Traceback (most recent call last):
  File "/u/old-yocto/fsl-community-bsp/sources/poky/bitbake/bin/bitbake", line 31, in <module>
    import bb
  File "/u/old-yocto/fsl-community-bsp/sources/poky/bitbake/lib/bb/__init__.py", line 77, in <module>
    import bb.msg
  File "/u/old-yocto/fsl-community-bsp/sources/poky/bitbake/lib/bb/msg.py", line 32, in <module>
    import bb.event
  File "/u/old-yocto/fsl-community-bsp/sources/poky/bitbake/lib/bb/event.py", line 35, in <module>
    import bb.compat
  File "/u/old-yocto/fsl-community-bsp/sources/poky/bitbake/lib/bb/compat.py", line 3, in <module>
    from collections import MutableMapping, KeysView, ValuesView, ItemsView, OrderedDict
ImportError: cannot import name 'MutableMapping' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

installed deps of Ubuntu 22.04 LTS are.

Python  - 2.7.17
Python3 - 3.10.12
gcc     - 11.4.0


Please give me some solution
Comment 2 Ross Burton 2024-06-20 15:12:06 UTC
The MutableMapping fix is trivial:

-from collections import MutableMapping
+from collections.abc import MutableMapping

This is because Python 3.10 removed the old name.

However, circa 2017 and bitbake 1.36 suggests the Yocto is Rocko.  Bitbake having problems with modern Python is the least of your problems, the modern host compiler will most likely fail to build your kernel or toolchain.

If you need to build a very old release, the only sane way of doing this is with a container of a supported release.  The list of supported releases for rocko can be found here:

https://git.yoctoproject.org/poky/tree/meta-poky/conf/distro/poky.conf?h=rocko#n66
Comment 3 Ashwin Naik 2024-06-24 06:43:04 UTC
*** Bug 15520 has been marked as a duplicate of this bug. ***
Comment 4 Ashwin Naik 2024-06-24 08:27:19 UTC
hi ross.burton@arm.com 
As suggested, i have changed The MutableMapping

-from collections import MutableMapping
+from collections.abc import MutableMapping

i think it is resolved. 

but now i got one more error while bitbake

     $ bitbake core-image-base

WARNING: <BSP_DIR>/sources/poky/bitbake/lib/bb/server/process.py:537: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
  self.t.setDaemon(True)

WARNING: Host distribution "ubuntu-22.04" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.
ERROR: <BSP_DIR>/sources/poky/meta/recipes-core/images/core-image-base.bb: Can't get compiler version from gcc  --version output                     | ETA:  --:--:--
WARNING: <BSP_DIR>/sources/poky/meta/recipes-core/images/core-image-base.bb: Exception during build_dependencies for create_shar
WARNING: <BSP_DIR>/sources/poky/meta/recipes-core/images/core-image-base.bb: Error during finalise of <BSP_DIR>/sources/poky/meta/recipes-core/images/core-image-base.bb
ERROR: ExpansionError during parsing <BSP_DIR>/sources/poky/meta/recipes-core/images/core-image-base.bb
Traceback (most recent call last):
bb.data_smart.ExpansionError: Failure expanding variable create_shar, expression was 	# copy in the template shar extractor script
	cp <BSP_DIR>/sources/poky/meta/files/toolchain-shar-extract.sh <core-image-base_WORKDIR>/1.0-r0/x86_64-deploy-jupiter-image-populate-sdk/jupiterdist-glibc-x86_64-jupiter-image-cortexa7hf-neon-toolchain-1.0.sh

	rm -f <core-image-base_WORKDIR>e/1.0-r0/temp/pre_install_command /u/old-yocto/fsl-community-bsp/build/tmp/work/imx7dsabresd_jupiter-jupiter-linux-gnueabi/jupiter-image/1.0-r0/temp/post_install_command

	if [ 1 -eq 1 ] ; then
		cp <BSP_DIR>/sources/poky/meta/files/toolchain-shar-relocate.sh <core-image-base_WORKDIR>/1.0-r0/temp/post_install_command
	fi
	cat << "EOF" >> <core-image-base_WORKDIR>/1.0-r0/temp/pre_install_command

EOF

	cat << "EOF" >> <core-image-base_WORKDIR>/1.0-r0/temp/post_install_command

EOF
	sed -i -e '/@SDK_PRE_INSTALL_COMMAND@/r <core-image-base_WORKDIR>/1.0-r0/temp/pre_install_command' \
		-e '/@SDK_POST_INSTALL_COMMAND@/r <core-image-base_WORKDIR>/1.0-r0/temp/post_install_command' \
		<core-image-base_WORKDIR>/1.0-r0/x86_64-deploy-jupiter-image-populate-sdk/jupiterdist-glibc-x86_64-jupiter-image-cortexa7hf-neon-toolchain-1.0.sh

	# substitute variables
	sed -i -e 's#@SDK_ARCH@#x86_64#g' \
		-e 's#@SDKPATH@#/opt/jupiterdist/1.0#g' \
		-e 's#@SDKEXTPATH@#~/jupiterdist_sdk#g' \
		-e 's#@OLDEST_KERNEL@#3.2.0#g' \
		-e 's#@REAL_MULTIMACH_TARGET_SYS@#cortexa7hf-neon-jupiter-linux-gnueabi#g' \
		-e 's#@SDK_TITLE@#${@d.getVar("SDK_TITLE").replace('&', '\&')}#g' \
		-e 's#@SDK_VERSION@#1.0#g' \
		-e '/@SDK_PRE_INSTALL_COMMAND@/d' \
		-e '/@SDK_POST_INSTALL_COMMAND@/d' \
		-e 's#@SDK_GCC_VER@#${@oe.utils.host_gcc_version(d)}#g' \
		<core-image-base_WORKDIR>/1.0-r0/x86_64-deploy-jupiter-image-populate-sdk/jupiterdist-glibc-x86_64-jupiter-image-cortexa7hf-neon-toolchain-1.0.sh

	# add execution permission
	chmod +x <core-image-base_WORKDIR>/1.0-r0/x86_64-deploy-jupiter-image-populate-sdk/jupiterdist-glibc-x86_64-jupiter-image-cortexa7hf-neon-toolchain-1.0.sh

	# append the SDK tarball
	cat <core-image-base_WORKDIR>/1.0-r0/x86_64-deploy-jupiter-image-populate-sdk/jupiterdist-glibc-x86_64-jupiter-image-cortexa7hf-neon-toolchain-1.0.tar.xz >> <core-image-base_WORKDIR>/1.0-r0/x86_64-deploy-jupiter-image-populate-sdk/jupiterdist-glibc-x86_64-jupiter-image-cortexa7hf-neon-toolchain-1.0.sh

	# delete the old tarball, we don't need it anymore
	rm <core-image-base_WORKDIR>/1.0-r0/x86_64-deploy-jupiter-image-populate-sdk/jupiterdist-glibc-x86_64-jupiter-image-cortexa7hf-neon-toolchain-1.0.tar.xz
 which triggered exception BBHandledException: 


Summary: There were 4 WARNING messages shown.
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.


as i am trying to bitbake in ubuntu 22 machine
the gcc version is 11.4.0
Comment 5 Ross Burton 2024-06-24 09:16:34 UTC
You will have a _lot_ of trouble building a release from 2017 on a modern distro.  I recommend using a container with a supported distribution for that release to do the builds.

You could try using the Rocko buildtools tarball (http://downloads.yoctoproject.org/releases/yocto/yocto-2.4/buildtools/) to provide appropriately old host tools, but I suspect they won't work on a modern distribution either.

As Rocko has been end-of-life for six years now, you won't get any further support from here.  There are a number of consultancies who can be contracted to help further if needed.
Comment 6 Ashwin Naik 2024-06-24 12:44:09 UTC
Hi ross.burton@arm.com

(In reply to Ross Burton from comment #2)


> If you need to build a very old release, the only sane way of doing this is
> with a container of a supported release.

Can you please suggest from where we will get ubuntu 18 container?
Comment 7 Ross Burton 2024-06-24 12:55:22 UTC
DockerHub has official images, or build your own.