Hello.
Im trying to compile vesc express firmware for my esp32 mini d1.
I managed to setup toolchain and get the code compiling but i get some error that i dont know how to solve.
Only change i have made is set target to esp32 insted of esp32c3.
here re the errors from command prompt.
I also get errors when trying to compile vesc express build from the source code.
esp-idf/bt/CMakeFiles/__idf_bt.dir/host/bluedroid/btc/profile/std/gap/btc_gap_ble.c.obj FAILED
C:/Espressif/frameworks/esp-idf-v5.1.1/components/bt/host/bluedroid/stack/include/stack/bt_types.h:35:34: error: 'strncpy' specified bound 33 equals destination size [-Werror=stringop-truncation]
35 | #define BCM_STRNCPY_S(x1,x2,x3) strncpy((x1),(x2),(x3))
| ^~~~~~~~~~~~~~~~~~~~~~~
C:/Espressif/frameworks/esp-idf-v5.1.1/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_ble.c:89:9: note: in expansion of macro 'BCM_STRNCPY_S'
89 | BCM_STRNCPY_S(param.get_dev_name_cmpl.name, name, BTC_MAX_LOC_BD_NAME_LEN + 1);
| ^~~~~~~~~~~~~
cc1.exe: some warnings being treated as errors
Anyone?
Hi im not trying to be a wise-ass but did you try asking chatgpt?
Error Summary
You're getting:
Which refers to this line:
What's the problem?
You're using
strncpy
with a length that is exactly equal to the destination buffer size. GCC warns that this might truncate the string without adding a null-terminator, which could lead to undefined behavior. Because your project treats all warnings as errors (-Werror
), the build fails.Solutions
✅ Option 1: Suppress the specific warning
If you trust this code is safe, you can disable this warning being treated as an error:
Add this to your
CMakeLists.txt
:Or if you're using
idf.py
with menuconfig:idf.py menuconfig
Go to:
Compiler Options → Enable -Werror → [ ] (disable it or exclude this specific warning)
✅ Option 2: Fix the source (if you're editing ESP-IDF source)
If you’re modifying ESP-IDF or building from source and can patch it, add a manual null-terminator:
strncpy(dest, src, SIZE - 1); dest[SIZE - 1] = '\0';
But this may not be practical if you're using the original ESP-IDF sources as-is.
Recommendation
If you're not modifying
bt_types.h
yourself, the best way is to just suppress that warning using Option 1 above — this is a known and safe workaround used by many ESP-IDF developers.Let me know if you want a patch or help adding the compiler flag.