dmazzella / uaesgcm

AES GCM for Micropython
MIT License
2 stars 0 forks source link

ESP32 Build failed with ESP-IDF v5.2 and Micropython master #2

Closed gampam2000 closed 6 months ago

gampam2000 commented 6 months ago

With the latest micropython master and ESP-IDF v5.2 I get the following errors:

Any suggestions on how to fix them?

Thanks & best regards.

[ 97%] Building C object esp-idf/main_esp32s3/CMakeFiles/idf_main_esp32s3.dir$micropython/usercmodule/uaesgcm/AesGCM.c.obj [ 97%] Building C object esp-idf/main_esp32s3/CMakeFiles/idf_main_esp32s3.dir///frozen_content.c.obj [ 97%] Building C object esp-idf/main_esp32s3/CMakeFiles/idf_main_esp32s3.dir$micropython/usercmodule/uaesgcm/modaesgcm.c.obj $micropython/usercmodule/uaesgcm/modaesgcm.c:43:7: error: expected ';' before 'int' 43 | STATIC int mp_random(void rng_state, byte output, size_t len) | ^~~~ | ; $micropython/usercmodule/uaesgcm/modaesgcm.c:67:7: error: expected ';' before 'const' 67 | STATIC const mp_obj_type_t ciphers_aesgcm_type; | ^~ | ; $micropython/usercmodule/uaesgcm/modaesgcm.c:75:1: error: unknown type name 'STATIC' 75 | STATIC mp_obj_t aesgcm_make_new(const mp_obj_type_t type, size_t n_args, size_t n_kw, const mp_obj_t args) | ^~ $micropython/usercmodule/uaesgcm/modaesgcm.c:75:17: error: expected '=', ',', ';', 'asm' or 'attribute' before 'aesgcm_make_new' 75 | STATIC mp_obj_t aesgcm_make_new(const mp_obj_type_t type, size_t n_args, size_t n_kw, const mp_obj_t args) | ^~~~~~~ $micropython/usercmodule/uaesgcm/modaesgcm.c:91:1: error: unknown type name 'STATIC' 91 | STATIC mp_obj_t aesgcm_generate_key(mp_obj_t bit_length) | ^~ $micropython/usercmodule/uaesgcm/modaesgcm.c:91:17: error: expected '=', ',', ';', 'asm' or 'attribute' before 'aesgcm_generate_key' 91 | STATIC mp_obj_t aesgcm_generate_key(mp_obj_t bit_length) | ^~~~~~~ $micropython/usercmodule/uaesgcm/modaesgcm.c:117:7: error: expected ';' before 'const' 117 | STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_aesgcm_generate_key_obj, aesgcm_generate_key); | ^ | ; In file included from $micropython/py/mpstate.h:35, from $micropython/py/runtime.h:29, from $micropython/usercmodule/uaesgcm/modaesgcm.c:36: $micropython/usercmodule/uaesgcm/modaesgcm.c:117:63: error: 'aesgcm_generate_key' undeclared here (not in a function) 117 | STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_aesgcm_generate_key_obj, aesgcm_generate_key); | ^~~~~~~ $micropython/py/obj.h:376:42: note: in definition of macro 'MP_DEFINE_CONST_FUN_OBJ_1' 376 | {{&mp_type_fun_builtin_1}, .fun._1 = fun_name} | ^~~~ $micropython/usercmodule/uaesgcm/modaesgcm.c:118:7: error: expected ';' before 'const' 118 | STATIC MP_DEFINE_CONST_STATICMETHOD_OBJ(mod_static_aesgcm_generate_key_obj, MP_ROM_PTR(&mod_aesgcm_generate_key_obj)); | ^ | ; $micropython/usercmodule/uaesgcm/modaesgcm.c:120:1: error: unknown type name 'STATIC' 120 | STATIC mp_obj_t aesgcm_encrypt(size_t n_args, const mp_obj_t *args) | ^~ $micropython/usercmodule/uaesgcm/modaesgcm.c:120:17: error: expected '=', ',', ';', 'asm' or 'attribute' before 'aesgcm_encrypt' 120 | STATIC mp_obj_t aesgcm_encrypt(size_t n_args, const mp_obj_t args) | ^~~~~~ $micropython/usercmodule/uaesgcm/modaesgcm.c:151:7: error: expected ';' before 'const' 151 | STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_aesgcm_encrypt_obj, 4, 4, aesgcm_encrypt); | ^ | ; $micropython/usercmodule/uaesgcm/modaesgcm.c:151:74: error: 'aesgcm_encrypt' undeclared here (not in a function); did you mean 'aes_gcm_encrypt'? 151 | STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_aesgcm_encrypt_obj, 4, 4, aesgcm_encrypt); | ^~~~~~ $micropython/py/obj.h:388:97: note: in definition of macro 'MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN' 388 | {{&mp_type_fun_builtin_var}, MP_OBJ_FUN_MAKE_SIG(n_args_min, n_args_max, false), .fun.var = fun_name} | ^~~~ $micropython/usercmodule/uaesgcm/modaesgcm.c:153:1: error: unknown type name 'STATIC' 153 | STATIC mp_obj_t aesgcm_decrypt(size_t n_args, const mp_obj_t args) | ^~ $micropython/usercmodule/uaesgcm/modaesgcm.c:153:17: error: expected '=', ',', ';', 'asm' or 'attribute' before 'aesgcm_decrypt' 153 | STATIC mp_obj_t aesgcm_decrypt(size_t n_args, const mp_obj_t *args) | ^~~~~~ $micropython/usercmodule/uaesgcm/modaesgcm.c:184:7: error: expected ';' before 'const' 184 | STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_aesgcm_decrypt_obj, 4, 4, aesgcm_decrypt); | ^ | ; $micropython/usercmodule/uaesgcm/modaesgcm.c:184:74: error: 'aesgcm_decrypt' undeclared here (not in a function); did you mean 'aes_gcm_decrypt'? 184 | STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_aesgcm_decrypt_obj, 4, 4, aesgcm_decrypt); | ^~~~~~ $micropython/py/obj.h:388:97: note: in definition of macro 'MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN' 388 | {{&mp_type_fun_builtin_var}, MP_OBJ_FUN_MAKE_SIG(n_args_min, n_args_max, false), .fun.var = fun_name} | ^~~~ $micropython/usercmodule/uaesgcm/modaesgcm.c:186:7: error: expected ';' before 'const' 186 | STATIC const mp_rom_map_elem_t aesgcm_locals_dict_table[] = { | ^~ | ; $micropython/usercmodule/uaesgcm/modaesgcm.c:192:7: error: expected ';' before 'const' 192 | STATIC MP_DEFINE_CONST_DICT(aesgcm_locals_dict, aesgcm_locals_dict_table); | ^ | ; $micropython/usercmodule/uaesgcm/modaesgcm.c:194:7: error: expected ';' before 'const' 194 | STATIC MP_DEFINE_CONST_OBJ_TYPE( | ^ | ; $micropython/usercmodule/uaesgcm/modaesgcm.c:198:15: error: 'aesgcm_make_new' undeclared here (not in a function) 198 | make_new, aesgcm_make_new, | ^~~~~~~ $micropython/py/obj.h:785:44: note: in definition of macro 'MP_DEFINE_CONST_OBJ_TYPE_EXPAND' 785 | #define MP_DEFINE_CONST_OBJ_TYPE_EXPAND(x) x | ^ $micropython/py/obj.h:789:179: note: in expansion of macro 'MP_DEFINE_CONST_OBJ_TYPE_NARGS_2' 789 | #define MP_DEFINE_CONST_OBJ_TYPE_NARGS(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, N, ...) MP_DEFINE_CONST_OBJ_TYPENARGS##N | ^~~~~~~ $micropython/usercmodule/uaesgcm/modaesgcm.c:194:8: note: in expansion of macro 'MP_DEFINE_CONST_OBJ_TYPE' 194 | STATIC MP_DEFINE_CONST_OBJ_TYPE( | ^~~~~~~~ $micropython/usercmodule/uaesgcm/modaesgcm.c:201:7: error: expected ';' before 'const' 201 | STATIC const mp_rom_map_elem_t ciphers_locals_dict_table[] = { | ^~ | ; $micropython/usercmodule/uaesgcm/modaesgcm.c:205:7: error: expected ';' before 'const' 205 | STATIC MP_DEFINE_CONST_DICT(ciphers_locals_dict, ciphers_locals_dict_table); | ^ | ; $micropython/usercmodule/uaesgcm/modaesgcm.c:207:7: error: expected ';' before 'const' 207 | STATIC MP_DEFINE_CONST_OBJ_TYPE( | ^ | ; $micropython/usercmodule/uaesgcm/modaesgcm.c:213:7: error: expected ';' before 'const' 213 | STATIC const mp_rom_map_elem_t mp_module_uaesgcm_globals_table[] = { | ^~ | ; $micropython/usercmodule/uaesgcm/modaesgcm.c:218:7: error: expected ';' before 'const' 218 | STATIC MP_DEFINE_CONST_DICT(mp_module_uaesgcm_globals, mp_module_uaesgcm_globals_table); | ^ | ; make[3]: *** [esp-idf/main_esp32s3/CMakeFiles/idf_main_esp32s3.dir/build.make:3326: esp-idf/main_esp32s3/CMakeFiles/__idf_main_esp32s3.dir$micropython/usercmodule/uaesgcm/modaesgcm.c.obj] Error 1 make[3]: Waiting for unfinished jobs.... make[3]: Leaving directory '$micropython/ports/esp32/build-ESP32_GENERIC_S3' make[2]: [CMakeFiles/Makefile2:5321: esp-idf/main_esp32s3/CMakeFiles/__idf_main_esp32s3.dir/all] Error 2 make[2]: Leaving directory '$micropython/ports/esp32/build-ESP32_GENERIC_S3' make[1]: [Makefile:130: all] Error 2 make[1]: Leaving directory '$micropython/ports/esp32/build-ESP32_GENERIC_S3' make failed with exit code 2, output of the command is in the $micropython/ports/esp32/build-ESP32_GENERIC_S3/log/idf_py_stderr_output_971524 and $micropython/ports/esp32/build-ESP32_GENERIC_S3/log/idf_py_stdout_output_971524 -e See https://github.com/micropython/micropython/wiki/Build-Troubleshooting make: [Makefile:66: all] Error 1 make: Leaving directory '$micropython/ports/esp32'

dmazzella commented 6 months ago

With latest micropython master there are breaking change, one of this is the remove of the define STATIC. For now try to replace all STATIC with static lowercase.

gampam2000 commented 6 months ago

Thanks for the help, that solved the problem.