Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] <can't compile MK4 firmware> #3579

Closed
kgolger opened this issue Dec 12, 2023 · 11 comments
Closed

[BUG] <can't compile MK4 firmware> #3579

kgolger opened this issue Dec 12, 2023 · 11 comments
Labels
bug Something isn't working

Comments

@kgolger
Copy link

kgolger commented Dec 12, 2023

Please, before you create a new bug report, please make sure you searched in open and closed issues and couldn't find anything that matches.

Printer type - [MK4]

Printer firmware version - [5.1.0]

Original or Custom firmware - [Original]

Describe the bug
can't compile MK4 firmware 5.1.0

tryed to compile as user pi:

git clone https://github.com/prusa3d/Prusa-Firmware-Buddy.git - ok
mv Prusa-Firmware-Buddy TEMP/ - ok
cd TEMP/Prusa-Firmware-Buddy - ok
python utils/build.py --generate-bbf - error!

Switching to Buddy's virtual environment.
You can disable this by setting the BUDDY_NO_VIRTUALENV=1 env. variable.
Traceback (most recent call last):
File "/home/pi/TEMP/Prusa-Firmware-Buddy/utils/build.py", line 832, in
main()
File "/home/pi/TEMP/Prusa-Firmware-Buddy/utils/build.py", line 623, in main
bootstrap.switch_to_venv_if_nedded()
File "/home/pi/TEMP/Prusa-Firmware-Buddy/utils/bootstrap.py", line 211, in switch_to_venv_if_nedded
os.execv(str(venv_bin_dir / 'python'),
FileNotFoundError: [Errno 2] No such file or directory

wbr,
Karl

@kgolger kgolger added the bug Something isn't working label Dec 12, 2023
@seppelicous
Copy link

seppelicous commented Dec 12, 2023

I can confirm this issue.
I get the same error on macOS and windows 11. both with python 3.12.1

@bkerler
Copy link
Contributor

bkerler commented Dec 12, 2023

It's easy to fix. install virtualenv, then do a python -m venv .venv in the git directory and it will work just fine using the build script.

@seppelicous
Copy link

I appreciate your quick support!
It works and now it is compiling 😊

@seppelicous
Copy link

seppelicous commented Dec 12, 2023

Update:
Maybe the reason for the following error has the same root. I already installed "diskutils" with PIP, but still get the same error

`C:\Users\USER\Downloads\prusafirmware>python utils/build.py --preset mk4
Switching to Buddy's virtual environment.
You can disable this by setting the BUDDY_NO_VIRTUALENV=1 env. variable.

C:\Users\USER\Downloads\prusafirmware>Collecting ecdsa~=0.18 (from -r C:\Users\USER\Downloads\prusafirmware\requirements.txt (line 2))
Using cached ecdsa-0.18.0-py2.py3-none-any.whl (142 kB)
Collecting polib~=1.2 (from -r C:\Users\USER\Downloads\prusafirmware\requirements.txt (line 3))
Using cached polib-1.2.0-py2.py3-none-any.whl (20 kB)
Collecting pyyaml~=6.0 (from -r C:\Users\USER\Downloads\prusafirmware\requirements.txt (line 4))
Obtaining dependency information for pyyaml~=6.0 from https://files.pythonhosted.org/packages/2b/9f/fbade56564ad486809c27b322d0f7e6a89c01f6b4fe208402e90d4443a99/PyYAML-6.0.1-cp312-cp312-win_amd64.whl.metadata
Using cached PyYAML-6.0.1-cp312-cp312-win_amd64.whl.metadata (2.1 kB)
Collecting littlefs-python==0.8 (from -r C:\Users\USER\Downloads\prusafirmware\requirements.txt (line 5))
Obtaining dependency information for littlefs-python==0.8 from https://files.pythonhosted.org/packages/09/8b/5b2f9b0b29a2bae7aee648259e92e798c259d6e1455ccbc79e92da0842e2/littlefs_python-0.8.0-cp312-cp312-win_amd64.whl.metadata
Using cached littlefs_python-0.8.0-cp312-cp312-win_amd64.whl.metadata (5.8 kB)
Collecting numpy~=1.24.0 (from -r C:\Users\USER\Downloads\prusafirmware\requirements.txt (line 6))
Using cached numpy-1.24.4.tar.gz (10.9 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
ERROR: Exception:
Traceback (most recent call last):
File "C:\Users\USER\Downloads\prusafirmware.venv\Lib\site-packages\pip_internal\cli\base_command.py", line 180, in exc_logging_wrapper
status = run_func(*args)
^^^^^^^^^^^^^^^
File "C:\Users\USER\Downloads\prusafirmware.venv\Lib\site-packages\pip_internal\cli\req_command.py", line 248, in wrapper
return func(self, options, args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Downloads\prusafirmware.venv\Lib\site-packages\pip_internal\commands\install.py", line 377, in run
requirement_set = resolver.resolve(
^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Downloads\prusafirmware.venv\Lib\site-packages\pip_internal\resolution\resolvelib\resolver.py", line 92, in resolve
result = self._result = resolver.resolve(
^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Downloads\prusafirmware.venv\Lib\site-packages\pip_vendor\resolvelib\resolvers.py", line 546, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Downloads\prusafirmware.venv\Lib\site-packages\pip_vendor\resolvelib\resolvers.py", line 397, in resolve
self._add_to_criteria(self.state.criteria, r, parent=None)
File "C:\Users\USER\Downloads\prusafirmware.venv\Lib\site-packages\pip_vendor\resolvelib\resolvers.py", line 173, in _add_to_criteria
if not criterion.candidates:
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Downloads\prusafirmware.venv\Lib\site-packages\pip_vendor\resolvelib\structs.py", line 156, in bool
return bool(self._sequence)
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Downloads\prusafirmware.venv\Lib\site-packages\pip_internal\resolution\resolvelib\found_candidates.py", line 155, in bool
return any(self)
^^^^^^^^^
File "C:\Users\USER\Downloads\prusafirmware.venv\Lib\site-packages\pip_internal\resolution\resolvelib\found_candidates.py", line 143, in
return (c for c in iterator if id(c) not in self._incompatible_ids)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Downloads\prusafirmware.venv\Lib\site-packages\pip_internal\resolution\resolvelib\found_candidates.py", line 47, in _iter_built
candidate = func()
^^^^^^
File "C:\Users\USER\Downloads\prusafirmware.venv\Lib\site-packages\pip_internal\resolution\resolvelib\factory.py", line 206, in _make_candidate_from_link
self._link_candidate_cache[link] = LinkCandidate(
^^^^^^^^^^^^^^
File "C:\Users\USER\Downloads\prusafirmware.venv\Lib\site-packages\pip_internal\resolution\resolvelib\candidates.py", line 293, in init
super().init(
File "C:\Users\USER\Downloads\prusafirmware.venv\Lib\site-packages\pip_internal\resolution\resolvelib\candidates.py", line 156, in init
self.dist = self._prepare()
^^^^^^^^^^^^^^^
File "C:\Users\USER\Downloads\prusafirmware.venv\Lib\site-packages\pip_internal\resolution\resolvelib\candidates.py", line 225, in _prepare
dist = self._prepare_distribution()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Downloads\prusafirmware.venv\Lib\site-packages\pip_internal\resolution\resolvelib\candidates.py", line 304, in _prepare_distribution
return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Downloads\prusafirmware.venv\Lib\site-packages\pip_internal\operations\prepare.py", line 538, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Downloads\prusafirmware.venv\Lib\site-packages\pip_internal\operations\prepare.py", line 653, in _prepare_linked_requirement
dist = _get_prepared_distribution(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Downloads\prusafirmware.venv\Lib\site-packages\pip_internal\operations\prepare.py", line 69, in _get_prepared_distribution
abstract_dist.prepare_distribution_metadata(
File "C:\Users\USER\Downloads\prusafirmware.venv\Lib\site-packages\pip_internal\distributions\sdist.py", line 48, in prepare_distribution_metadata
self._install_build_reqs(finder)
File "C:\Users\USER\Downloads\prusafirmware.venv\Lib\site-packages\pip_internal\distributions\sdist.py", line 118, in _install_build_reqs
build_reqs = self._get_build_requires_wheel()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Downloads\prusafirmware.venv\Lib\site-packages\pip_internal\distributions\sdist.py", line 95, in _get_build_requires_wheel
return backend.get_requires_for_build_wheel()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Downloads\prusafirmware.venv\Lib\site-packages\pip_internal\utils\misc.py", line 697, in get_requires_for_build_wheel
return super().get_requires_for_build_wheel(config_settings=cs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Downloads\prusafirmware.venv\Lib\site-packages\pip_vendor\pyproject_hooks_impl.py", line 166, in get_requires_for_build_wheel
return self._call_hook('get_requires_for_build_wheel', {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER\Downloads\prusafirmware.venv\Lib\site-packages\pip_vendor\pyproject_hooks_impl.py", line 321, in _call_hook
raise BackendUnavailable(data.get('traceback', ''))
pip._vendor.pyproject_hooks._impl.BackendUnavailable: Traceback (most recent call last):
File "C:\Users\USER\Downloads\prusafirmware.venv\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 77, in build_backend
obj = import_module(mod_path)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python312\Lib\importlib_init
.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1381, in _gcd_import
File "", line 1354, in _find_and_load
File "", line 1304, in _find_and_load_unlocked
File "", line 488, in _call_with_frames_removed
File "", line 1381, in _gcd_import
File "", line 1354, in _find_and_load
File "", line 1325, in _find_and_load_unlocked
File "", line 929, in _load_unlocked
File "", line 994, in exec_module
File "", line 488, in call_with_frames_removed
File "C:\Users\USER\AppData\Local\Temp\pip-build-env-0m7etvnk\overlay\Lib\site-packages\setuptools_init
.py", line 10, in
import distutils.core
ModuleNotFoundError: No module named 'distutils'`

@bkerler
Copy link
Contributor

bkerler commented Dec 12, 2023

I pushed a PR #3582 to fix this bug.

@kgolger
Copy link
Author

kgolger commented Dec 12, 2023

DISTRIB_DESCRIPTION="Ubuntu 22.04.3 LTS"
Python 3.10.12

Thanks @bkerler
Installed virtualenv and did a python -m venv .venv in the git directory.
Following result after send python utils/build.py --genarate-bbf

Switching to Buddy's virtual environment.
You can disable this by setting the BUDDY_NO_VIRTUALENV=1 env. variable.
Building mini_release_boot
Traceback (most recent call last):
File "/home/pi/TEMP/Prusa-Firmware-Buddy/utils/build.py", line 832, in
main()
File "/home/pi/TEMP/Prusa-Firmware-Buddy/utils/build.py", line 800, in main
result = build(configuration,
File "/home/pi/TEMP/Prusa-Firmware-Buddy/utils/build.py", line 328, in build
config_process = subprocess.run([str(get_dependency('cmake'))] + flags,
File "/usr/lib/python3.10/subprocess.py", line 503, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/lib/python3.10/subprocess.py", line 971, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.10/subprocess.py", line 1863, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/home/pi/TEMP/Prusa-Firmware-Buddy/.dependencies/cmake-3.22.5/bin/cmake'

wbr,
Karl

@bkerler
Copy link
Contributor

bkerler commented Dec 12, 2023

Karl, the exec format error normally only appears if you mix up 64bit vs. 32bit. Also I think you mean "--generate-bbf" ?

Prusa themselves seem use this command line (as an example):
python3 utils/build.py --preset mk4 --build-type release --bootloader yes --generate-bbf --generate-dfu --no-store-output --version-suffix=-BETA+5729.PR3570.B5 --version-suffix-short=-BETA+5729 -DCUSTOM_COMPILE_OPTIONS:STRING=-Werror -DDEVELOPMENT_ITEMS_ENABLED:BOOL=yes

@kgolger
Copy link
Author

kgolger commented Dec 12, 2023

You are right - of course "--generate-bbf"
I have installed Ubuntu 22.04.03 LTS ARM64 (Pi400).
For this reason, I will probably not be able to use the Prusa build.py. I'll try it on a 32-bit system.
Thanks!
wbr,
Karl

@bkerler
Copy link
Contributor

bkerler commented Dec 12, 2023

It could very be that the problem is arm64 and not 32bit/64bit. I assume the cross-compile tools are only meant to be used with x86/x64. But you could try to emulate a x86/x64 system on the arm64. Otherwise, if you are on an arm64 system you should be able to use cmake directly without cross-compilation needed at all.

@kgolger
Copy link
Author

kgolger commented Dec 12, 2023

Thanks!
As i meant, i'll try it later on a x86 system (also Ubuntu 22.04 LTS).
wbr,
Karl

@kgolger
Copy link
Author

kgolger commented Dec 12, 2023

compilation now runs on x86 and x64 AMD systems (both tested).
Closing Bugreport - Thanks to all!
wbr,
Karl

@kgolger kgolger closed this as completed Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants