Page 1 of 1

ld.exe: cannot open linker script file sections.ld

Posted: Tue Dec 20, 2022 11:30 am
by julienD
hello,

I'm building an app that aims to integrate LoRamac-node library.
It's a pretty big CMake configuration. That I try to integrate using this document:
https://docs.espressif.com/projects/esp ... components

Linking generates the below error:

Code: Select all

ld.exe: cannot open linker script file sections.ld: No such file or directory
I checked that sections.ld does not exists anywhere.
Partitions are set by sdkconfig. Single factory app, no OTA.

I found in other personnal projects that sections.ld should be generated in build/esp-idf/esp_system/ld directory.

Can you give me any clue of what I should check to understand what's happening?

Environement:
EPS32C3
W64 + VSCode,
ESP-IDF 4.4.3.

Here's the full build log:

Code: Select all

-- Found Git: C:/espressif443/tools/idf-git/2.30.1/cmd/git.exe (found version "2.30.1.windows.1") 
-- The C compiler identification is GNU 8.4.0
-- The CXX compiler identification is GNU 8.4.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/espressif443/tools/riscv32-esp-elf/esp-2021r2-patch5-8.4.0/riscv32-esp-elf/bin/riscv32-esp-elf-gcc.exe
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/espressif443/tools/riscv32-esp-elf/esp-2021r2-patch5-8.4.0/riscv32-esp-elf/bin/riscv32-esp-elf-gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/espressif443/tools/riscv32-esp-elf/esp-2021r2-patch5-8.4.0/riscv32-esp-elf/bin/riscv32-esp-elf-g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32c3
-- Project sdkconfig file D:/Dev/XXX/POC-ESP32/POC-ESP32/sdkconfig
Loading defaults file D:/Dev/XXX/POC-ESP32/POC-ESP32/sdkconfig.defaults...
Loading defaults file D:/Dev/XXX/POC-ESP32/POC-ESP32/sdkconfig.defaults.esp32c3...
-- Found Python3: C:/espressif443/python_env/idf4.4_py3.8_env/Scripts/python.exe (found version "3.8.7") found components: Interpreter 
-- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS
-- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS - Success
-- App "ESP32POC" version: 8bb6f1d-dirty
-- Adding linker script D:/Dev/XXX/POC-ESP32/POC-ESP32/build/esp-idf/esp_system/ld/memory.ld
-- Adding linker script C:/Users/ju/esp443/esp-idf/components/esp_system/ld/esp32c3/sections.ld.in    
-- Adding linker script C:/Users/ju/esp443/esp-idf/components/esp_rom/esp32c3/ld/esp32c3.rom.ld       
-- Adding linker script C:/Users/ju/esp443/esp-idf/components/esp_rom/esp32c3/ld/esp32c3.rom.api.ld   
-- Adding linker script C:/Users/ju/esp443/esp-idf/components/esp_rom/esp32c3/ld/esp32c3.rom.libgcc.ld
-- Adding linker script C:/Users/ju/esp443/esp-idf/components/esp_rom/esp32c3/ld/esp32c3.rom.newlib.ld     
-- Adding linker script C:/Users/ju/esp443/esp-idf/components/esp_rom/esp32c3/ld/esp32c3.rom.version.ld    
-- Adding linker script C:/Users/ju/esp443/esp-idf/components/esp_rom/esp32c3/ld/esp32c3.rom.newlib-time.ld
-- Adding linker script C:/Users/ju/esp443/esp-idf/components/esp_rom/esp32c3/ld/esp32c3.rom.eco3.ld       
-- Adding linker script C:/Users/ju/esp443/esp-idf/components/soc/esp32c3/ld/esp32c3.peripherals.ld
---------------------------------------------------
-- Components: app_trace app_update asio bootloader bootloader_support bt cbor cmock coap console cxx driver efuse esp-tls esp32c3 esp_adc_cal esp_common esp_eth esp_event esp_gdbstub esp_hid esp_http_client esp_http_server esp_https_ota esp_https_server esp_hw_support esp_ipc esp_lcd esp_local_ctrl esp_netif esp_phy esp_pm esp_ringbuf esp_rom esp_serial_slave_link esp_system esp_timer esp_websocket_client esp_wifi espcoredump esptool_py expat fatfs freemodbus freertos hal heap idf_test ieee802154 jsmn json libsodium log lwip main mbedtls mdns mqtt newlib nghttp nvs_flash openssl openthread partition_table protobuf-c protocomm pthread riscv sdmmc soc spi_flash spiffs tcp_transport tcpip_adapter tinyusb unity usb vfs wear_levelling wifi_provisioning wpa_supplicant
-- Component paths: C:/Users/ju/esp443/esp-idf/components/app_trace C:/Users/ju/esp443/esp-idf/components/app_update C:/Users/ju/esp443/esp-idf/components/asio C:/Users/ju/esp443/esp-idf/components/bootloader C:/Users/ju/esp443/esp-idf/components/bootloader_support C:/Users/ju/esp443/esp-idf/components/bt C:/Users/ju/esp443/esp-idf/components/cbor C:/Users/ju/esp443/esp-idf/components/cmock C:/Users/ju/esp443/esp-idf/components/coap C:/Users/ju/esp443/esp-idf/components/console C:/Users/ju/esp443/esp-idf/components/cxx C:/Users/ju/esp443/esp-idf/components/driver C:/Users/ju/esp443/esp-idf/components/efuse C:/Users/ju/esp443/esp-idf/components/esp-tls C:/Users/ju/esp443/esp-idf/components/esp32c3 C:/Users/ju/esp443/esp-idf/components/esp_adc_cal C:/Users/ju/esp443/esp-idf/components/esp_common C:/Users/ju/esp443/esp-idf/components/esp_eth C:/Users/ju/esp443/esp-idf/components/esp_event C:/Users/ju/esp443/esp-idf/components/esp_gdbstub C:/Users/ju/esp443/esp-idf/components/esp_hid C:/Users/ju/esp443/esp-idf/components/esp_http_client C:/Users/ju/esp443/esp-idf/components/esp_http_server C:/Users/ju/esp443/esp-idf/components/esp_https_ota C:/Users/ju/esp443/esp-idf/components/esp_https_server C:/Users/ju/esp443/esp-idf/components/esp_hw_support C:/Users/ju/esp443/esp-idf/components/esp_ipc C:/Users/ju/esp443/esp-idf/components/esp_lcd C:/Users/ju/esp443/esp-idf/components/esp_local_ctrl C:/Users/ju/esp443/esp-idf/components/esp_netif C:/Users/ju/esp443/esp-idf/components/esp_phy C:/Users/ju/esp443/esp-idf/components/esp_pm C:/Users/ju/esp443/esp-idf/components/esp_ringbuf C:/Users/ju/esp443/esp-idf/components/esp_rom C:/Users/ju/esp443/esp-idf/components/esp_serial_slave_link C:/Users/ju/esp443/esp-idf/components/esp_system C:/Users/ju/esp443/esp-idf/components/esp_timer C:/Users/ju/esp443/esp-idf/components/esp_websocket_client C:/Users/ju/esp443/esp-idf/components/esp_wifi C:/Users/ju/esp443/esp-idf/components/espcoredump C:/Users/ju/esp443/esp-idf/components/esptool_py C:/Users/ju/esp443/esp-idf/components/expat C:/Users/ju/esp443/esp-idf/components/fatfs C:/Users/ju/esp443/esp-idf/components/freemodbus C:/Users/ju/esp443/esp-idf/components/freertos C:/Users/ju/esp443/esp-idf/components/hal C:/Users/ju/esp443/esp-idf/components/heap C:/Users/ju/esp443/esp-idf/components/idf_test C:/Users/ju/esp443/esp-idf/components/ieee802154 C:/Users/ju/esp443/esp-idf/components/jsmn C:/Users/ju/esp443/esp-idf/components/json C:/Users/ju/esp443/esp-idf/components/libsodium C:/Users/ju/esp443/esp-idf/components/log C:/Users/ju/esp443/esp-idf/components/lwip D:/Dev/XXX/POC-ESP32/POC-ESP32/main C:/Users/ju/esp443/esp-idf/components/mbedtls C:/Users/ju/esp443/esp-idf/components/mdns C:/Users/ju/esp443/esp-idf/components/mqtt C:/Users/ju/esp443/esp-idf/components/newlib C:/Users/ju/esp443/esp-idf/components/nghttp C:/Users/ju/esp443/esp-idf/components/nvs_flash C:/Users/ju/esp443/esp-idf/components/openssl C:/Users/ju/esp443/esp-idf/components/openthread C:/Users/ju/esp443/esp-idf/components/partition_table C:/Users/ju/esp443/esp-idf/components/protobuf-c C:/Users/ju/esp443/esp-idf/components/protocomm C:/Users/ju/esp443/esp-idf/components/pthread C:/Users/ju/esp443/esp-idf/components/riscv C:/Users/ju/esp443/esp-idf/components/sdmmc C:/Users/ju/esp443/esp-idf/components/soc C:/Users/ju/esp443/esp-idf/components/spi_flash C:/Users/ju/esp443/esp-idf/components/spiffs C:/Users/ju/esp443/esp-idf/components/tcp_transport C:/Users/ju/esp443/esp-idf/components/tcpip_adapter C:/Users/ju/esp443/esp-idf/components/tinyusb C:/Users/ju/esp443/esp-idf/components/unity C:/Users/ju/esp443/esp-idf/components/usb C:/Users/ju/esp443/esp-idf/components/vfs C:/Users/ju/esp443/esp-idf/components/wear_levelling C:/Users/ju/esp443/esp-idf/components/wifi_provisioning C:/Users/ju/esp443/esp-idf/components/wpa_supplicant
-- Configuring done
-- Generating done
-- Build files have been written to: D:/Dev/XXX/POC-ESP32/POC-ESP32/build

 *  Executing task: ninja  

[67/1340] Generating ../../partition_table/partition-table.bin
Partition table binary generated. Contents:
*******************************************************************************
# ESP-IDF Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs,data,nvs,0x9000,24K,
phy_init,data,phy,0xf000,4K,
factory,app,factory,0x10000,1M,
*******************************************************************************
[659/1340] Performing configure step for 'bootloader'
-- Found Git: C:/espressif443/tools/idf-git/2.30.1/cmd/git.exe (found version "2.30.1.windows.1")
-- The C compiler identification is GNU 8.4.0
-- The CXX compiler identification is GNU 8.4.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/espressif443/tools/riscv32-esp-elf/esp-2021r2-patch5-8.4.0/riscv32-esp-elf/bin/riscv32-esp-elf-gcc.exe
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/espressif443/tools/riscv32-esp-elf/esp-2021r2-patch5-8.4.0/riscv32-esp-elf/bin/riscv32-esp-elf-gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/espressif443/tools/riscv32-esp-elf/esp-2021r2-patch5-8.4.0/riscv32-esp-elf/bin/riscv32-esp-elf-g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32c3
-- Project sdkconfig file D:/Dev/XXX/POC-ESP32/POC-ESP32/sdkconfig
-- Adding linker script C:/Users/ju/esp443/esp-idf/components/soc/esp32c3/ld/esp32c3.peripherals.ld
-- Adding linker script C:/Users/ju/esp443/esp-idf/components/esp_rom/esp32c3/ld/esp32c3.rom.ld
-- Adding linker script C:/Users/ju/esp443/esp-idf/components/esp_rom/esp32c3/ld/esp32c3.rom.api.ld
-- Adding linker script C:/Users/ju/esp443/esp-idf/components/esp_rom/esp32c3/ld/esp32c3.rom.libgcc.ld
-- Adding linker script C:/Users/ju/esp443/esp-idf/components/esp_rom/esp32c3/ld/esp32c3.rom.newlib.ld
-- Adding linker script C:/Users/ju/esp443/esp-idf/components/bootloader/subproject/main/ld/esp32c3/bootloader.ld
-- Adding linker script C:/Users/ju/esp443/esp-idf/components/bootloader/subproject/main/ld/esp32c3/bootloader.rom.ld
-- Components: bootloader bootloader_support efuse esp32c3 esp_common esp_hw_support esp_rom esp_system esptool_py freertos hal log main micro-ecc newlib partition_table riscv soc spi_flash
-- Component paths: C:/Users/ju/esp443/esp-idf/components/bootloader C:/Users/ju/esp443/esp-idf/components/bootloader_support C:/Users/ju/esp443/esp-idf/components/efuse C:/Users/ju/esp443/esp-idf/components/esp32c3 C:/Users/ju/esp443/esp-idf/components/esp_common C:/Users/ju/esp443/esp-idf/components/esp_hw_support C:/Users/ju/esp443/esp-idf/components/esp_rom C:/Users/ju/esp443/esp-idf/components/esp_system C:/Users/ju/esp443/esp-idf/components/esptool_py C:/Users/ju/esp443/esp-idf/components/freertos C:/Users/ju/esp443/esp-idf/components/hal C:/Users/ju/esp443/esp-idf/components/log C:/Users/ju/esp443/esp-idf/components/bootloader/subproject/main C:/Users/ju/esp443/esp-idf/components/bootloader/subproject/components/micro-ecc C:/Users/ju/esp443/esp-idf/components/newlib C:/Users/ju/esp443/esp-idf/components/partition_table C:/Users/ju/esp443/esp-idf/components/riscv C:/Users/ju/esp443/esp-idf/components/soc C:/Users/ju/esp443/esp-idf/components/spi_flash
-- Configuring done
-- Generating done
-- Build files have been written to: D:/Dev/XXX/POC-ESP32/POC-ESP32/build/bootloader
[839/1340] Performing build step for 'bootloader'
[1/89] Generating project_elf_src_esp32c3.c
[2/89] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/lldesc.c.obj
[3/89] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/soc_include_legacy_warn.c.obj
[4/89] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c3/spi_periph.c.obj
[5/89] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c3/gdma_periph.c.obj
[6/89] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c3/adc_periph.c.obj
[7/89] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c3/gpio_periph.c.obj
[8/89] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/mpu_hal.c.obj
[9/89] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/wdt_hal_iram.c.obj
[10/89] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/cpu_hal.c.obj
[11/89] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c3/interrupts.c.obj
[12/89] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c3/timer_periph.c.obj
[13/89] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c3/dedic_gpio_periph.c.obj
[14/89] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c3/sigmadelta_periph.c.obj
[15/89] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c3/rmt_periph.c.obj
[16/89] Building C object CMakeFiles/bootloader.elf.dir/project_elf_src_esp32c3.c.obj
[17/89] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c3/i2c_periph.c.obj
[18/89] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c3/i2s_periph.c.obj
[19/89] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c3/ledc_periph.c.obj
[20/89] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c3/uart_periph.c.obj
[21/89] Building C object esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/esp32c3/spi_flash_rom_patch.c.obj
[22/89] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_efuse_esp32c3.c.obj
[23/89] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_partitions.c.obj
[24/89] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_flash.c.obj
[25/89] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_random_esp32c3.c.obj
[26/89] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_mem.c.obj
[27/89] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_random.c.obj
[28/89] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_clock_init.c.obj
[29/89] Building C object esp-idf/micro-ecc/CMakeFiles/__idf_micro-ecc.dir/uECC_verify_antifault.c.obj
[30/89] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_encrypt.c.obj
[31/89] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/secure_boot.c.obj
[32/89] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_clock_loader.c.obj
[33/89] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_common_loader.c.obj
[34/89] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_common.c.obj
[35/89] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_init.c.obj
[36/89] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_qio_mode.c.obj
[37/89] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_utility.c.obj
[38/89] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32c3/bootloader_sha.c.obj
[39/89] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp_image_format.c.obj
[40/89] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_console.c.obj
[41/89] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_console_loader.c.obj
[42/89] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/esp32c3/esp_efuse_fields.c.obj
[43/89] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_flash_config_esp32c3.c.obj
[44/89] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_fields.c.obj
[45/89] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32c3/bootloader_soc.c.obj
[46/89] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/esp32c3/esp_efuse_rtc_calib.c.obj
[47/89] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_panic.c.obj
[48/89] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32c3/bootloader_esp32c3.c.obj
[49/89] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/esp32c3/esp_efuse_utility.c.obj
[50/89] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/esp32c3/esp_efuse_table.c.obj
[51/89] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_utility.c.obj
[52/89] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_api.c.obj
[53/89] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_api_key_esp32xx.c.obj
[54/89] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/compare_set.c.obj
[55/89] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/cpu_util.c.obj
[56/89] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_crc.c.obj
[57/89] Building C object esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/esp_err.c.obj
[58/89] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_efuse.c.obj
[59/89] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c3/rtc_time.c.obj
[60/89] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c3/cpu_util_esp32c3.c.obj
[61/89] Building C object esp-idf/esp_common/CMakeFiles/__idf_esp_common.dir/src/esp_err_to_name.c.obj
[62/89] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c3/rtc_sleep.c.obj
[63/89] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_tjpgd.c.obj
[64/89] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c3/rtc_pm.c.obj
[65/89] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c3/rtc_clk_init.c.obj
[66/89] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c3/rtc_clk.c.obj
[67/89] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_uart.c.obj
[68/89] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_sys.c.obj
[69/89] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c3/chip_info.c.obj
[70/89] Building C object esp-idf/log/CMakeFiles/__idf_log.dir/log.c.obj
[71/89] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c3/rtc_init.c.obj
[72/89] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/bootloader_start.c.obj
[73/89] Building C object esp-idf/log/CMakeFiles/__idf_log.dir/log_buffers.c.obj
[74/89] Building C object esp-idf/log/CMakeFiles/__idf_log.dir/log_noos.c.obj
[75/89] Linking C static library esp-idf\log\liblog.a
[76/89] Linking C static library esp-idf\esp_rom\libesp_rom.a
[77/89] Linking C static library esp-idf\esp_common\libesp_common.a
[78/89] Linking C static library esp-idf\esp_hw_support\libesp_hw_support.a
[79/89] Linking C static library esp-idf\esp_system\libesp_system.a
[80/89] Linking C static library esp-idf\efuse\libefuse.a
[81/89] Linking C static library esp-idf\bootloader_support\libbootloader_support.a
[82/89] Linking C static library esp-idf\spi_flash\libspi_flash.a
[83/89] Linking C static library esp-idf\micro-ecc\libmicro-ecc.a
[84/89] Linking C static library esp-idf\soc\libsoc.a
[85/89] Linking C static library esp-idf\hal\libhal.a
[86/89] Linking C static library esp-idf\main\libmain.a
[87/89] Linking C executable bootloader.elf
[88/89] Generating binary image from built executable
esptool.py v3.3.2
Creating esp32c3 image...
Merged 1 ELF section
Successfully created esp32c3 image.
Generated D:/Dev/XXX/POC-ESP32/POC-ESP32/build/bootloader/bootloader.bin
[89/89] cmd.exe /C "cd /D D:\Dev\XXX\POC-ESP32\POC-ESP32\build\bootloader\esp-idf\esptool_py && C:\espressif443\python_env\idf4.4_py3.8_env\Scripts\python.exe C:/Users/ju/esp443/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x0 D:/Dev/XXX/POC-ESP32/POC-ESP32/build/bootloader/bootloader.bin"
Bootloader binary size 0x4d60 bytes. 0x32a0 bytes (40%) free.
[1333/1340] Linking CXX executable esp-idf\main\esp-idf
FAILED: esp-idf/main/esp-idf 
cmd.exe /C "cd . && C:\espressif443\tools\riscv32-esp-elf\esp-2021r2-patch5-8.4.0\riscv32-esp-elf\bin\riscv32-esp-elf-g++.exe -march=rv32imc -nostartfiles -march=rv32imc --specs=nosys.specs @CMakeFiles\esp-idf.rsp -o esp-idf\main\esp-idf  && cd ."
c:/espressif443/tools/riscv32-esp-elf/esp-2021r2-patch5-8.4.0/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: cannot open linker script file sections.ld: No such file or directory
collect2.exe: error: ld returned 1 exit status
[1334/1340] Building C object esp-idf/main/loramacnode/mac/CMakeFiles/mac.dir/LoRaMac.c.obj
ninja: build stopped: subcommand failed.

 *  The terminal process "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command ninja " terminated with exit code: 1. 

 

Re: ld.exe: cannot open linker script file sections.ld

Posted: Wed Dec 21, 2022 11:23 am
by julienD
Ok, after many hours, there was a call to add_executable() in a CMakeLists.txt that caused this issue.

Re: ld.exe: cannot open linker script file sections.ld

Posted: Mon Feb 19, 2024 2:02 pm
by Mehul Laliwala
I have the same issue. I had to add executable since I am trying to link libraries, which has a designator of *.a. Here is my CMake.txt.

idf_component_register(SRCS "main.c"
INCLUDE_DIRS ".")


set(BSEC_DIR "C:/Users/arora/ESPWorkspace/SensorBME688/main/bsec/algo/normal_version/bin/esp/esp32_s3")
set(BTBB_DIR "C:/Users/arora/esp/v5.1.2/esp-idf/components/esp_phy/lib/esp32s3")

add_executable(SensorBME688 main.c)

target_link_libraries(SensorBME688 PUBLIC ${BSEC_DIR}/libalgobsec.a)
target_link_libraries(SensorBME688 PUBLIC ${BTBB_DIR}/libbtbb.a)
target_link_libraries(SensorBME688 PUBLIC ${BTBB_DIR}/libphy.a)

ERROS:

[1/1] cmd.exe /C "cd /D C:\Users\arora\ESPWorkspace\SensorBME688\build\bootloader\esp-idf\esptool_py && C:\Users\arora\.espressif\python_env\idf5.1_py3.11_env\Scripts\python.exe C:/Users/arora/esp/v5.1.2/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x0 C:/Users/arora/ESPWorkspace/SensorBME688/build/bootloader/bootloader.bin"
Bootloader binary size 0x51c0 bytes. 0x2e40 bytes (36%) free.
[2/7] Linking CXX executable esp-idf\main\SensorBME688
FAILED: esp-idf/main/SensorBME688
cmd.exe /C "cd . && C:\Users\arora\.espressif\tools\xtensa-esp32s3-elf\esp-12.2.0_20230208\xtensa-esp32s3-elf\bin\xtensa-esp32s3-elf-g++.exe -mlongcalls -T esp32s3.peripherals.ld -T esp32s3.rom.ld -T esp32s3.rom.api.ld -T esp32s3.rom.libgcc.ld -T esp32s3.rom.newlib.ld -T esp32s3.rom.version.ld -T memory.ld -T sections.ld @CMakeFiles\SensorBME688.rsp -o esp-idf\main\SensorBME688 && cd ."
c:/users/arora/.espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin/../lib/gcc/xtensa-esp32s3-elf/12.2.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: cannot find -lphy: No such file or directory
c:/users/arora/.espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin/../lib/gcc/xtensa-esp32s3-elf/12.2.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: cannot find -lbtbb: No such file or directory
c:/users/arora/.espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin/../lib/gcc/xtensa-esp32s3-elf/12.2.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: cannot find -lphy: No such file or directory
c:/users/arora/.espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin/../lib/gcc/xtensa-esp32s3-elf/12.2.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: cannot find -lbtbb: No such file or directory
c:/users/arora/.espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin/../lib/gcc/xtensa-esp32s3-elf/12.2.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: cannot find -lphy: No such file or directory
c:/users/arora/.espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin/../lib/gcc/xtensa-esp32s3-elf/12.2.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: cannot find -lbtbb: No such file or directory
collect2.exe: error: ld returned 1 exit status
[3/7] Generating ld/sections.ld
ninja: build stopped: subcommand failed.

* The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command ninja " terminated with exit code: 1.