-
Notifications
You must be signed in to change notification settings - Fork 7k
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
ESP32-C3 libstdc++ is missing some cmath C++11 functions (IDFGH-5009) #6795
Comments
Hi @Robertou2, Thanks for reporting this and providing a clear description of the error. Although we don't support third party projects, I can reproduce this issue using a simple C++11 test case so I've renamed the title. #include <cmath>
int round_test(void)
{
return std::round(3.33);
} This seems like it will need to be fixed by updating the libstdc++ that is bundled with the ESP32-C3 toolchain. Will update once this is available. |
Hi @projectgus, |
I have found a workaround using round() from cmath without std. |
Thanks for letting us know about the workaround, @Robertou2 . This is still a bug in ESP-IDF (math headers should "just work"), so happy to keep it until we solve the root cause. |
Adds ESP32-C3 support Updates ESP32-S3 overlay GDB 9.2 for ESP32-C3 with core dump support Linker supports eh-frame-hdr for ESP32-C3 Newlib 3.3.0 includes fixes for <cmath> funcs, for overflow when TZ calculating, for malloc checks Binutils 2.35.1 Closes #6795
Environment
Problem Description
Build TFLite Hello world in EP32-C3 return
../components/tfmicro/tensorflow/lite/kernels/internal/cppmath.h:37:41: error: 'round' is not a member of 'std'
DECLARE_STD_GLOBAL_SWITCH1(TfLiteRound, round);
//Detailed problem description goes here.
When I try to build this example https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/micro/examples/hello_world#deploy-to-esp32
in an ESP-32-C3, I get an error
../components/tfmicro/tensorflow/lite/kernels/internal/cppmath.h:37:41: error: 'round' is not a member of 'std'
DECLARE_STD_GLOBAL_SWITCH1(TfLiteRound, round);
If the target is ESP-32 there isn´t any problem
Expected Behavior
Get a binary file
Actual Behavior
Get an error
Steps to reproduce
I follow the instructions to deploy from the example. For ESP32-c3 I use idf.py set-target esp32-c3
For ESP32 idf.py set-target esp32
After idf.py build
// If possible, attach a picture of your setup/wiring here.
https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/micro/examples/hello_world#deploy-to-esp32
Debug Logs
FAILED: esp-idf/tfmicro/CMakeFiles/__idf_tfmicro.dir/tensorflow/lite/micro/kernels/activations.cc.obj
ccache C:\Users\roberto.espressif\tools\riscv32-esp-elf\1.24.0.123_64eb9ff-8.4.0\riscv32-esp-elf\bin\riscv32-esp-elf-g++.exe -Iconfig -I../components/tfmicro -I../components/tfmicro/third_party/gemmlowp -I../components/tfmicro/third_party/flatbuffers/include -I../components/tfmicro/third_party/ruy -I../../../../components/newlib/platform_include -I../../../../components/freertos/include -I../../../../components/freertos/port/riscv/include -I../../../../components/esp_hw_support/include -I../../../../components/esp_hw_support/port/esp32c3/. -I../../../../components/esp_hw_support/port/esp32c3/private_include -I../../../../components/heap/include -I../../../../components/log/include -I../../../../components/lwip/include/apps -I../../../../components/lwip/include/apps/sntp -I../../../../components/lwip/lwip/src/include -I../../../../components/lwip/port/esp32/include -I../../../../components/lwip/port/esp32/include/arch -I../../../../components/soc/include -I../../../../components/soc/esp32c3/. -I../../../../components/soc/esp32c3/include -I../../../../components/hal/esp32c3/include -I../../../../components/hal/include -I../../../../components/esp_rom/include -I../../../../components/esp_rom/esp32c3 -I../../../../components/esp_common/include -I../../../../components/esp_system/include -I../../../../components/esp32c3/include -I../../../../components/driver/include -I../../../../components/driver/esp32c3/include -I../../../../components/esp_ringbuf/include -I../../../../components/efuse/include -I../../../../components/efuse/esp32c3/include -I../../../../components/riscv/include -I../../../../components/espcoredump/include -I../../../../components/esp_timer/include -I../../../../components/esp_ipc/include -I../../../../components/esp_pm/include -I../../../../components/vfs/include -I../../../../components/esp_wifi/include -I../../../../components/esp_wifi/esp32c3/include -I../../../../components/esp_event/include -I../../../../components/esp_netif/include -I../../../../components/esp_eth/include -I../../../../components/tcpip_adapter/include -march=rv32imc -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -ggdb -Wno-error=format= -nostartfiles -Wno-format -Og -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -std=gnu++11 -fno-exceptions -fno-rtti -D_GNU_SOURCE -DIDF_VER="v4.4-dev-4-g73db14240-dirty" -DESP_PLATFORM -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-type-limits -DTF_LITE_STATIC_MEMORY -DNDEBUG -O3 -Wno-nonnull -std=c++11 -Wno-return-type -Wno-strict-aliasing -MD -MT esp-idf/tfmicro/CMakeFiles/__idf_tfmicro.dir/tensorflow/lite/micro/kernels/activations.cc.obj -MF esp-idf\tfmicro\CMakeFiles__idf_tfmicro.dir\tensorflow\lite\micro\kernels\activations.cc.obj.d -o esp-idf/tfmicro/CMakeFiles/__idf_tfmicro.dir/tensorflow/lite/micro/kernels/activations.cc.obj -c ../components/tfmicro/tensorflow/lite/micro/kernels/activations.cc
In file included from ../components/tfmicro/tensorflow/lite/kernels/internal/common.h:27,
from ../components/tfmicro/tensorflow/lite/micro/kernels/activations.cc:18:
../components/tfmicro/tensorflow/lite/kernels/internal/cppmath.h: In function 'T tflite::TfLiteRound(T)':
../components/tfmicro/tensorflow/lite/kernels/internal/cppmath.h:37:41: error: 'round' is not a member of 'std'
DECLARE_STD_GLOBAL_SWITCH1(TfLiteRound, round);
^~~~~
../components/tfmicro/tensorflow/lite/kernels/internal/cppmath.h:34:39: note: in definition of macro 'DECLARE_STD_GLOBAL_SWITCH1'
return TF_LITE_GLOBAL_STD_PREFIX::std_name(x);
^~~~~~~~
../components/tfmicro/tensorflow/lite/kernels/internal/cppmath.h:37:41: note: suggested alternative: 'count'
DECLARE_STD_GLOBAL_SWITCH1(TfLiteRound, round);
^~~~~
../components/tfmicro/tensorflow/lite/kernels/internal/cppmath.h:34:39: note: in definition of macro 'DECLARE_STD_GLOBAL_SWITCH1'
return TF_LITE_GLOBAL_STD_PREFIX::std_name(x);
^~~~~~~~
[913/1028] Performing build step for 'bootloader'
[1/80] Generating project_elf_src_esp32c3.c
[2/80] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/mpu_hal.c.obj
[3/80] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c3/gdma_periph.c.obj
[4/80] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c3/soc_memory_layout.c.obj
[5/80] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c3/rmt_periph.c.obj
[6/80] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/soc_include_legacy_warn.c.obj
[7/80] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/lldesc.c.obj
[8/80] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/memory_layout_utils.c.obj
[9/80] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c3/timer_periph.c.obj
[10/80] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c3/adc_periph.c.obj
[11/80] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c3/ledc_periph.c.obj
[12/80] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c3/sigmadelta_periph.c.obj
[13/80] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c3/interrupts.c.obj
[14/80] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c3/gpio_periph.c.obj
[15/80] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c3/i2s_periph.c.obj
[16/80] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c3/i2c_periph.c.obj
[17/80] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c3/uart_periph.c.obj
[18/80] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c3/spi_periph.c.obj
[19/80] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/wdt_hal_iram.c.obj
[20/80] Building C object esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/esp32c3/spi_flash_rom_patch.c.obj
[21/80] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_common.c.obj
[22/80] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_flash.c.obj
[23/80] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_clock_init.c.obj
[24/80] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_mem.c.obj
[25/80] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_common_loader.c.obj
[26/80] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_random_esp32c3.c.obj
[27/80] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_console_loader.c.obj
[28/80] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp_image_format.c.obj
[29/80] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_efuse_esp32c3.c.obj
[30/80] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_clock_loader.c.obj
[31/80] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_utility.c.obj
[32/80] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_random.c.obj
[33/80] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_encrypt.c.obj
[34/80] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32c3/bootloader_sha.c.obj
[35/80] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_partitions.c.obj
[36/80] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_console.c.obj
[37/80] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_panic.c.obj
[38/80] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/esp32c3/esp_efuse_table.c.obj
[39/80] Building C object CMakeFiles/bootloader.elf.dir/project_elf_src_esp32c3.c.obj
[40/80] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_qio_mode.c.obj
[41/80] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_flash_config_esp32c3.c.obj
[42/80] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp32c3/esp_efuse_api.c.obj
[43/80] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32c3/bootloader_esp32c3.c.obj
[44/80] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_fields.c.obj
[45/80] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_init.c.obj
[46/80] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c3/rtc_pm.c.obj
[47/80] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp32c3/esp_efuse_fields.c.obj
[48/80] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp32c3/esp_efuse_rtc_calib.c.obj
[49/80] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32c3/flash_encrypt.c.obj
[50/80] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp32c3/esp_efuse_utility.c.obj
[51/80] Building C object esp-idf/micro-ecc/CMakeFiles/__idf_micro-ecc.dir/uECC_verify_antifault.c.obj
[52/80] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_crc.c.obj
[53/80] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_sys.c.obj
[54/80] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/compare_set.c.obj
[55/80] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c3/rtc_sleep.c.obj
[56/80] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c3/cpu_util_esp32c3.c.obj
[57/80] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c3/rtc_init.c.obj
[58/80] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_utility.c.obj
[59/80] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_uart.c.obj
[60/80] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/cpu_util.c.obj
[61/80] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c3/rtc_time.c.obj
[62/80] Building C object esp-idf/log/CMakeFiles/__idf_log.dir/log_noos.c.obj
[63/80] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c3/rtc_clk_init.c.obj
[64/80] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c3/rtc_clk.c.obj
[65/80] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_api.c.obj
[66/80] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/bootloader_start.c.obj
[67/80] Building C object esp-idf/log/CMakeFiles/__idf_log.dir/log.c.obj
[68/80] Building C object esp-idf/log/CMakeFiles/__idf_log.dir/log_buffers.c.obj
[69/80] Linking C static library esp-idf\log\liblog.a
[70/80] Linking C static library esp-idf\esp_rom\libesp_rom.a
[71/80] Linking C static library esp-idf\esp_hw_support\libesp_hw_support.a
[72/80] Linking C static library esp-idf\efuse\libefuse.a
[73/80] Linking C static library esp-idf\bootloader_support\libbootloader_support.a
[74/80] Linking C static library esp-idf\spi_flash\libspi_flash.a
[75/80] Linking C static library esp-idf\micro-ecc\libmicro-ecc.a
[76/80] Linking C static library esp-idf\soc\libsoc.a
[77/80] Linking C static library esp-idf\hal\libhal.a
[78/80] Linking C static library esp-idf\main\libmain.a
[79/80] Linking C executable bootloader.elf
[80/80] Generating binary image from built executable
esptool.py v3.1-dev
Merged 1 ELF section
Generated C:/Users/roberto/Desktop/esp-idf/examples/hello_world/esp-idf/build/bootloader/bootloader.bin
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
Other items if possible
build
folder (note this may contain all the code details and symbols of your project.)The text was updated successfully, but these errors were encountered: