Linker does not find functions from the libspiffs.a library file

JouniV
Posts: 1
Joined: Fri Jun 14, 2024 11:14 am

Linker does not find functions from the libspiffs.a library file

Postby JouniV » Fri Jun 14, 2024 11:22 am

We want to store the OTA AWS certificates into the flash of ESP32E board. We have used SPIFFS for that purpose in the main.c file of our project. For some reason, the linker does not find those functions. What could cause that issue? We checked that those functions are inside of libspiffs.a library file. Could this be a circular dependency issue and we should repeat some libraries at least twice on the linker command line?

Here are the linker error messages:

main.c: undefined reference to esp_spiffs_format' undefined reference to esp_vfs_spiffs_register’ control_flash.c: undefined reference to esp_spiffs_info' undefined reference to esp_vfs_spiffs_register’

[ 89%] Building C object esp-idf/spiffs/CMakeFiles/__idf_spiffs.dir/esp_spiffs.c.obj [ 89%] Building C object esp-idf/spiffs/CMakeFiles/__idf_spiffs.dir/spiffs_api.c.obj [ 89%] Building C object esp-idf/spiffs/CMakeFiles/__idf_spiffs.dir/spiffs/src/spiffs_cache.c.obj [ 89%] Building C object esp-idf/spiffs/CMakeFiles/__idf_spiffs.dir/spiffs/src/spiffs_check.c.obj [ 89%] Building C object esp-idf/spiffs/CMakeFiles/__idf_spiffs.dir/spiffs/src/spiffs_gc.c.obj [ 89%] Building C object esp-idf/spiffs/CMakeFiles/__idf_spiffs.dir/spiffs/src/spiffs_hydrogen.c.obj [ 90%] Building C object esp-idf/spiffs/CMakeFiles/__idf_spiffs.dir/spiffs/src/spiffs_nucleus.c.obj [ 90%] Linking C static library libspiffs.a [ 90%] Built target __idf_spiffs

Description of the circular dependency issue:

Circular Dependencies[]

It’s possible for a project to contain Component A that requires (REQUIRES or PRIV_REQUIRES) Component B, and Component B that requires Component A. This is known as a dependency cycle or a circular dependency.

CMake will usually handle circular dependencies automatically by repeating the component library names twice on the linker command line. However this strategy doesn’t always work, and the build may fail with a linker error about “Undefined reference to …”, referencing a symbol defined by one of the components inside the circular dependency. This is particularly likely if there is a large circular dependency, i.e., A > B > C > D > A.

Who is online

Users browsing this forum: Baidu [Spider] and 69 guests