Compatibility between "normal CMake" and ESP-IDF

ESP_renz
Posts: 18
Joined: Tue May 14, 2019 2:41 am

Re: Compatibility between "normal CMake" and ESP-IDF

Postby ESP_renz » Mon May 20, 2019 9:34 am

Hello everyone,

We have been making changes to ESP-IDF CMake build system internals for the 4.0 release to better facilitate the some of the use cases that have been mentioned in this thread. The bulk of these changes has already been pushed to Github. Please take a look at the latest master if you have some time as we are looking for feedback, especially since 4.0 is a chance to implement significant (potentially breaking) changes.

permal
Posts: 384
Joined: Sun May 14, 2017 5:36 pm

Re: Compatibility between "normal CMake" and ESP-IDF

Postby permal » Wed May 22, 2019 3:20 pm

ESP_renz,

Do you have a summary of changes made?

Edit: build-esp32.sh in examples/build_system/idf_as_lib is hard coded for Ninja, on Linux make is usually the preferred tool.

Edit2:
The documentation at docs.espressif.com still seems to list how the CMake build system worked up until at least commit 6fd535c98, not how it now works?

I've tried updating my framework to use IDF as a lib using the new idf_build_process(), but I can't seen to get it to include such things as lwip (sys/socket.h no longer found when building). I tried adding "lwip" to the COMPONENTS argument, but that doesn't help.

Also, my framework has an IDF-component that I've previously added using IDF_EXTRA_COMPONENT_DIRS. Is that still how it is supposed to be done?

Edit3: I'm using xtensa-gcc8 if that matters.

Thanks,

Per

permal
Posts: 384
Joined: Sun May 14, 2017 5:36 pm

Re: Compatibility between "normal CMake" and ESP-IDF

Postby permal » Thu May 30, 2019 6:42 pm

Any response to this? Trying to update to latest IDF, but the seemingly deprecated IDF_EXTRA_COMPONENT_DIRS (now named EXTRA_COMPONENT_DIRS) is preventing me from doing so. How are components supposed to be added now? I have a component that adds some items to resulting sdkconfig.h so that menuconfig can be used to configure the project.

Edit: I use IDF as a library, i.e. calling idf_build_process

Code: Select all

include($ENV{IDF_PATH}/tools/cmake/idf.cmake)
        set(EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_LIST_DIR}/smooth_idf_component")

        idf_build_process(esp32
                # try and trim the build; additional components
                # will be included as needed based on dependency tree
                #
                # although esptool_py does not generate static library,
                # processing the component is needed for flashing related
                # targets and file generation
                COMPONENTS esp32 freertos esptool_py
                SDKCONFIG ${CMAKE_CURRENT_LIST_DIR}/sdkconfig
                BUILD_DIR ${CMAKE_BINARY_DIR})

        target_link_libraries(${target} idf::esp32)

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Compatibility between "normal CMake" and ESP-IDF

Postby ESP_Angus » Thu May 30, 2019 11:39 pm

Hi permal,
permal wrote:
Wed May 22, 2019 3:20 pm
Edit: build-esp32.sh in examples/build_system/idf_as_lib is hard coded for Ninja, on Linux make is usually the preferred tool.
This should also work with make, if you change the shell script. (BTW, you might find that you like ninja - I'm a Linux user and I am 100% converted to it - builds are faster and the generated build script from cmake is much easier to follow.)
permal wrote:
Wed May 22, 2019 3:20 pm
Edit2:
The documentation at docs.espressif.com still seems to list how the CMake build system worked up until at least commit 6fd535c98, not how it now works?
ReadTheDocs made some internal changes which broke our documentation builds. If you look at the build-system-cmake.rst file in the ESP-IDF source, this has up to date material. We're working on fixing the website docs build now.
permal wrote:
Wed May 22, 2019 3:20 pm
I've tried updating my framework to use IDF as a lib using the new idf_build_process(), but I can't seen to get it to include such things as lwip (sys/socket.h no longer found when building). I tried adding "lwip" to the COMPONENTS argument, but that doesn't help.

Also, my framework has an IDF-component that I've previously added using IDF_EXTRA_COMPONENT_DIRS. Is that still how it is supposed to be done?
Is it possible for you to share this project with us somewhere?

permal
Posts: 384
Joined: Sun May 14, 2017 5:36 pm

Re: Compatibility between "normal CMake" and ESP-IDF

Postby permal » Fri May 31, 2019 7:16 am

Angus,

My project can be found here. The master branch currently does not build with the latest IDF, you'll have to go back to before the last CMake changes, some two weeks back.

On the branch feature/31-update-to-idf-master I think I've now gotten as far as to get IDF to build (including lwip), but like stated above, but it doesn't pick up my IDF-component, hence sdkconfig.h is missing my options.

If it matters, I always build in a "build" folder beneath the projects root folder, i.e. "cmake .. -DCMAKE_BUILD_TYPE=Debug -DTARGET=ESP32 ....." or "idf.py build .."

Using the the root CMakeLists.txt, the Smooth library will be built, which is then uselinked in by the test-project which is specified in the CMakeLists.txt, currently the HTTP server as the "main" project. If you have a look at the the single commit in the above mentioned branch, you'll see what files are relevant.

ESP_renz
Posts: 18
Joined: Tue May 14, 2019 2:41 am

Re: Compatibility between "normal CMake" and ESP-IDF

Postby ESP_renz » Fri May 31, 2019 8:19 am

Apologies in the late response.
Do you have a summary of changes made?
The main things are:

- Formalize an API (properties + commands) for implementing projects on top of ESP-IDF build system. This is documented in the 'ESP-IDF CMake Build System API' section of build-system-cmake.rst (https://github.com/espressif/esp-idf/bl ... system-api)
- Made some changes internally to make it possible to plainly link ESP-IDF libraries (prefixed with idf:: in the example) to other targets.
How are components supposed to be added now?
To add a component, you can use idf_build_component(<path-to-component>).

permal
Posts: 384
Joined: Sun May 14, 2017 5:36 pm

Re: Compatibility between "normal CMake" and ESP-IDF

Postby permal » Fri May 31, 2019 9:17 am

ESP_renz wrote:
Fri May 31, 2019 8:19 am
To add a component, you can use idf_build_component(<path-to-component>).
Ok, so EXTRA_COMPONENT_DIRS is depricated? Will try this out this evening.

Thanks.

permal
Posts: 384
Joined: Sun May 14, 2017 5:36 pm

Re: Compatibility between "normal CMake" and ESP-IDF

Postby permal » Sat Jun 01, 2019 11:12 am

idf_build_component, that seems to work.

However, I'm now stuck in a situation that I think we were in when the CMake build system first was introduced - the final executable/elf isn't linked against the pre-built libraries shipped with IDF (such as libnet80211.a). I can't remember what was done about this. The final linker command and error output is below.

libnet80211 is part for the command, but its only specified as -lnet80211, not the full path like libhal.a if that matters. I tried adding target_link_libraries(${PROJECT_NAME} "$ENV{IDF_PATH}/components/esp_wifi/lib_esp32/libnet80211.a") but that doesn't help (and I believe there are linker scripts that needs to be added too?).

Current code can be found here.

Code: Select all

cd /home/permal/electronics/IO-Card-G3/software/externals/smooth/build/test/main && /usr/local/bin/cmake -E cmake_link_script CMakeFiles/smooth_test.dir/link.txt --verbose=1
/home/permal/esp/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++  -mlongcalls -Wno-frame-address  -nostdlib CMakeFiles/smooth_test.dir/generated_test.cpp.obj  -o ../../smooth_test ../../lib/smooth/libsmooth.a ../http_server_test/libhttp_server_test.a ../../lib/smooth/libsmooth.a ../../esp-idf/esp_wifi/libesp_wifi.a ../../esp-idf/esp32/libesp32.a ../../esp-idf/freertos/libfreertos.a ../../esp-idf/fatfs/libfatfs.a ../../esp-idf/wear_levelling/libwear_levelling.a ../../esp-idf/sdmmc/libsdmmc.a ../../esp-idf/sdmmc/libsdmmc.a ../../esp-idf/spi_flash/libspi_flash.a ../../esp-idf/nvs_flash/libnvs_flash.a ../../esp-idf/wear_levelling/libwear_levelling.a ../../esp-idf/libsodium/liblibsodium.a ../../esp-idf/lwip/liblwip.a ../../esp-idf/json/libjson.a ../../esp-idf/mbedtls/libmbedtls.a ../../esp-idf/xtensa/libxtensa.a ../../esp-idf/cxx/libcxx.a ../../esp-idf/newlib/libnewlib.a ../../esp-idf/freertos/libfreertos.a ../../esp-idf/heap/libheap.a ../../esp-idf/log/liblog.a ../../esp-idf/soc/libsoc.a ../../esp-idf/esp_rom/libesp_rom.a ../../esp-idf/esp_common/libesp_common.a ../../esp-idf/xtensa/libxtensa.a ../../esp-idf/esp32/libesp32.a ../../esp-idf/app_update/libapp_update.a ../../esp-idf/driver/libdriver.a ../../esp-idf/esp_event/libesp_event.a ../../esp-idf/efuse/libefuse.a ../../esp-idf/pthread/libpthread.a ../../esp-idf/app_trace/libapp_trace.a ../../esp-idf/spi_flash/libspi_flash.a ../../esp-idf/mbedtls/libmbedtls.a ../../esp-idf/vfs/libvfs.a ../../esp-idf/esp_wifi/libesp_wifi.a ../../esp-idf/mbedtls/mbedtls/library/libmbedtls.a ../../esp-idf/mbedtls/mbedtls/library/libmbedcrypto.a ../../esp-idf/mbedtls/mbedtls/library/libmbedx509.a ../../esp-idf/lwip/liblwip.a ../../esp-idf/bootloader_support/libbootloader_support.a ../../esp-idf/esp_ringbuf/libesp_ringbuf.a ../../esp-idf/tcpip_adapter/libtcpip_adapter.a ../../esp-idf/ethernet/libethernet.a ../../esp-idf/cxx/libcxx.a ../../esp-idf/newlib/libnewlib.a ../../esp-idf/freertos/libfreertos.a ../../esp-idf/heap/libheap.a ../../esp-idf/log/liblog.a ../../esp-idf/soc/libsoc.a ../../esp-idf/esp_rom/libesp_rom.a ../../esp-idf/esp_common/libesp_common.a ../../esp-idf/xtensa/libxtensa.a ../../esp-idf/esp32/libesp32.a ../../esp-idf/app_update/libapp_update.a ../../esp-idf/driver/libdriver.a ../../esp-idf/esp_event/libesp_event.a ../../esp-idf/efuse/libefuse.a ../../esp-idf/pthread/libpthread.a ../../esp-idf/app_trace/libapp_trace.a ../../esp-idf/spi_flash/libspi_flash.a ../../esp-idf/mbedtls/libmbedtls.a ../../esp-idf/vfs/libvfs.a ../../esp-idf/esp_wifi/libesp_wifi.a ../../esp-idf/mbedtls/mbedtls/library/libmbedtls.a ../../esp-idf/mbedtls/mbedtls/library/libmbedcrypto.a ../../esp-idf/mbedtls/mbedtls/library/libmbedx509.a ../../esp-idf/lwip/liblwip.a ../../esp-idf/bootloader_support/libbootloader_support.a ../../esp-idf/esp_ringbuf/libesp_ringbuf.a ../../esp-idf/tcpip_adapter/libtcpip_adapter.a ../../esp-idf/ethernet/libethernet.a -lstdc++ -u __cxa_guard_dummy -lc -lm ../../esp-idf/newlib/libnewlib.a -u newlib_include_locks_impl -u newlib_include_heap_impl -u newlib_include_syscalls_impl -Wl,--undefined=uxTopUsedPriority -L /home/permal/esp/esp-idf/components/esp_rom/esp32/ld -T esp32.rom.ld -T esp32.rom.libgcc.ld -T esp32.rom.syscalls.ld -T esp32.rom.newlib-data.ld -Wl,--gc-sections -L /home/permal/electronics/IO-Card-G3/software/externals/smooth/build/esp-idf/esp32 -T esp32_out.ld -u app_main -L /home/permal/esp/esp-idf/components/esp32/ld -T esp32.extram.bss.ld -T esp32.project.ld.in.ld -T esp32.peripherals.ld -lgcc -u call_user_start_cpu0 -u ld_include_panic_highint_hdl -u esp_app_desc -lgcov -L /home/permal/esp/esp-idf/components/esp_wifi/lib_esp32 -lcoexist -lcore -lespnow -lmesh -lnet80211 -lphy -lpp -lrtc -lsmartconfig -lwpa2 -lwpa -lwps /home/permal/esp/esp-idf/components/xtensa/esp32/libhal.a

Code: Select all

/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../../esp-idf/esp32/libesp32.a(esp_adapter.c.obj): in function `semphr_delete_wrapper':
/home/permal/esp/esp-idf/components/esp32/esp_adapter.c:222: undefined reference to `sc_ack_send'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../../esp-idf/esp32/libesp32.a(esp_adapter.c.obj): in function `sc_ack_send_wrapper':
/home/permal/esp/esp-idf/components/esp32/esp_adapter.c:433: undefined reference to `os_get_time'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/permal/esp/esp-idf/components/esp32/esp_adapter.c:432: undefined reference to `sc_ack_send'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../../esp-idf/esp32/libesp32.a(esp_adapter.c.obj): in function `get_time_wrapper':
/home/permal/esp/esp-idf/components/esp32/esp_adapter.c:403: undefined reference to `os_get_time'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../../esp-idf/esp32/libesp32.a(esp_adapter.c.obj):(.data.g_wifi_osi_funcs+0x110): undefined reference to `os_get_random'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../../esp-idf/esp32/libesp32.a(esp_adapter.c.obj):(.data.g_wifi_osi_funcs+0x118): undefined reference to `os_random'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../../esp-idf/esp32/libesp32.a(esp_adapter.c.obj):(.data.g_wifi_osi_funcs+0x160): undefined reference to `sc_ack_send_stop'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/permal/esp/esp-idf/components/esp_wifi/lib_esp32/libnet80211.a(ieee80211_api.o):(.text.wifi_deinit_in_caller_task+0x4): undefined reference to `misc_nvs_deinit'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/permal/esp/esp-idf/components/esp_wifi/lib_esp32/libnet80211.a(ieee80211_api.o):(.text.wifi_deinit_in_caller_task+0x11): undefined reference to `misc_nvs_deinit'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/permal/esp/esp-idf/components/esp_wifi/lib_esp32/libnet80211.a(ieee80211_api.o):(.text.wifi_init_in_caller_task+0xc): undefined reference to `misc_nvs_init'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/permal/esp/esp-idf/components/esp_wifi/lib_esp32/libnet80211.a(ieee80211_api.o): in function `wifi_init_in_caller_task':
(.text.wifi_init_in_caller_task+0x80): undefined reference to `misc_nvs_init'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/permal/esp/esp-idf/components/esp_wifi/lib_esp32/libnet80211.a(ieee80211_api.o):(.text.wifi_osi_funcs_register+0x10): undefined reference to `net80211_printf'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/permal/esp/esp-idf/components/esp_wifi/lib_esp32/libnet80211.a(ieee80211_api.o): in function `wifi_osi_funcs_register':
(.text.wifi_osi_funcs_register+0x3a): undefined reference to `net80211_printf'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: (.text.wifi_osi_funcs_register+0x54): undefined reference to `net80211_printf'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/permal/esp/esp-idf/components/esp_wifi/lib_esp32/libphy.a(phy_chip_v7_ana.o):(.text.ram_wait_rfpll_cal_end+0x4): undefined reference to `phy_printf'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/permal/esp/esp-idf/components/esp_wifi/lib_esp32/libphy.a(phy_chip_v7_ana.o): in function `ram_wait_rfpll_cal_end':
(.text.ram_wait_rfpll_cal_end+0x36): undefined reference to `phy_printf'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/permal/esp/esp-idf/components/esp_wifi/lib_esp32/libphy.a(phy_chip_v7_ana.o): in function `set_channel_rfpll_freq':
(.text.set_channel_rfpll_freq+0x43): undefined reference to `phy_printf'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/permal/esp/esp-idf/components/esp_wifi/lib_esp32/libphy.a(phy_chip_v7.o): in function `ram_gen_rx_gain_table':
(.text.ram_gen_rx_gain_table+0xfc): undefined reference to `phy_printf'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: (.text.ram_gen_rx_gain_table+0x116): undefined reference to `phy_printf'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/permal/esp/esp-idf/components/esp_wifi/lib_esp32/libphy.a(phy_chip_v7.o):(.text.set_rx_gain_cal_iq+0x204): more undefined references to `phy_printf' follow
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/permal/esp/esp-idf/components/esp_wifi/lib_esp32/libpp.a(pp.o):(.wifi0iram.9+0x4): undefined reference to `coex_params'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../http_server_test/libhttp_server_test.a(http_server_test.cpp.obj):(.literal._ZSt9use_facetIKSt5ctypeIcEERKT_RKSt6locale[std::ctype<char> const& std::use_facet<std::ctype<char> const>(std::locale const&)]+0x4): undefined reference to `typeinfo for std::ctype<char>'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../http_server_test/libhttp_server_test.a(http_server_test.cpp.obj):(.literal._ZSt9use_facetIKSt5ctypeIcEERKT_RKSt6locale[std::ctype<char> const& std::use_facet<std::ctype<char> const>(std::locale const&)]+0x8): undefined reference to `typeinfo for std::locale::facet'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/permal/esp/esp-idf/components/esp_wifi/lib_esp32/libnet80211.a(ieee80211_hostap.o):(.text.hostap_input+0x0): undefined reference to `g_log_mod'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/permal/esp/esp-idf/components/esp_wifi/lib_esp32/libnet80211.a(ieee80211_ioctl.o):(.text.wifi_set_wps_type_process+0x4): undefined reference to `g_misc_nvs'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/permal/esp/esp-idf/components/esp_wifi/lib_esp32/libnet80211.a(ieee80211_ioctl.o):(.text.wifi_station_set_config_local_2+0x4): undefined reference to `strnlen'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/permal/esp/esp-idf/components/esp_wifi/lib_esp32/libnet80211.a(ieee80211_ioctl.o):(.text.wifi_station_set_config_local_2+0x14): undefined reference to `strnlen'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/permal/esp/esp-idf/components/esp_wifi/lib_esp32/libnet80211.a(ieee80211_ioctl.o):(.text.wifi_set_config_process+0x54): undefined reference to `strnlen'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/permal/esp/esp-idf/components/esp_wifi/lib_esp32/libnet80211.a(ieee80211_ioctl.o): in function `wifi_set_config_process':
(.text.wifi_set_config_process+0x3c4): undefined reference to `strnlen'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: (.text.wifi_set_config_process+0x53f): undefined reference to `strnlen'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/permal/esp/esp-idf/components/esp_wifi/lib_esp32/libnet80211.a(ieee80211_ioctl.o):(.text.wifi_set_config_process+0x8da): more undefined references to `strnlen' follow
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/permal/esp/esp-idf/components/esp_wifi/lib_esp32/libnet80211.a(ieee80211_ioctl.o):(.text.wifi_restore_process+0x0): undefined reference to `misc_nvs_restore'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/permal/esp/esp-idf/components/esp_wifi/lib_esp32/libnet80211.a(ieee80211_ioctl.o):(.text.wifi_restore_process+0x7): undefined reference to `misc_nvs_restore'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/permal/esp/esp-idf/components/esp_wifi/lib_esp32/libnet80211.a(ieee80211_scan.o):(.text.scan_op_start+0x0): undefined reference to `coex_params'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../../lib/smooth/libsmooth.a(Task.cpp.obj):(.rodata+0x228): undefined reference to `typeinfo for std::thread::_State'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../../esp-idf/esp_wifi/libesp_wifi.a(fast_crypto_ops.c.obj):(.rodata.g_wifi_default_wpa_crypto_funcs+0x8): undefined reference to `fast_aes_wrap'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../../esp-idf/esp_wifi/libesp_wifi.a(fast_crypto_ops.c.obj):(.rodata.g_wifi_default_wpa_crypto_funcs+0xc): undefined reference to `fast_aes_unwrap'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../../esp-idf/esp_wifi/libesp_wifi.a(fast_crypto_ops.c.obj):(.rodata.g_wifi_default_wpa_crypto_funcs+0x10): undefined reference to `fast_hmac_sha256_vector'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../../esp-idf/esp_wifi/libesp_wifi.a(fast_crypto_ops.c.obj):(.rodata.g_wifi_default_wpa_crypto_funcs+0x14): undefined reference to `fast_sha256_prf'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../../esp-idf/esp_wifi/libesp_wifi.a(fast_crypto_ops.c.obj):(.rodata.g_wifi_default_wpa_crypto_funcs+0x18): undefined reference to `hmac_md5'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../../esp-idf/esp_wifi/libesp_wifi.a(fast_crypto_ops.c.obj):(.rodata.g_wifi_default_wpa_crypto_funcs+0x1c): undefined reference to `hmac_md5_vector'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../../esp-idf/esp_wifi/libesp_wifi.a(fast_crypto_ops.c.obj):(.rodata.g_wifi_default_wpa_crypto_funcs+0x20): undefined reference to `hmac_sha1'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../../esp-idf/esp_wifi/libesp_wifi.a(fast_crypto_ops.c.obj):(.rodata.g_wifi_default_wpa_crypto_funcs+0x24): undefined reference to `hmac_sha1_vector'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../../esp-idf/esp_wifi/libesp_wifi.a(fast_crypto_ops.c.obj):(.rodata.g_wifi_default_wpa_crypto_funcs+0x28): undefined reference to `sha1_prf'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../../esp-idf/esp_wifi/libesp_wifi.a(fast_crypto_ops.c.obj):(.rodata.g_wifi_default_wpa_crypto_funcs+0x2c): undefined reference to `sha1_vector'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../../esp-idf/esp_wifi/libesp_wifi.a(fast_crypto_ops.c.obj):(.rodata.g_wifi_default_wpa_crypto_funcs+0x30): undefined reference to `pbkdf2_sha1'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../../esp-idf/esp_wifi/libesp_wifi.a(fast_crypto_ops.c.obj):(.rodata.g_wifi_default_wpa_crypto_funcs+0x34): undefined reference to `rc4_skip'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../../esp-idf/esp_wifi/libesp_wifi.a(fast_crypto_ops.c.obj):(.rodata.g_wifi_default_wpa_crypto_funcs+0x38): undefined reference to `md5_vector'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../../esp-idf/esp_wifi/libesp_wifi.a(fast_crypto_ops.c.obj):(.rodata.g_wifi_default_wpa_crypto_funcs+0x3c): undefined reference to `aes_encrypt'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../../esp-idf/esp_wifi/libesp_wifi.a(fast_crypto_ops.c.obj):(.rodata.g_wifi_default_wpa_crypto_funcs+0x40): undefined reference to `aes_encrypt_init'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../../esp-idf/esp_wifi/libesp_wifi.a(fast_crypto_ops.c.obj):(.rodata.g_wifi_default_wpa_crypto_funcs+0x44): undefined reference to `aes_encrypt_deinit'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../../esp-idf/esp_wifi/libesp_wifi.a(fast_crypto_ops.c.obj):(.rodata.g_wifi_default_wpa_crypto_funcs+0x48): undefined reference to `aes_decrypt'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../../esp-idf/esp_wifi/libesp_wifi.a(fast_crypto_ops.c.obj):(.rodata.g_wifi_default_wpa_crypto_funcs+0x4c): undefined reference to `aes_decrypt_init'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: ../../esp-idf/esp_wifi/libesp_wifi.a(fast_crypto_ops.c.obj):(.rodata.g_wifi_default_wpa_crypto_funcs+0x50): undefined reference to `aes_decrypt_deinit'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/permal/esp/esp-idf/components/esp_wifi/lib_esp32/libnet80211.a(ieee80211.o):(.text.wifi_mode_set+0x0): undefined reference to `g_log_level'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/permal/esp/esp-idf/components/esp_wifi/lib_esp32/libwpa.a(wpa_auth.o):(.text.wpa_group_config_group_keys$isra$10+0x0): undefined reference to `wep'
/home/permal/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/permal/esp/esp-idf/components/esp_wifi/lib_esp32/libwpa.a(wpa_auth.o):(.text.wpa_group_config_group_keys$isra$10+0x4): undefined reference to `tkip'

permal
Posts: 384
Joined: Sun May 14, 2017 5:36 pm

Re: Compatibility between "normal CMake" and ESP-IDF

Postby permal » Sun Jun 02, 2019 8:53 am

Ok, I've reproduced the problem using a minimal project based off the official IDF-examples and filed an issue for it.

ESP_renz
Posts: 18
Joined: Tue May 14, 2019 2:41 am

Re: Compatibility between "normal CMake" and ESP-IDF

Postby ESP_renz » Mon Jun 03, 2019 3:46 am

Ok, so EXTRA_COMPONENT_DIRS is depricated? Will try this out this evening.
So one of the changes is we separated factored out a 'core build system'. This 'core build system' is the one defined in https://github.com/espressif/esp-idf/bl ... system-api with the formalized commands and properties.

Standard app projects, like ones cut out from the esp-idf-template, are implemented on top of the 'core build system'. In the case of `EXTRA_COMPONENT_DIRS, it's just translated to calling `idf_build_component` for each of the members of the list.

Users who want more control, and want to create a custom CMake project, can make use of the `core build system` API directly.

For the link issue, I've responded to it on Github. Below is a copy-pasta of my response:
Just to give some context, as you may have observed with the changes we've been making to our build system, we're sort of relinquishing control of how ESP-IDF libraries are linked to external libraries/executables (whereareas the previous implementation required idf_link_components). This allows users to plainly link ESP-IDF component libraries to their own targets; with build specifications and usage requirements of its dependencies, and the dependencies of its dependencies, still propagating properly.

This also means moving away from linking ESP-IDF libraries inside a link group. This previously hid flaws in dependency relationship between components (via COMPONENT_REQUIRES and COMPONENT_PRIV_REQUIRES) and how we handle linking standard libraries and pre-built libraries. With this transition, we're expecting some 'undefined reference to xxx' link errors, so please bear with us :

Who is online

Users browsing this forum: Majestic-12 [Bot], markkuk and 85 guests