dirent.h compile problem

XiotSamuel
Posts: 53
Joined: Sun Aug 29, 2021 1:50 pm

dirent.h compile problem

Postby XiotSamuel » Thu Jul 04, 2024 3:01 pm

I have following error form the dirent.h after I update the esp-idf to verion v5.3. Anyone have fix this.

Code: Select all


[5/1027] Building C object esp-idf/mbedtls/mbedtls/library/CMakeFiles/mbedx509.dir/x509_crt.c.obj
FAILED: esp-idf/mbedtls/mbedtls/library/CMakeFiles/mbedx509.dir/x509_crt.c.obj
C:\Users\mokts\.espressif\tools\xtensa-esp32-elf\esp-12.2.0_20230208\xtensa-esp32-elf\bin\xtensa-esp32-elf-gcc.exe -DESP_PLATFORM -DIDF_VER=\"v5.3-beta2\" -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" -DSOC_MMU_PAGE_SIZE=CONFIG_MMU_PAGE_SIZE -DSOC_XTAL_FREQ_MHZ=CONFIG_XTAL_FREQ -D_GLIBCXX_HAVE_POSIX_SEMAPHORE -D_GLIBCXX_USE_POSIX_SEMAPHORE -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS -IC:/Users/mokts/lcd/hello_world/build/config -IC:/Users/mokts/esp/esp-idf/components/mbedtls/port/include -IC:/Users/mokts/esp/esp-idf/components/mbedtls/mbedtls/include -IC:/Users/mokts/esp/esp-idf/components/mbedtls/mbedtls/library -IC:/Users/mokts/lcd/hello_world/build/esp-idf/mbedtls/mbedtls/library -IC:/Users/mokts/esp/esp-idf/components/newlib/platform_include -IC:/Users/mokts/esp/esp-idf/components/freertos/config/include -IC:/Users/mokts/esp/esp-idf/components/freertos/config/include/freertos -IC:/Users/mokts/esp/esp-idf/components/freertos/config/xtensa/include -IC:/Users/mokts/esp/esp-idf/components/freertos/FreeRTOS-Kernel/include -IC:/Users/mokts/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include -IC:/Users/mokts/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos -IC:/Users/mokts/esp/esp-idf/components/freertos/esp_additions/include -IC:/Users/mokts/esp/esp-idf/components/esp_hw_support/include -IC:/Users/mokts/esp/esp-idf/components/esp_hw_support/include/soc -IC:/Users/mokts/esp/esp-idf/components/esp_hw_support/include/soc/esp32 -IC:/Users/mokts/esp/esp-idf/components/esp_hw_support/dma/include -IC:/Users/mokts/esp/esp-idf/components/esp_hw_support/ldo/include -IC:/Users/mokts/esp/esp-idf/components/esp_hw_support/port/esp32/. -IC:/Users/mokts/esp/esp-idf/components/esp_hw_support/port/esp32/include -IC:/Users/mokts/esp/esp-idf/components/heap/include -IC:/Users/mokts/esp/esp-idf/components/log/include -IC:/Users/mokts/esp/esp-idf/components/soc/include -IC:/Users/mokts/esp/esp-idf/components/soc/esp32 -IC:/Users/mokts/esp/esp-idf/components/soc/esp32/include -IC:/Users/mokts/esp/esp-idf/components/hal/platform_port/include -IC:/Users/mokts/esp/esp-idf/components/hal/esp32/include -IC:/Users/mokts/esp/esp-idf/components/hal/include -IC:/Users/mokts/esp/esp-idf/components/esp_rom/include -IC:/Users/mokts/esp/esp-idf/components/esp_rom/include/esp32 -IC:/Users/mokts/esp/esp-idf/components/esp_rom/esp32 -IC:/Users/mokts/esp/esp-idf/components/esp_common/include -IC:/Users/mokts/esp/esp-idf/components/esp_system/include -IC:/Users/mokts/esp/esp-idf/components/esp_system/port/soc -IC:/Users/mokts/esp/esp-idf/components/esp_system/port/include/private -IC:/Users/mokts/esp/esp-idf/components/xtensa/esp32/include -IC:/Users/mokts/esp/esp-idf/components/xtensa/include -IC:/Users/mokts/esp/esp-idf/components/xtensa/deprecated_include -IC:/Users/mokts/esp/esp-idf/components/lwip/include -IC:/Users/mokts/esp/esp-idf/components/lwip/include/apps -IC:/Users/mokts/esp/esp-idf/components/lwip/include/apps/sntp -IC:/Users/mokts/esp/esp-idf/components/lwip/lwip/src/include -IC:/Users/mokts/esp/esp-idf/components/lwip/port/include -IC:/Users/mokts/esp/esp-idf/components/lwip/port/freertos/include -IC:/Users/mokts/esp/esp-idf/components/lwip/port/esp32xx/include -IC:/Users/mokts/esp/esp-idf/components/lwip/port/esp32xx/include/arch -IC:/Users/mokts/esp/esp-idf/components/lwip/port/esp32xx/include/sys -IC:/Users/mokts/esp/esp-idf/components/mbedtls/mbedtls/3rdparty/everest/include -IC:/Users/mokts/esp/esp-idf/components/mbedtls/mbedtls/3rdparty/p256-m -IC:/Users/mokts/esp/esp-idf/components/mbedtls/mbedtls/3rdparty/p256-m/p256-m -mlongcalls -Wno-frame-address  -fno-builtin-memcpy -fno-builtin-memset -fno-builtin-bzero -fno-builtin-stpcpy -fno-builtin-strncpy -Wall -Wextra -Wwrite-strings -Wformat=2 -Wno-format-nonliteral -Wvla -Wlogical-op -Wshadow -Wformat-signedness -Wformat-overflow=2 -Wformat-truncation -Werror -Wmissing-declarations -Wmissing-prototypes -fdiagnostics-color=always -fdiagnostics-color=always -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -Og -fno-shrink-wrap -fmacro-prefix-map=C:/Users/mokts/lcd/hello_world=. -fmacro-prefix-map=C:/Users/mokts/esp/esp-idf=/IDF -fstrict-volatile-bitfields -fno-jump-tables -fno-tree-switch-conversion -std=gnu17 -Wno-old-style-declaration -MD -MT esp-idf/mbedtls/mbedtls/library/CMakeFiles/mbedx509.dir/x509_crt.c.obj -MF esp-idf\mbedtls\mbedtls\library\CMakeFiles\mbedx509.dir\x509_crt.c.obj.d -o esp-idf/mbedtls/mbedtls/library/CMakeFiles/mbedx509.dir/x509_crt.c.obj -c C:/Users/mokts/esp/esp-idf/components/mbedtls/mbedtls/library/x509_crt.c
In file included from c:\users\mokts\.espressif\tools\xtensa-esp32-elf\esp-12.2.0_20230208\xtensa-esp32-elf\xtensa-esp32-elf\sys-include\dirent.h:39,
                 from C:/Users/mokts/esp/esp-idf/components/mbedtls/mbedtls/library/x509_crt.c:66:
c:\users\mokts\.espressif\tools\xtensa-esp32-elf\esp-12.2.0_20230208\xtensa-esp32-elf\xtensa-esp32-elf\sys-include\sys\dirent.h:10:2: error: #error "<dirent.h> not supported"
   10 | #error "<dirent.h> not supported"
      |  ^~~~~
c:\users\mokts\.espressif\tools\xtensa-esp32-elf\esp-12.2.0_20230208\xtensa-esp32-elf\xtensa-esp32-elf\sys-include\dirent.h:48:16: error: unknown type name 'DIR'
   48 | int      dirfd(DIR *);
      |                ^~~
c:\users\mokts\.espressif\tools\xtensa-esp32-elf\esp-12.2.0_20230208\xtensa-esp32-elf\xtensa-esp32-elf\sys-include\dirent.h:51:21: error: unknown type name 'DIR'
   51 | int      fdclosedir(DIR *);
      |                     ^~~
c:\users\mokts\.espressif\tools\xtensa-esp32-elf\esp-12.2.0_20230208\xtensa-esp32-elf\xtensa-esp32-elf\sys-include\dirent.h:53:1: error: unknown type name 'DIR'
   53 | DIR     *opendir(const char *);
      | ^~~
c:\users\mokts\.espressif\tools\xtensa-esp32-elf\esp-12.2.0_20230208\xtensa-esp32-elf\xtensa-esp32-elf\sys-include\dirent.h:54:1: error: unknown type name 'DIR'
   54 | DIR     *fdopendir(int);
      | ^~~
c:\users\mokts\.espressif\tools\xtensa-esp32-elf\esp-12.2.0_20230208\xtensa-esp32-elf\xtensa-esp32-elf\sys-include\dirent.h:56:18: error: unknown type name 'DIR'
   56 |          readdir(DIR *);
      |                  ^~~
c:\users\mokts\.espressif\tools\xtensa-esp32-elf\esp-12.2.0_20230208\xtensa-esp32-elf\xtensa-esp32-elf\sys-include\dirent.h:58:20: error: unknown type name 'DIR'
   58 | int      readdir_r(DIR *__restrict, struct dirent *__restrict,
      |                    ^~~
c:\users\mokts\.espressif\tools\xtensa-esp32-elf\esp-12.2.0_20230208\xtensa-esp32-elf\xtensa-esp32-elf\sys-include\dirent.h:61:20: error: unknown type name 'DIR'
   61 | void     rewinddir(DIR *);
      |                    ^~~
c:\users\mokts\.espressif\tools\xtensa-esp32-elf\esp-12.2.0_20230208\xtensa-esp32-elf\xtensa-esp32-elf\sys-include\dirent.h:72:18: error: unknown type name 'DIR'
   72 | void     seekdir(DIR *, long);
      |                  ^~~
c:\users\mokts\.espressif\tools\xtensa-esp32-elf\esp-12.2.0_20230208\xtensa-esp32-elf\xtensa-esp32-elf\sys-include\dirent.h:73:18: error: unknown type name 'DIR'
   73 | long     telldir(DIR *);
      |                  ^~~
c:\users\mokts\.espressif\tools\xtensa-esp32-elf\esp-12.2.0_20230208\xtensa-esp32-elf\xtensa-esp32-elf\sys-include\dirent.h:76:19: error: unknown type name 'DIR'
   76 | int      closedir(DIR *);
      |                   ^~~
C:/Users/mokts/esp/esp-idf/components/mbedtls/mbedtls/library/x509_crt.c: In function 'mbedtls_x509_crt_parse_path':
C:/Users/mokts/esp/esp-idf/components/mbedtls/mbedtls/library/x509_crt.c:1597:5: error: unknown type name 'DIR'
 1597 |     DIR *dir = opendir(path);
      |     ^~~
C:/Users/mokts/esp/esp-idf/components/mbedtls/mbedtls/library/x509_crt.c:1612:21: error: implicit declaration of function 'readdir' [-Werror=implicit-function-declaration]
 1612 |     while ((entry = readdir(dir)) != NULL) {
      |                     ^~~~~~~
C:/Users/mokts/esp/esp-idf/components/mbedtls/mbedtls/library/x509_crt.c:1612:19: error: assignment to 'struct dirent *' from 'int' makes pointer from integer without a cast [-Werror=int-conversion]
 1612 |     while ((entry = readdir(dir)) != NULL) {
      |                   ^
C:/Users/mokts/esp/esp-idf/components/mbedtls/mbedtls/library/x509_crt.c:1614:56: error: invalid use of undefined type 'struct dirent'     
 1614 |                                    "%s/%s", path, entry->d_name);
      |                                                        ^~
C:/Users/mokts/esp/esp-idf/components/mbedtls/mbedtls/library/x509_crt.c:1650:5: error: implicit declaration of function 'closedir' [-Werror=implicit-function-declaration]
 1650 |     closedir(dir);
      |     ^~~~~~~~
cc1.exe: all warnings being treated as errors
[7/1027] Performing build step for 'bootloader'
[1/1] cmd.exe /C "cd /D C:\Users\mokts\lcd\hello_world\build\bootloader\esp-idf\esptool_py && C:\Users\mokts\.espressif\python_env\idf5.1_py3.11_env\Scripts\python.exe C:/Users/mokts/esp/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x1000 C:/Users/mokts/lcd/hello_world/build/bootloader/bootloader.bin"
Bootloader binary size 0x6960 bytes. 0x6a0 bytes (6%) free.
[10/1025] Building C object esp-idf/esp_driver_uart/CMakeFiles/__idf_esp_driver_uart.dir/src/uart.c.obj
ninja: build stopped: subcommand failed.

 *  The terminal process "C:\Users\mokts\.espressif\tools\ninja\1.11.1\ninja.exe" terminated with exit code: 1.


mehdok
Posts: 1
Joined: Tue Jul 30, 2024 5:17 am

Re: dirent.h compile problem

Postby mehdok » Tue Jul 30, 2024 5:19 am

I have the same issue, did you find any solution?

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: dirent.h compile problem

Postby ESP_igrr » Wed Jul 31, 2024 8:02 am

This issue occurs because you are compiling ESP-IDF v5.3 with toolchain esp-12.2.0_20230208. The correct version for IDF v5.3 is esp-13.2.0_20240530.

Can you please describe how you are compiling the project (command line, IDE, which OS, etc.)?

Who is online

Users browsing this forum: No registered users and 91 guests