← index #7012PR #17022
Off-topic · high · value 1.125
QUERY · ISSUE

Micropython rp2 fails to build on windows systems.

openby WestfWopened 2021-03-11updated 2021-09-17
port-rp2

When attempting to build micropython for rp2040 in a windows environment, the make/cmake environment generates a command line that exceeds the windows10/cmd.exe line length limit of 8191 characters.
This is because the RP2 SDK requires about 3k worth of C include paths, and the list of files compiled that is generated on a single command line is about 6k (depending on exact path names.)

Extensive discussion and whining here: https://www.raspberrypi.org/forums/viewtopic.php?f=144&t=306333

I'll add that compiling all the C files for micropython with a single command line seems ... dangerously likely not to scale well on other build platforms as well.

CANDIDATE · PULL REQUEST

esp32, rp2: Use `$(Q)` as a prefix for all commands in the Makefile

mergedby dpgeorgeopened 2025-03-28updated 2025-03-28
port-esp32port-rp2

Summary

At the moment, running make on esp32 or rp2 leads to the (lengthy) command being printed out, before it's run. This can be distracting, eg on rp2 the current situation is:

$ make
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
[ -f ../../lib/pico-sdk/README.md ] || (echo -e "\033[1;31mError: pico-sdk submodule is not initialized.\033[0m Run 'make submodules'"; false)
[ -e build-RPI_PICO/Makefile ] || cmake -S . -B build-RPI_PICO -DPICO_BUILD_DOCS=0 -DMICROPY_BOARD=RPI_PICO -DMICROPY_BOARD_DIR="micropython/ports/rp2/boards/RPI_PICO"
make  -C build-RPI_PICO || (echo -e "See \033[1;31mhttps://github.com/micropython/micropython/wiki/Build-Troubleshooting\033[0m"; false)
make[1]: Entering directory 'micropython/ports/rp2/build-RPI_PICO'
[  0%] Built target bs2_default
[  1%] Built target bs2_default_library
...

That's pretty noisy and it almost looks as if there is an error and it's telling me to visit the troubleshooting page.

This PR suppresses this output by using $(Q), which is what all the non-cmake ports already do. You can still get the full command by doing make V=1.

Testing

Tested esp32 and rp2 ports with make, make submodules and make clean and it's now improved. Also tested make V=1 to see that the command was printed. And tested the case where the pico-sdk was not initialised, to check the error message still worked.

Eg on rp2:

$ make
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
make[1]: Entering directory 'micropython/ports/rp2/build-RPI_PICO'
[  0%] Built target bs2_default
[  1%] Built target bs2_default_library
[  1%] Built target BUILD_VERSION_HEADER
...

and without the pico-sdk:

$ make
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
Error: pico-sdk submodule is not initialized. Run 'make submodules'
make: *** [Makefile:63: all] Error 1

and verbose mode:

$  make V=1
[ -f ../../lib/pico-sdk/README.md ] || (echo -e "\033[1;31mError: pico-sdk submodule is not initialized.\033[0m Run 'make submodules'"; false)
[ -e build-RPI_PICO/Makefile ] || cmake -S . -B build-RPI_PICO -DPICO_BUILD_DOCS=0 -DMICROPY_BOARD=RPI_PICO -DMICROPY_BOARD_DIR="micropython/ports/rp2/boards/RPI_PICO"
make VERBOSE=1   -C build-RPI_PICO || (echo -e "See \033[1;31mhttps://github.com/micropython/micropython/wiki/Build-Troubleshooting\033[0m"; false)
make[1]: Entering directory 'micropython/ports/rp2/build-RPI_PICO'
...

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied