build icon indicating copy to clipboard operation
build copied to clipboard

U-Boot build fails with `ModuleNotFoundError: No module named 'distutils'`

Open djurny opened this issue 6 months ago • 4 comments

When building U-Boot (due to adding new patches) v2022.04 and v2022.07 it's build fails with:

[🐳|🔨]     CC      arch/arm/lib/asm-offsets.s
[🐳|🔨]   /armbian/cache/sources/u-boot-worktree/u-boot/v2022.07/scripts/dtc/pylibfdt/setup.py:27: SyntaxWarning: invalid escape sequence '\w'
[🐳|🔨]     RE_KEY_VALUE = re.compile('(?P<key>\w+) *(?P<plus>[+])?= *(?P<value>.*)$')
[🐳|🔨]   Traceback (most recent call last):
[🐳|🔨]     File "/armbian/cache/sources/u-boot-worktree/u-boot/v2022.07/scripts/dtc/pylibfdt/setup.py", line 21, in <module>
[🐳|🔨]       from distutils.core import setup, Extension
[🐳|🔨]   ModuleNotFoundError: No module named 'distutils'
[🐳|🔨]   make[2]: *** [scripts/dtc/pylibfdt/Makefile:30: rebuild] Error 1
[🐳|🔨]   make[1]: *** [scripts/Makefile.build:398: scripts/dtc/pylibfdt] Error 2
[🐳|🔨]   make[1]: *** Waiting for unfinished jobs....
[🐳|🔨]     UPD     include/generated/generic-asm-offsets.h
[🐳|🔨]     UPD     include/generated/asm-offsets.h
[🐳|🔨]     LDS     u-boot.lds
[🐳|🔨]   make: *** [Makefile:2066: scripts_dtc] Error 2
[🐳|💥] Cleaning up [ please wait for cleanups to finish ]

Looks like the build system cannot find python3-setuptools or U-Boot make does not include or "require" python3-setuptools.

Originally posted by @djurny in https://github.com/armbian/build/issues/8260#issuecomment-2935445422

djurny avatar Jun 03 '25 17:06 djurny

Jira ticket: AR-2697

github-actions[bot] avatar Jun 03 '25 17:06 github-actions[bot]

This is worked around in https://github.com/armbian/build/pull/8260 by explicitly adding python3-setuptools to host_dependencies when U-Boot branches v2022.04 or v2022.07 are going to be built.

djurny avatar Jun 03 '25 17:06 djurny

I foresee future pain related to this. distutils died, trying to ressurrect it here using (outdated/mismatched) distro packages will work up until it doesn't. this brings setuptools back using a conditional that's not always available during host prepare, so won't work for docker images, causing constant cache fails.

I would have suggested to upgrade u-boot instead.

Originally posted by @rpardini in https://github.com/armbian/build/issues/8260#issuecomment-2936989800

djurny avatar Jun 04 '25 01:06 djurny

Maybe related: https://github.com/armbian/build/pull/8168

EvilOlaf avatar Jun 04 '25 04:06 EvilOlaf