Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake toolchain file should not set CMAKE_*_FLAGS (IDFGH-5799) #7507

Closed
N3xed opened this issue Sep 1, 2021 · 1 comment
Closed

CMake toolchain file should not set CMAKE_*_FLAGS (IDFGH-5799) #7507

N3xed opened this issue Sep 1, 2021 · 1 comment
Assignees
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally

Comments

@N3xed
Copy link

N3xed commented Sep 1, 2021

Environment

  • Development Kit: none
  • Kit version N/A
  • Module or chip used: ESP32-WROOM-32
  • IDF version v4.3 (aswell as all others though not tested)
  • Build System: CMake
  • Compiler version 8.4.0
  • Operating System: Windows
  • (Windows only) environment type: Plain Command Prompt
  • Using an IDE?: Yes (vscode)
  • Power Supply: USB

Problem Description

This is a problem when a third-party tool tries to run cmake with its own flags. Or simply the user sets the flags on the command-line.

For example when trying to build the esp-idf in a rust build script. Here the cmake library used in the build script scrapes some flags (ie. optimization flags, etc.) from the cargo package manager build environment and sets these via -DCMAKE_*_FLAGS. This will then overwrite any flags in the toolchain file.
Because these flags are overwritten this causes the build to fail because required flags are missing (ex. -mlongcalls for esp32).

Expected Behavior

When setting CMAKE_*_FLAGS in the command-line the esp-specific flags should not be overwritten.

Actual Behavior

The esp-specific flags (CMAKE_*_FLAGS in the toolchain file) get overwritten, build fails.

Steps to reproduce

When configuring the cmake project pass -DCMAKE_C_FLAGS= -DCMAKE_CXX_FLAGS= -CMAKE_ASM_FLAGS=.

Debug Logs

Dangerous relocation errors, meaning -mlongcalls is not set.
Note: It is an empty project with only a void app_main() {} function.

Linker output
cmd.exe /C "cd . && F:\proj\hue-rs2\.sdk\tools\xtensa-esp32-elf\esp-2020r3-8.4.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-gcc.exe   @CMakeFiles\libespidf.elf.rsp -o libespidf.elf  && cd ."
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/esp_system/libesp_system.a(cpu_start.c.obj): in function `start_other_core':
F:/proj/hue-rs2/.sdk/esp-idf/components/esp_system/port/cpu_start.c:195:(.text.start_other_core+0x1f): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/esp_system/libesp_system.a(cpu_start.c.obj): in function `Cache_Flush':
F:/proj/hue-rs2/.sdk/esp-idf/components/esp_rom/include/esp32/rom/cache.h:142:(.text.start_other_core+0x27): dangerous relocation: call8: call target out of range: Cache_Flush_rom
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/esp_system/libesp_system.a(cpu_start.c.obj): in function `Cache_Read_Enable':
F:/proj/hue-rs2/.sdk/esp-idf/components/esp_rom/include/esp32/rom/cache.h:174:(.text.start_other_core+0x32): dangerous relocation: call8: call target out of range: Cache_Read_Enable_rom
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/esp_system/libesp_system.a(cpu_start.c.obj): in function `start_other_core':
F:/proj/hue-rs2/.sdk/esp-idf/components/esp_system/port/cpu_start.c:222:(.text.start_other_core+0x8c): dangerous relocation: call8: call target out of range: ets_set_appcpu_boot_addr
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/esp_system/port/cpu_start.c:231:(.text.start_other_core+0xcd): dangerous relocation: call8: call target out of range: esp_rom_delay_us
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/esp_system/libesp_system.a(cpu_start.c.obj): in function `intr_matrix_clear':
F:/proj/hue-rs2/.sdk/esp-idf/components/esp_system/port/cpu_start.c:240:(.text.intr_matrix_clear+0xe): dangerous relocation: call8: call target out of range: intr_matrix_set
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/esp_system/port/cpu_start.c:242:(.text.intr_matrix_clear+0x17): dangerous relocation: call8: call target out of range: intr_matrix_set
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/esp_system/libesp_system.a(startup.c.obj): in function `do_secondary_init':F:/proj/hue-rs2/.sdk/esp-idf/components/esp_system/startup.c:348:(.text.do_secondary_init+0x46): dangerous relocation: call8: call target out of range: esp_rom_delay_us
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/esp_system/libesp_system.a(startup.c.obj): in function `start_cpu0_default':
F:/proj/hue-rs2/.sdk/esp-idf/components/esp_system/startup.c:356:(.text.start_cpu0_default+0x12): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/esp_system/startup.c:358:(.text.start_cpu0_default+0x26): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/esp_system/startup.c:363:(.text.start_cpu0_default+0x3a): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/esp_system/startup.c:365:(.text.start_cpu0_default+0x4a): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/esp_system/startup.c:368:(.text.start_cpu0_default+0x5a): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/esp_system/startup.c:374:(.text.start_cpu0_default+0x6f): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/esp_system/startup.c:378:(.text.start_cpu0_default+0x86): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/esp_system/startup.c:379:(.text.start_cpu0_default+0x96): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/heap/libheap.a(heap_caps.c.obj): in function `heap_caps_get_info':
F:/proj/hue-rs2/.sdk/esp-idf/components/heap/heap_caps.c:447:(.text.heap_caps_get_info+0x9): dangerous relocation: call8: call target out of range: memset
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/esp32/libesp32.a(cache_err_int.c.obj): in function `esp_cache_err_int_init':
F:/proj/hue-rs2/.sdk/esp-idf/components/esp32/cache_err_int.c:48:(.text.esp_cache_err_int_init+0x17): dangerous relocation: call8: call target out of range: intr_matrix_set
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/esp32/libesp32.a(dport_access.c.obj): in function `dport_access_init_core':F:/proj/hue-rs2/.sdk/esp-idf/components/esp32/dport_access.c:158:(.text.dport_access_init_core+0x1e): dangerous relocation: call8: call target out of range: intr_matrix_set
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/esp_common/libesp_common.a(int_wdt.c.obj): in function `esp_int_wdt_cpu_init':
F:/proj/hue-rs2/.sdk/esp-idf/components/esp_common/src/int_wdt.c:126:(.text.esp_int_wdt_cpu_init+0x1e): dangerous relocation: call8: call target out of range: intr_matrix_set
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/esp_timer/libesp_timer.a(esp_timer.c.obj): in function `timer_process_alarm':
F:/proj/hue-rs2/.sdk/esp-idf/components/esp_timer/src/esp_timer.c:308:(.text.timer_process_alarm+0x79): dangerous relocation: call8: call target out of range: __udivdi3
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/esp_timer/libesp_timer.a(esp_timer_impl_lac.c.obj): in function `esp_timer_impl_init':
F:/proj/hue-rs2/.sdk/esp-idf/components/esp_timer/src/esp_timer_impl_lac.c:230:(.text.esp_timer_impl_init+0x76): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/freertos/libfreertos.a(port.c.obj): in function `esp_startup_start_app_other_cores':
F:/proj/hue-rs2/.sdk/esp-idf/components/freertos/port/xtensa/port.c:521:(.text.esp_startup_start_app_other_cores+0x2e): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/freertos/libfreertos.a(port.c.obj): in function `esp_startup_start_app':
F:/proj/hue-rs2/.sdk/esp-idf/components/freertos/port/xtensa/port.c:540:(.text.esp_startup_start_app+0x1d): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/freertos/port/xtensa/port.c:541:(.text.esp_startup_start_app+0x2a): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/esp_system/libesp_system.a(intr_alloc.c.obj): in function `esp_intr_alloc_intrstatus':
F:/proj/hue-rs2/.sdk/esp-idf/components/esp_system/intr_alloc.c:526:(.text.esp_intr_alloc_intrstatus+0x139): dangerous relocation: call8: call target out of range: memset
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/esp_system/intr_alloc.c:572:(.text.esp_intr_alloc_intrstatus+0x216): dangerous relocation: call8: call target out of range: intr_matrix_set
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/heap/libheap.a(multi_heap.c.obj): in function `multi_heap_assert':
F:/proj/hue-rs2/.sdk/esp-idf/components/heap/multi_heap_platform.h:67:(.text.assert_valid_block+0x2a): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/spi_flash/libspi_flash.a(memspi_host_driver.c.obj): in function `memspi_host_read_id_hs':
F:/proj/hue-rs2/.sdk/esp-idf/components/spi_flash/memspi_host_driver.c:103:(.text.memspi_host_read_id_hs+0x51): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/spi_flash/libspi_flash.a(spi_flash_chip_generic.c.obj): in function `spi_flash_chip_generic_suspend_cmd_conf':
F:/proj/hue-rs2/.sdk/esp-idf/components/spi_flash/spi_flash_chip_generic.c:650:(.text.spi_flash_chip_generic_suspend_cmd_conf+0x15): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/log/liblog.a(log.c.obj): in function `get_uncached_log_level':
F:/proj/hue-rs2/.sdk/esp-idf/components/log/log.c:267:(.text.esp_log_writev+0xba): dangerous relocation: call8: call target out of range: strcmp
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/vfs/libvfs.a(vfs.c.obj): in function `esp_vfs_register_common':
F:/proj/hue-rs2/.sdk/esp-idf/components/vfs/vfs.c:107:(.text.esp_vfs_register_common+0x99): dangerous relocation: call8: call target out of range: strcpy
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/vfs/vfs.c:109:(.text.esp_vfs_register_common+0xa9): dangerous relocation: call8: call target out of range: memset
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/vfs/vfs.c:111:(.text.esp_vfs_register_common+0xb5): dangerous relocation: call8: call target out of range: memcpy
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/vfs/libvfs.a(vfs.c.obj): in function `get_vfs_for_path':
F:/proj/hue-rs2/.sdk/esp-idf/components/vfs/vfs.c:300:(.text.get_vfs_for_path+0x5): dangerous relocation: call8: call target out of range: strlen
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/vfs/vfs.c:308:(.text.get_vfs_for_path+0x33): dangerous relocation: call8: call target out of range: memcmp
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/vfs/libvfs.a(vfs.c.obj): in function `translate_path':
F:/proj/hue-rs2/.sdk/esp-idf/components/vfs/vfs.c:288:(.text.translate_path+0x12): dangerous relocation: call8: call target out of range: strncmp
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/vfs/vfs.c:289:(.text.translate_path+0x28): dangerous relocation: call8: call target out of range: strlen
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/vfs/libvfs.a(vfs.c.obj): in function `esp_vfs_register':
F:/proj/hue-rs2/.sdk/esp-idf/components/vfs/vfs.c:125:(.text.esp_vfs_register+0x5): dangerous relocation: call8: call target out of range: strlen
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/vfs/libvfs.a(vfs_uart.c.obj): in function `uart_tcgetattr':
F:/proj/hue-rs2/.sdk/esp-idf/components/vfs/vfs_uart.c:739:(.text.uart_tcgetattr+0x29): dangerous relocation: call8: call target out of range: memset
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/vfs/libvfs.a(vfs_uart.c.obj): in function `uart_access':
F:/proj/hue-rs2/.sdk/esp-idf/components/vfs/vfs_uart.c:329:(.text.uart_access+0x9): dangerous relocation: call8: call target out of range: strcmp
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/vfs/vfs_uart.c:329:(.text.uart_access+0x13): dangerous relocation: call8: call target out of range: strcmp
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/vfs/vfs_uart.c:329:(.text.uart_access+0x1d): dangerous relocation: call8: call target out of range: strcmp
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/vfs/libvfs.a(vfs_uart.c.obj): in function `uart_open':
F:/proj/hue-rs2/.sdk/esp-idf/components/vfs/vfs_uart.c:141:(.text.uart_open+0x9): dangerous relocation: call8: call target out of range: strcmp
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/vfs/vfs_uart.c:143:(.text.uart_open+0x13): dangerous relocation: call8: call target out of range: strcmp
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/vfs/vfs_uart.c:145:(.text.uart_open+0x1d): dangerous relocation: call8: call target out of range: strcmp
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/vfs/libvfs.a(vfs_uart.c.obj): in function `uart_fstat':
F:/proj/hue-rs2/.sdk/esp-idf/components/vfs/vfs_uart.c:294:(.text.uart_fstat+0x1d): dangerous relocation: call8: call target out of range: memset
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/vfs/libvfs.a(vfs_uart.c.obj): in function `esp_vfs_dev_uart_register':
F:/proj/hue-rs2/.sdk/esp-idf/components/vfs/vfs_uart.c:975:(.text.esp_vfs_dev_uart_register+0xa): dangerous relocation: call8: call target out of range: memset
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/esp_common/libesp_common.a(task_wdt.c.obj): in function `task_wdt_isr':
F:/proj/hue-rs2/.sdk/esp-idf/components/esp_common/src/task_wdt.c:163:(.text.task_wdt_isr+0x3d): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/esp_common/src/task_wdt.c:168:(.text.task_wdt_isr+0x89): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/esp_common/src/task_wdt.c:171:(.text.task_wdt_isr+0x9f): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/esp_common/src/task_wdt.c:173:(.text.task_wdt_isr+0xc1): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/esp_common/src/task_wdt.c:179:(.text.task_wdt_isr+0xe2): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/esp_common/src/task_wdt.c:188:(.text.task_wdt_isr+0x10a): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/esp_common/src/task_wdt.c:192:(.text.task_wdt_isr+0x12a): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/spi_flash/libspi_flash.a(esp_flash_spi_init.c.obj): in function `esp_flash_init_default_chip':
F:/proj/hue-rs2/.sdk/esp-idf/components/spi_flash/esp_flash_spi_init.c:279:(.text.esp_flash_init_default_chip+0x55): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/spi_flash/esp_flash_spi_init.c:284:(.text.esp_flash_init_default_chip+0x7e): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/esp_system/libesp_system.a(clk.c.obj): in function `select_rtc_slow_clk':
F:/proj/hue-rs2/.sdk/esp-idf/components/esp_system/port/soc/esp32/clk.c:101:(.text.select_rtc_slow_clk+0x3e): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/esp_system/libesp_system.a(clk.c.obj): in function `esp_clk_init':
F:/proj/hue-rs2/.sdk/esp-idf/components/esp_system/port/soc/esp32/clk.c:153:(.text.esp_clk_init+0x40): dangerous relocation: call8: call target out of range: __udivdi3
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/esp_system/port/soc/esp32/clk.c:173:(.text.esp_clk_init+0x78): dangerous relocation: call8: call target out of range: __udivdi3
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/esp_system/port/soc/esp32/clk.c:198:(.text.esp_clk_init+0xd6): dangerous relocation: call8: call target out of range: __udivdi3
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/esp_system/libesp_system.a(clk.c.obj): in function `esp_perip_clk_init':
F:/proj/hue-rs2/.sdk/esp-idf/components/esp_system/port/soc/esp32/clk.c:219:(.text.esp_perip_clk_init+0x6): dangerous relocation: call8: call target out of range: rtc_get_reset_reason
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/esp_system/port/soc/esp32/clk.c:222:(.text.esp_perip_clk_init+0xd): dangerous relocation: call8: call target out of range: rtc_get_reset_reason
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/heap/libheap.a(heap_caps_init.c.obj): in function `heap_caps_init':
F:/proj/hue-rs2/.sdk/esp-idf/components/heap/heap_caps_init.c:94:(.text.heap_caps_init+0xc5): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/heap/heap_caps_init.c:105:(.text.heap_caps_init+0x125): dangerous relocation: call8: call target out of range: memcpy
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/heap/heap_caps_init.c:117:(.text.heap_caps_init+0x1cb): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/heap/heap_caps_init.c:140:(.text.heap_caps_init+0x255): dangerous relocation: call8: call target out of range: memcpy
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/soc/libsoc.a(memory_layout_utils.c.obj): in function `s_prepare_reserved_regions':
F:/proj/hue-rs2/.sdk/esp-idf/components/soc/memory_layout_utils.c:76:(.text.s_prepare_reserved_regions+0xb): dangerous relocation: call8: call target out of range: memcpy
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: F:/proj/hue-rs2/.sdk/esp-idf/components/soc/memory_layout_utils.c:96:(.text.s_prepare_reserved_regions+0x82): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/soc/libsoc.a(memory_layout_utils.c.obj): in function `soc_get_available_memory_regions':
F:/proj/hue-rs2/.sdk/esp-idf/components/soc/memory_layout_utils.c:111:(.text.soc_get_available_memory_regions+0x1e): dangerous relocation: call8: call target out of range: memcpy
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/esp_common/libesp_common.a(brownout.c.obj): in function `rtc_brownout_isr_handler':
F:/proj/hue-rs2/.sdk/esp-idf/components/esp_common/src/brownout.c:65:(.text.rtc_brownout_isr_handler+0x20): dangerous relocation: call8: call target out of range: esp_rom_printf
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/spi_flash/libspi_flash.a(partition.c.obj): in function `load_partitions':
F:/proj/hue-rs2/.sdk/esp-idf/components/spi_flash/partition.c:206:(.text.load_partitions+0xb9): dangerous relocation: call8: call target out of range: strncpy
f:/proj/hue-rs2/.sdk/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/spi_flash/libspi_flash.a(partition.c.obj): in function `esp_partition_next':
F:/proj/hue-rs2/.sdk/esp-idf/components/spi_flash/partition.c:117:(.text.esp_partition_next+0x45): dangerous relocation: call8: call target out of range: strcmp
collect2.exe: error: ld returned 1 exit status

See also https://stackoverflow.com/a/30217088 which addresses this problem.

@espressif-bot espressif-bot added the Status: Opened Issue is new label Sep 1, 2021
@github-actions github-actions bot changed the title CMake toolchain file should not set CMAKE_*_FLAGS CMake toolchain file should not set CMAKE_*_FLAGS (IDFGH-5799) Sep 1, 2021
@o-marshmallow
Copy link
Collaborator

o-marshmallow commented Sep 29, 2021

Hello @N3xed ,
Thank you for reporting this issue, I am going to manage this. I was indeed able to reproduce the issue locally.

@o-marshmallow o-marshmallow self-assigned this Oct 20, 2021
@espressif-bot espressif-bot added Status: In Progress Work is in progress and removed Status: Opened Issue is new labels Oct 21, 2021
@espressif-bot espressif-bot added Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: In Progress Work is in progress Resolution: NA Issue resolution is unavailable labels Nov 30, 2021
espressif-bot pushed a commit that referenced this issue Jul 4, 2022
Defining CMake variables from the command-line or from another CMake project,
such as `-DCMAKE_C_FLAGS= -DCMAKE_CXX_FLAGS=`, caused a link failure as ESP
CMake was unable to set its proper compilation flags.
Additional CMake compiler flags can now be provided by another project.

* Closes #7507
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

3 participants