libhydrogen error when trying to build mboot with packing enabled
Port, board and/or hardware
stm32
MicroPython version
MicroPython v1.22-release
Reproduction
make BOARD=PYBV11
Expected behaviour
building mboot with packing enabled i.e. MBOOT_ENABLE_PACKING = 1
Observed behaviour
I get a couple of these lines:
../../../lib/libhydrogen/impl/random/Particle.h:8:1: note: previous definition of 'hydro_random_init' with type 'int(void)'
8 | hydro_random_init(void)
| ^~~~~~~~~~~~~~~~~
and I get a couple of these lines:
../../../lib/libhydrogen/impl/random/Particle.h:8:1: error: 'hydro_random_init' defined but not used [-Werror=unused-function]
8 | hydro_random_init(void)
| ^~~~~~~~~~~~~~~~~
Build outcome:
cc1: all warnings being treated as errors
make: *** [build-PYBV11/lib/libhydrogen/hydrogen.o] Error 1
The pyhy version that is installed is 0.0.9
Additional Information
No, I've provided everything above.
Code of Conduct
Yes, I agree
../py/misc.h:108:9: Error: expected »;« before »void«, NORETURN void m_malloc_fail(size_t num_bytes);
Port, board and/or hardware
esp32
MicroPython version
git describe --dirty
v1.20.0-2510-gacfeb7b7e-dirty
Reproduction
make -C mpy-cross clean
make: Verzeichnis „/home/ro011110ot/_Dev/Python/_ESP32/lvgl/lv_micropython/mpy-cross“ wird betreten
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
rm -f build/mpy-cross
rm -f build/mpy-cross.map
rm -rf build
make: Verzeichnis „/home/ro011110ot/_Dev/Python/_ESP32/lvgl/lv_micropython/mpy-cross“ wird verlassen
❯ git submodule update --init --recursive
❯ make CC=gcc-12 -C mpy-cross
make: Verzeichnis „/home/ro011110ot/_Dev/Python/_ESP32/lvgl/lv_micropython/mpy-cross“ wird betreten
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
mkdir -p build/genhdr
GEN build/genhdr/mpversion.h
GEN build/genhdr/qstr.i.last
GEN build/genhdr/qstr.split
GEN build/genhdr/qstrdefs.collected.h
QSTR updated
GEN build/genhdr/qstrdefs.generated.h
GEN build/genhdr/moduledefs.split
GEN build/genhdr/moduledefs.collected
Module registrations updated
GEN build/genhdr/moduledefs.h
GEN build/genhdr/root_pointers.split
GEN build/genhdr/root_pointers.collected
Root pointer registrations updated
GEN build/genhdr/root_pointers.h
mkdir -p build/py/
mkdir -p build/shared/runtime/
CC ../py/mpstate.c
CC ../py/nlr.c
CC ../py/nlrx86.c
CC ../py/nlrx64.c
CC ../py/nlrthumb.c
CC ../py/nlraarch64.c
CC ../py/nlrmips.c
CC ../py/nlrpowerpc.c
CC ../py/nlrxtensa.c
CC ../py/nlrrv32.c
CC ../py/nlrrv64.c
CC ../py/nlrsetjmp.c
CC ../py/malloc.c
CC ../py/gc.c
CC ../py/pystack.c
CC ../py/qstr.c
CC ../py/vstr.c
CC ../py/mpprint.c
CC ../py/unicode.c
CC ../py/mpz.c
CC ../py/reader.c
CC ../py/lexer.c
CC ../py/parse.c
CC ../py/scope.c
CC ../py/compile.c
CC ../py/emitcommon.c
CC ../py/emitbc.c
CC ../py/asmbase.c
CC ../py/asmx64.c
CC ../py/emitnx64.c
CC ../py/asmx86.c
CC ../py/emitnx86.c
CC ../py/asmthumb.c
CC ../py/emitnthumb.c
CC ../py/emitinlinethumb.c
In Datei, eingebunden von ../py/asmthumb.h:30,
von ../py/emitinlinethumb.c:33:
../py/misc.h:108:9: Fehler: expected »;« before »void«
108 | NORETURN void m_malloc_fail(size_t num_bytes);
| ^~~~~
| ;
../py/misc.h:170:1: Fehler: unbekannter Typname: »mp_uint_t«
170 | mp_uint_t unichar_xdigit_value(unichar c);
| ^~~~~~~~~
../py/misc.h:237:8: Fehler: unbekannter Typname: »mp_uint_t«
237 | extern mp_uint_t mp_verbose_flag;
| ^~~~~~~~~
../py/misc.h:382:35: Fehler: unbekannter Typname: »mp_int_t«
382 | static inline uint32_t mp_clz_mpi(mp_int_t x) {
| ^~~~~~~~
See https://github.com/micropython/micropython/wiki/Build-Troubleshooting
make: *** [../py/mkrules.mk:90: build/py/emitinlinethumb.o] Fehler 1
make: Verzeichnis „/home/ro011110ot/_Dev/Python/_ESP32/lvgl/lv_micropython/mpy-cross“ wird verlassen
Expected behaviour
Build without Errors
Observed behaviour
In Datei, eingebunden von ../py/asmthumb.h:30,
von ../py/emitinlinethumb.c:33:
../py/misc.h:108:9: Fehler: expected »;« before »void«
108 | NORETURN void m_malloc_fail(size_t num_bytes);
| ^~~~~
| ;
../py/misc.h:170:1: Fehler: unbekannter Typname: »mp_uint_t«
170 | mp_uint_t unichar_xdigit_value(unichar c);
| ^~~~~~~~~
../py/misc.h:237:8: Fehler: unbekannter Typname: »mp_uint_t«
237 | extern mp_uint_t mp_verbose_flag;
| ^~~~~~~~~
../py/misc.h:382:35: Fehler: unbekannter Typname: »mp_int_t«
382 | static inline uint32_t mp_clz_mpi(mp_int_t x) {
| ^~~~~~~~
Additional Information
With the help from Gemini i found a solution:
It seems like you're running into a build error. The compiler is reporting unknown type names like mp_uint_t and mp_int_t, which suggests a missing header file during the compilation of
emitinlinethumb.c. I'll start by examining the file py/emitinlinethumb.c to understand its dependencies.
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓ ReadFile py/emitinlinethumb.c │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ py/emitinlinethumb.c includes py/asmthumb.h and py/emit.h. The error stems from py/misc.h, which is included by py/asmthumb.h. I'll examine py/asmthumb.h now.
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓ ReadFile py/asmthumb.h │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ py/asmthumb.h includes py/misc.h and py/asmbase.h, but py/misc.h requires types from py/mpconfig.h which isn't included first. I'll check py/misc.h to confirm its dependencies.
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓ ReadFile py/misc.h │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ py/misc.h is missing mp_uint_t, mp_int_t, and NORETURN definitions because py/emitinlinethumb.c includes py/asmthumb.h before py/mpconfig.h. Other py/ headers include py/mpconfig.h first.
I'll add #include "py/mpconfig.h" to the top of py/asmthumb.h to fix this.
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✓ Edit py/asmthumb.h: #ifndef MICROPY_INCLUDED_PY_AS... => #ifndef MICROPY_INCLUDED_PY_AS... │
│ │
│ 26 #ifndef MICROPY_INCLUDED_PY_ASMTHUMB_H │
│ 27 #define MICROPY_INCLUDED_PY_ASMTHUMB_H │
│ 28 │
│ 29 + #include "py/mpconfig.h" │
│ 30 #include <assert.h> │
│ 31 #include "py/misc.h" │
│ 32 #include "py/asmbase.h"
After adding
│ 29 + #include "py/mpconfig.h"
to
py/asmthumb.h:
the build was succsess
Code of Conduct
Yes, I agree