undefined reference to app_main

JeffGray
Posts: 4
Joined: Mon Oct 09, 2017 4:25 am

undefined reference to app_main

Postby JeffGray » Tue Jun 27, 2023 4:04 am

I am trying to build the espidf-hello-world example in VS code.

The build log is copied below. If you look to the end of the log you will see:
"...esp/esp-idf/components/freertos/app_startup.c:206: undefined reference to `app_main'"

I have seen various posts with similar issues with the suggestion "did you try to build the hello world example?" Well that is exactly what I am trying to do, and I have not gone very far. Suggestions?

* Executing task: cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 -B c:\Users\Jeff\Documents\PlatformIO\Projects\230626-204629-espidf-hello-world\build -S c:\Users\Jeff\Documents\PlatformIO\Projects\230626-204629-espidf-hello-world

-- Found Git: C:/Users/Jeff/.espressif/tools/idf-git/2.30.1/cmd/git.exe (found version "2.30.1.windows.1")
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/Users/Jeff/.espressif/tools/xtensa-esp32-elf/esp-12.2.0_20230208/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Users/Jeff/.espressif/tools/xtensa-esp32-elf/esp-12.2.0_20230208/xtensa-esp32-elf/bin/xtensa-esp32-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:/Users/Jeff/.espressif/tools/xtensa-esp32-elf/esp-12.2.0_20230208/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Project is not inside a git repository, or git repository has no commits; will not use 'git describe' to determine PROJECT_VER.
-- Building ESP-IDF components for target esp32
-- Project sdkconfig file C:/Users/Jeff/Documents/PlatformIO/Projects/230626-204629-espidf-hello-world/sdkconfig
Compiler supported targets: xtensa-esp32-elf

-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of time_t
-- Check size of time_t - done
-- Found Python3: C:/Users/Jeff/.espressif/python_env/idf5.1_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 "hello-world" version: 1
-- Adding linker script C:/Users/Jeff/Documents/PlatformIO/Projects/230626-204629-espidf-hello-world/build/esp-idf/esp_system/ld/memory.ld
-- Adding linker script C:/Users/Jeff/esp/esp-idf/components/esp_system/ld/esp32/sections.ld.in
-- Adding linker script C:/Users/Jeff/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script C:/Users/Jeff/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script C:/Users/Jeff/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script C:/Users/Jeff/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld
-- Adding linker script C:/Users/Jeff/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld
-- Adding linker script C:/Users/Jeff/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script C:/Users/Jeff/esp/esp-idf/components/soc/esp32/ld/esp32.peripherals.ld
-- Components: app_trace app_update bootloader bootloader_support bt cmock console cxx driver efuse esp-tls esp_adc esp_app_format esp_coex 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_lcd esp_local_ctrl esp_mm esp_netif esp_netif_stack esp_partition esp_phy esp_pm esp_psram esp_ringbuf esp_rom esp_system esp_timer esp_wifi espcoredump esptool_py fatfs freertos hal heap http_parser idf_test ieee802154 json log lwip mbedtls mqtt newlib nvs_flash openthread partition_table perfmon protobuf-c protocomm pthread sdmmc soc spi_flash spiffs tcp_transport ulp unity usb vfs wear_levelling wifi_provisioning wpa_supplicant xtensa
-- Component paths: C:/Users/Jeff/esp/esp-idf/components/app_trace C:/Users/Jeff/esp/esp-idf/components/app_update C:/Users/Jeff/esp/esp-idf/components/bootloader C:/Users/Jeff/esp/esp-idf/components/bootloader_support C:/Users/Jeff/esp/esp-idf/components/bt C:/Users/Jeff/esp/esp-idf/components/cmock C:/Users/Jeff/esp/esp-idf/components/console C:/Users/Jeff/esp/esp-idf/components/cxx C:/Users/Jeff/esp/esp-idf/components/driver C:/Users/Jeff/esp/esp-idf/components/efuse C:/Users/Jeff/esp/esp-idf/components/esp-tls C:/Users/Jeff/esp/esp-idf/components/esp_adc C:/Users/Jeff/esp/esp-idf/components/esp_app_format C:/Users/Jeff/esp/esp-idf/components/esp_coex C:/Users/Jeff/esp/esp-idf/components/esp_common C:/Users/Jeff/esp/esp-idf/components/esp_eth C:/Users/Jeff/esp/esp-idf/components/esp_event C:/Users/Jeff/esp/esp-idf/components/esp_gdbstub C:/Users/Jeff/esp/esp-idf/components/esp_hid C:/Users/Jeff/esp/esp-idf/components/esp_http_client C:/Users/Jeff/esp/esp-idf/components/esp_http_server C:/Users/Jeff/esp/esp-idf/components/esp_https_ota C:/Users/Jeff/esp/esp-idf/components/esp_https_server C:/Users/Jeff/esp/esp-idf/components/esp_hw_support C:/Users/Jeff/esp/esp-idf/components/esp_lcd C:/Users/Jeff/esp/esp-idf/components/esp_local_ctrl C:/Users/Jeff/esp/esp-idf/components/esp_mm C:/Users/Jeff/esp/esp-idf/components/esp_netif C:/Users/Jeff/esp/esp-idf/components/esp_netif_stack C:/Users/Jeff/esp/esp-idf/components/esp_partition C:/Users/Jeff/esp/esp-idf/components/esp_phy C:/Users/Jeff/esp/esp-idf/components/esp_pm C:/Users/Jeff/esp/esp-idf/components/esp_psram C:/Users/Jeff/esp/esp-idf/components/esp_ringbuf C:/Users/Jeff/esp/esp-idf/components/esp_rom C:/Users/Jeff/esp/esp-idf/components/esp_system C:/Users/Jeff/esp/esp-idf/components/esp_timer C:/Users/Jeff/esp/esp-idf/components/esp_wifi C:/Users/Jeff/esp/esp-idf/components/espcoredump C:/Users/Jeff/esp/esp-idf/components/esptool_py C:/Users/Jeff/esp/esp-idf/components/fatfs C:/Users/Jeff/esp/esp-idf/components/freertos C:/Users/Jeff/esp/esp-idf/components/hal C:/Users/Jeff/esp/esp-idf/components/heap C:/Users/Jeff/esp/esp-idf/components/http_parser C:/Users/Jeff/esp/esp-idf/components/idf_test C:/Users/Jeff/esp/esp-idf/components/ieee802154 C:/Users/Jeff/esp/esp-idf/components/json C:/Users/Jeff/esp/esp-idf/components/log C:/Users/Jeff/esp/esp-idf/components/lwip C:/Users/Jeff/esp/esp-idf/components/mbedtls C:/Users/Jeff/esp/esp-idf/components/mqtt C:/Users/Jeff/esp/esp-idf/components/newlib C:/Users/Jeff/esp/esp-idf/components/nvs_flash C:/Users/Jeff/esp/esp-idf/components/openthread C:/Users/Jeff/esp/esp-idf/components/partition_table C:/Users/Jeff/esp/esp-idf/components/perfmon C:/Users/Jeff/esp/esp-idf/components/protobuf-c C:/Users/Jeff/esp/esp-idf/components/protocomm C:/Users/Jeff/esp/esp-idf/components/pthread C:/Users/Jeff/esp/esp-idf/components/sdmmc C:/Users/Jeff/esp/esp-idf/components/soc C:/Users/Jeff/esp/esp-idf/components/spi_flash C:/Users/Jeff/esp/esp-idf/components/spiffs C:/Users/Jeff/esp/esp-idf/components/tcp_transport C:/Users/Jeff/esp/esp-idf/components/ulp C:/Users/Jeff/esp/esp-idf/components/unity C:/Users/Jeff/esp/esp-idf/components/usb C:/Users/Jeff/esp/esp-idf/components/vfs
C:/Users/Jeff/esp/esp-idf/components/wear_levelling C:/Users/Jeff/esp/esp-idf/components/wifi_provisioning C:/Users/Jeff/esp/esp-idf/components/wpa_supplicant C:/Users/Jeff/esp/esp-idf/components/xtensa
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/Jeff/Documents/PlatformIO/Projects/230626-204629-espidf-hello-world/build

* Executing task: ninja

[13/882] 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,
*******************************************************************************
[624/882] Performing configure step for 'bootloader'
-- Found Git: C:/Users/Jeff/.espressif/tools/idf-git/2.30.1/cmd/git.exe (found version "2.30.1.windows.1")
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/Users/Jeff/.espressif/tools/xtensa-esp32-elf/esp-12.2.0_20230208/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Users/Jeff/.espressif/tools/xtensa-esp32-elf/esp-12.2.0_20230208/xtensa-esp32-elf/bin/xtensa-esp32-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:/Users/Jeff/.espressif/tools/xtensa-esp32-elf/esp-12.2.0_20230208/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32
-- Project sdkconfig file C:/Users/Jeff/Documents/PlatformIO/Projects/230626-204629-espidf-hello-world/sdkconfig
Compiler supported targets: xtensa-esp32-elf

-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of time_t
-- Check size of time_t - done
-- Adding linker script C:/Users/Jeff/esp/esp-idf/components/soc/esp32/ld/esp32.peripherals.ld
-- App "bootloader" version: v5.1-rc1
-- Adding linker script C:/Users/Jeff/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script C:/Users/Jeff/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script C:/Users/Jeff/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script C:/Users/Jeff/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script C:/Users/Jeff/esp/esp-idf/components/bootloader/subproject/main/ld/esp32/bootloader.ld
-- Adding linker script C:/Users/Jeff/esp/esp-idf/components/bootloader/subproject/main/ld/esp32/bootloader.rom.ld
-- Components: bootloader bootloader_support efuse esp_app_format esp_common esp_hw_support esp_rom esp_system esptool_py freertos hal log main micro-ecc newlib partition_table soc spi_flash xtensa
-- Component paths: C:/Users/Jeff/esp/esp-idf/components/bootloader C:/Users/Jeff/esp/esp-idf/components/bootloader_support C:/Users/Jeff/esp/esp-idf/components/efuse C:/Users/Jeff/esp/esp-idf/components/esp_app_format C:/Users/Jeff/esp/esp-idf/components/esp_common C:/Users/Jeff/esp/esp-idf/components/esp_hw_support C:/Users/Jeff/esp/esp-idf/components/esp_rom C:/Users/Jeff/esp/esp-idf/components/esp_system C:/Users/Jeff/esp/esp-idf/components/esptool_py C:/Users/Jeff/esp/esp-idf/components/freertos C:/Users/Jeff/esp/esp-idf/components/hal C:/Users/Jeff/esp/esp-idf/components/log C:/Users/Jeff/esp/esp-idf/components/bootloader/subproject/main C:/Users/Jeff/esp/esp-idf/components/bootloader/subproject/components/micro-ecc C:/Users/Jeff/esp/esp-idf/components/newlib C:/Users/Jeff/esp/esp-idf/components/partition_table C:/Users/Jeff/esp/esp-idf/components/soc C:/Users/Jeff/esp/esp-idf/components/spi_flash C:/Users/Jeff/esp/esp-idf/components/xtensa
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/Jeff/Documents/PlatformIO/Projects/230626-204629-espidf-hello-world/build/bootloader
[647/882] Performing build step for 'bootloader'
[1/103] Generating project_elf_src_esp32.c
[2/103] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/lldesc.c.obj
[3/103] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/dport_access_common.c.obj
[4/103] Building C object esp-idf/xtensa/CMakeFiles/__idf_xtensa.dir/xt_trax.c.obj
[5/103] Building C object esp-idf/xtensa/CMakeFiles/__idf_xtensa.dir/eri.c.obj
[6/103] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/dport_access.c.obj
[7/103] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/gpio_periph.c.obj
[8/103] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/adc_periph.c.obj
[9/103] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/uart_periph.c.obj
[10/103] Building C object CMakeFiles/bootloader.elf.dir/project_elf_src_esp32.c.obj
[11/103] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/interrupts.c.obj
[12/103] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/sdm_periph.c.obj
[13/103] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/ledc_periph.c.obj
[14/103] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/rmt_periph.c.obj
[15/103] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/pcnt_periph.c.obj
[16/103] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/i2s_periph.c.obj
[17/103] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/spi_periph.c.obj
[18/103] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/lcd_periph.c.obj
[19/103] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/sdmmc_periph.c.obj
[20/103] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/timer_periph.c.obj
[21/103] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/mcpwm_periph.c.obj
[22/103] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/dac_periph.c.obj
[23/103] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/touch_sensor_periph.c.obj
[24/103] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/i2c_periph.c.obj
[25/103] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/sdio_slave_periph.c.obj
[26/103] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/twai_periph.c.obj
[27/103] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/rtc_io_periph.c.obj
[28/103] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/wdt_hal_iram.c.obj
[29/103] Building C object esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/spi_flash_wrap.c.obj
[30/103] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/efuse_hal.c.obj
[31/103] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/esp32/efuse_hal.c.obj
[32/103] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/mmu_hal.c.obj
[33/103] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/mpu_hal.c.obj
[34/103] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_random.c.obj
[35/103] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_clock_init.c.obj
[36/103] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_common_loader.c.obj
[37/103] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_mem.c.obj
[38/103] Building C object esp-idf/esp_app_format/CMakeFiles/__idf_esp_app_format.dir/esp_app_desc.c.obj
[39/103] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_random_esp32.c.obj
[40/103] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/secure_boot.c.obj
[41/103] Building C object esp-idf/micro-ecc/CMakeFiles/__idf_micro-ecc.dir/uECC_verify_antifault.c.obj
[42/103] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_encrypt.c.obj
[43/103] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_efuse.c.obj
[44/103] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_common.c.obj
[45/103] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_partitions.c.obj
[46/103] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/bootloader_flash/src/bootloader_flash.c.obj
[47/103] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/bootloader_flash/src/bootloader_flash_config_esp32.c.obj
[48/103] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_panic.c.obj
[49/103] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/bootloader_flash/src/flash_qio_mode.c.obj
[50/103] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_utility.c.obj
[51/103] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_clock_loader.c.obj
[52/103] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_console_loader.c.obj
[53/103] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_console.c.obj
[54/103] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp_image_format.c.obj
[55/103] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32/bootloader_esp32.c.obj
[56/103] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_init.c.obj
[57/103] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32/bootloader_sha.c.obj
[58/103] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32/bootloader_soc.c.obj
[59/103] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_fields.c.obj
[60/103] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/esp32/esp_efuse_table.c.obj
[61/103] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/esp32/esp_efuse_fields.c.obj
[62/103] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/chip_info.c.obj
[63/103] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/esp32/esp_efuse_utility.c.obj
[64/103] Building C object esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/esp_err.c.obj
[65/103] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_api.c.obj
[66/103] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_utility.c.obj
[67/103] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/cpu_region_protect.c.obj
[68/103] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/efuse_controller/keys/without_key_purposes/three_key_blocks/esp_efuse_api_key.c.obj
[69/103] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_time.c.obj
[70/103] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/cpu.c.obj
[71/103] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/esp_memory_utils.c.obj
[72/103] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_crc.c.obj
[73/103] Building ASM object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_longjmp.S.obj
[74/103] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_sleep.c.obj
[75/103] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_sys.c.obj
[76/103] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_clk.c.obj
[77/103] Building C object esp-idf/esp_common/CMakeFiles/__idf_esp_common.dir/src/esp_err_to_name.c.obj
[78/103] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_clk_init.c.obj
[79/103] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_init.c.obj
[80/103] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_efuse.c.obj
[81/103] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_uart.c.obj
[82/103] Building C object esp-idf/log/CMakeFiles/__idf_log.dir/log.c.obj
[83/103] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_spiflash.c.obj
[84/103] Building C object esp-idf/log/CMakeFiles/__idf_log.dir/log_buffers.c.obj
[85/103] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/bootloader_start.c.obj
[86/103] Building C object esp-idf/log/CMakeFiles/__idf_log.dir/log_noos.c.obj
[87/103] Linking C static library esp-idf\log\liblog.a
[88/103] Linking C static library esp-idf\esp_rom\libesp_rom.a
[89/103] Linking C static library esp-idf\esp_common\libesp_common.a
[90/103] Linking C static library esp-idf\esp_hw_support\libesp_hw_support.a
[91/103] Linking C static library esp-idf\esp_system\libesp_system.a
[92/103] Linking C static library esp-idf\efuse\libefuse.a
[93/103] Linking C static library esp-idf\bootloader_support\libbootloader_support.a
[94/103] Linking C static library esp-idf\esp_app_format\libesp_app_format.a
[95/103] Linking C static library esp-idf\spi_flash\libspi_flash.a
[96/103] Linking C static library esp-idf\hal\libhal.a
[97/103] Linking C static library esp-idf\micro-ecc\libmicro-ecc.a
[98/103] Linking C static library esp-idf\soc\libsoc.a
[99/103] Linking C static library esp-idf\xtensa\libxtensa.a
[100/103] Linking C static library esp-idf\main\libmain.a
[101/103] Linking C executable bootloader.elf
[102/103] Generating binary image from built executable
esptool.py v4.6.2
Creating esp32 image...
Merged 1 ELF section
Successfully created esp32 image.
Generated C:/Users/Jeff/Documents/PlatformIO/Projects/230626-204629-espidf-hello-world/build/bootloader/bootloader.bin
[103/103] cmd.exe /C "cd /D C:\Users\Jeff\Documents\PlatformIO\Projects\230626-204629-espidf-hello-world\build\bootloader\esp-idf\esptool_py && C:\Users\Jeff\.espressif\python_env\idf5.1_py3.8_env\Scripts\python.exe C:/Users/Jeff/esp/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x1000 C:/Users/Jeff/Documents/PlatformIO/Projects/230626-204629-espidf-hello-world/build/bootloader/bootloader.bin"
Bootloader binary size 0x6810 bytes. 0x7f0 bytes (7%) free.
[880/882] Linking CXX executable hello-world.elf
FAILED: hello-world.elf
cmd.exe /C "cd . && C:\Users\Jeff\.espressif\tools\xtensa-esp32-elf\esp-12.2.0_20230208\xtensa-esp32-elf\bin\xtensa-esp32-elf-g++.exe
-mlongcalls -Wno-frame-address -Wl,--cref -Wl,--defsym=IDF_TARGET_ESP32=0 -Wl,--Map=C:/Users/Jeff/Documents/PlatformIO/Projects/230626-204629-espidf-hello-world/build/hello-world.map -Wl,--no-warn-rwx-segments -fno-rtti -fno-lto -Wl,--gc-sections -Wl,--warn-common -T
esp32.peripherals.ld -T esp32.rom.ld -T esp32.rom.api.ld -T esp32.rom.libgcc.ld -T esp32.rom.newlib-data.ld -T esp32.rom.syscalls.ld -T esp32.rom.newlib-funcs.ld -T memory.ld -T sections.ld @CMakeFiles\hello-world.elf.rsp -o hello-world.elf && cd ."
c:/users/jeff/.espressif/tools/xtensa-esp32-elf/esp-12.2.0_20230208/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/12.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/freertos/libfreertos.a(app_startup.c.obj):(.literal.main_task+0x24): undefined reference to `app_main'
c:/users/jeff/.espressif/tools/xtensa-esp32-elf/esp-12.2.0_20230208/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/12.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/freertos/libfreertos.a(app_startup.c.obj): in function `main_task':
C:/Users/Jeff/esp/esp-idf/components/freertos/app_startup.c:206: undefined reference to `app_main'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

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

MicroController
Posts: 1738
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: undefined reference to app_main

Postby MicroController » Tue Jun 27, 2023 1:58 pm

I can't see hello_world_main.c being compiled.
How are you trying to build your project (PlatformIO vs. cmake extension vs. IDF extension)? Have you tried idf.py build from the command line?

JeffGray
Posts: 4
Joined: Mon Oct 09, 2017 4:25 am

Re: undefined reference to app_main

Postby JeffGray » Wed Jun 28, 2023 9:53 pm

In VS Code, when I go to Terminal>Configure Default Build Task, The following appears:

CMake: build (230626-204629-espidf-hello-world) is already marked as the default build task

then the file tasks.json opens, which is copied below:
{
"version": "2.0.0",
"tasks": [
{
"type": "cmake",
"label": "CMake: build",
"command": "build",
"targets": [
"[N/A - Select Kit]"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"detail": "CMake template build task"
}
]
}

~~~~~~~~~~~~~~~~~~~~~~~~
This is the first time that I have tried to build a file using espidf, but I have successfully used the Arduino examples and "builded" successfully. I see the statement in the json: "N/A Select kit" but I don't know what that means.

JeffGray
Posts: 4
Joined: Mon Oct 09, 2017 4:25 am

Re: undefined reference to app_main

Postby JeffGray » Thu Jun 29, 2023 2:13 pm

It appears that I did not have cmake installed. Thank you for pointing me in the correct direction. What confused me is that the instructions in VS Code are straightforward for seemingly every other step of setting up the build environment, but I had to dig online and go to cmake.org to download cmake,

MicroController
Posts: 1738
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: undefined reference to app_main

Postby MicroController » Thu Jun 29, 2023 3:05 pm

* Executing task: cmake -G Ninja ...

-- Found Git: C:/Users/Jeff/.espressif/tools/idf-git/2.30.1/cmd/git.exe (found version "2.30.1.windows.1")
-- The C compiler identification is GNU 12.2.0

... tons of other cmake output ...
Some cmake did already run...

Who is online

Users browsing this forum: dzungpv, ok-home and 68 guests