micro-ROS / micro_ros_espidf_component

micro-ROS ESP32 IDF component and sample code
Apache License 2.0
229 stars 53 forks source link

microcdr C_STANDARD is set to invalid value '17' #211

Closed Scoeerg closed 7 months ago

Scoeerg commented 8 months ago

microcdr C_STANDARD is set to invalid value '17'

Minimal Setup

I am using Joy-It's NodeMCU ESP32 via USB on an Ubuntu20.04 with installed, but not sourced ROS2 Foxy.

Clean microros workspace, i.e.:

cd /home/eric/Software/
git clone -b foxy https://github.com/micro-ROS/micro_ros_espidf_component.git

I have ESP-IDF v5.0.4-dirty installed in home/eric/esp/esp-idf/. I used the VSCode ESP Extension. But for this minimal setup I will only use the terminal.

Reproduce the Error

# open terminal without sourced ROS2 Foxy
. ~/esp/esp-idf/export.sh

Here's my log regarding export.sh: export.log

idf.py --version
# ESP-IDF v5.0.4-dirty
cd /home/eric/Software/micro_ros_espidf_component/examples/int32_publisher

then comes that part that goes wrong

idf.py set-target esp32

which results in

...
Starting >>> microcdr
  opt = self.warn_dash_deprecation(opt, section)
--- stderr: microcdr
CMake Error at /home/eric/Software/micro_ros_espidf_component/micro_ros_src/build/microcdr/CMakeFiles/CMakeTmp/CMakeLists.txt:16 (add_library):
  C_STANDARD is set to invalid value '17'

CMake Error at /usr/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:44 (try_compile):
  Failed to generate test project build system.
Call Stack (most recent call first):
  cmake/SuperBuild.cmake:19 (enable_language)
  CMakeLists.txt:54 (include)

---
Failed   <<< microcdr [0.50s, exited with code 1]
...

for the full log see settarget.log. CMake is later than 3.8, see e.g. this git issue:

cmake --version
# cmake version 3.16.3

All other commands after this step fail, since some dependency is not built correctly.

Scoeerg commented 8 months ago

It seems the built code resides in $somepath/micro_ros_espidf_component/micro_ros_src/build, I deleted this directory for a hopefully clean build and got the same error with shorter log, which I can share:

Directory '/home/eric/Software/micro_ros_espidf_component/examples/int32_publisher/build' doesn't seem to be a CMake build directory. Refusing to automatically delete files in this directory. Delete the directory manually to 'clean' it.
Adding "set-target"'s dependency "fullclean" to list of commands with default set of options.
Executing action: fullclean
Adding "set-target"'s dependency "fullclean" to list of commands with default set of options.
Executing action: fullclean
Build directory '/home/eric/Software/micro_ros_espidf_component/examples/int32_publisher/build' not found. Nothing to clean.
Executing action: set-target
Set Target to: esp32, new sdkconfig created. Existing sdkconfig renamed to sdkconfig.old.
Running cmake in directory /home/eric/Software/micro_ros_espidf_component/examples/int32_publisher/build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 -DIDF_TARGET=esp32 -DCCACHE_ENABLE=0 /home/eric/Software/micro_ros_espidf_component/examples/int32_publisher"...
-- Found Git: /usr/bin/git (found version "2.25.1") 
-- The C compiler identification is GNU 11.2.0
-- The CXX compiler identification is GNU 11.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/eric/.espressif/tools/xtensa-esp32-elf/esp-2022r1-11.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
-- Check for working C compiler: /home/eric/.espressif/tools/xtensa-esp32-elf/esp-2022r1-11.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
-- Check for working C compiler: /home/eric/.espressif/tools/xtensa-esp32-elf/esp-2022r1-11.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /home/eric/.espressif/tools/xtensa-esp32-elf/esp-2022r1-11.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++
-- Check for working CXX compiler: /home/eric/.espressif/tools/xtensa-esp32-elf/esp-2022r1-11.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32
-- Project sdkconfig file /home/eric/Software/micro_ros_espidf_component/examples/int32_publisher/sdkconfig
Loading defaults file /home/eric/Software/micro_ros_espidf_component/examples/int32_publisher/sdkconfig.defaults...
/home/eric/Software/micro_ros_espidf_component/examples/int32_publisher/sdkconfig.defaults:2 CONFIG_ESP_TASK_WDT was replaced with CONFIG_ESP_TASK_WDT_INIT
-- 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: /home/eric/.espressif/python_env/idf5.0_py3.8_env/bin/python (found version "3.8.10") found components: Interpreter 
-- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS
-- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS - Success
-- App "int32_publisher" version: 1.0.0-1-g0d6a175
-- Adding linker script /home/eric/Software/micro_ros_espidf_component/examples/int32_publisher/build/esp-idf/esp_system/ld/memory.ld
-- Adding linker script /home/eric/esp/esp-idf/components/esp_system/ld/esp32/sections.ld.in
-- Adding linker script /home/eric/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script /home/eric/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script /home/eric/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script /home/eric/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld
-- Adding linker script /home/eric/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld
-- Adding linker script /home/eric/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script /home/eric/esp/esp-idf/components/soc/esp32/ld/esp32.peripherals.ld
cd /home/eric/Software/micro_ros_espidf_component/micro_ros_src; \
unset AMENT_PREFIX_PATH; \
PATH="/home/eric/esp/esp-idf/components/espcoredump:/home/eric/esp/esp-idf/components/partition_table:/home/eric/esp/esp-idf/components/app_update:/home/eric/.espressif/tools/xtensa-esp-elf-gdb/11.2_20220823/xtensa-esp-elf-gdb/bin:/home/eric/.espressif/tools/riscv32-esp-elf-gdb/11.2_20220823/riscv32-esp-elf-gdb/bin:/home/eric/.espressif/tools/xtensa-esp32-elf/esp-2022r1-11.2.0/xtensa-esp32-elf/bin:/home/eric/.espressif/tools/xtensa-esp32s2-elf/esp-2022r1-11.2.0/xtensa-esp32s2-elf/bin:/home/eric/.espressif/tools/xtensa-esp32s3-elf/esp-2022r1-11.2.0/xtensa-esp32s3-elf/bin:/home/eric/.espressif/tools/riscv32-esp-elf/esp-2022r1-11.2.0/riscv32-esp-elf/bin:/home/eric/.espressif/tools/esp32ulp-elf/2.35_20220830/esp32ulp-elf/bin:/home/eric/.espressif/tools/openocd-esp32/v0.12.0-esp32-20230419/openocd-esp32/bin:/home/eric/.espressif/tools/ninja/1.10.2/:/home/eric/.espressif/python_env/idf5.0_py3.8_env/bin:/home/eric/esp/esp-idf/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"; \
. ../micro_ros_dev/install/local_setup.sh; \
colcon build \
    --merge-install \
    --packages-ignore-regex=.*_cpp \
    --metas /home/eric/Software/micro_ros_espidf_component/colcon.meta  \
    --cmake-args \
    "--no-warn-unused-cli" \
    -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=OFF \
    -DTHIRDPARTY=ON \
    -DBUILD_SHARED_LIBS=OFF \
    -DBUILD_TESTING=OFF \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_TOOLCHAIN_FILE=/home/eric/Software/micro_ros_espidf_component/esp32_toolchain.cmake \
    -DCMAKE_VERBOSE_MAKEFILE=OFF \
        -DIDF_INCLUDES='-I/home/eric/esp/esp-idf/components/xtensa/include -I/home/eric/esp/esp-idf/components/xtensa/esp32/include -I/home/eric/esp/esp-idf/components/esp_ringbuf/include -I/home/eric/esp/esp-idf/components/efuse/include -I/home/eric/esp/esp-idf/components/efuse/esp32/include -I/home/eric/esp/esp-idf/components/driver/include -I/home/eric/esp/esp-idf/components/driver/deprecated -I/home/eric/esp/esp-idf/components/driver/esp32/include -I/home/eric/esp/esp-idf/components/esp_pm/include -I/home/eric/esp/esp-idf/components/mbedtls/port/include -I/home/eric/esp/esp-idf/components/mbedtls/mbedtls/include -I/home/eric/esp/esp-idf/components/mbedtls/mbedtls/library -I/home/eric/esp/esp-idf/components/mbedtls/esp_crt_bundle/include -I/home/eric/esp/esp-idf/components/esp_app_format/include -I/home/eric/esp/esp-idf/components/bootloader_support/include -I/home/eric/esp/esp-idf/components/bootloader_support/bootloader_flash/include -I/home/eric/esp/esp-idf/components/esp_partition/include -I/home/eric/esp/esp-idf/components/app_update/include -I/home/eric/esp/esp-idf/components/spi_flash/include -I/home/eric/esp/esp-idf/components/pthread/include -I/home/eric/esp/esp-idf/components/esp_system/include -I/home/eric/esp/esp-idf/components/esp_rom/include -I/home/eric/esp/esp-idf/components/esp_rom/include/esp32 -I/home/eric/esp/esp-idf/components/esp_rom/esp32 -I/home/eric/esp/esp-idf/components/hal/esp32/include -I/home/eric/esp/esp-idf/components/hal/include -I/home/eric/esp/esp-idf/components/hal/platform_port/include -I/home/eric/esp/esp-idf/components/log/include -I/home/eric/esp/esp-idf/components/heap/include -I/home/eric/esp/esp-idf/components/soc/include -I/home/eric/esp/esp-idf/components/esp_hw_support/include -I/home/eric/esp/esp-idf/components/esp_hw_support/include/soc -I/home/eric/esp/esp-idf/components/esp_hw_support/include/soc/esp32 -I/home/eric/esp/esp-idf/components/freertos/FreeRTOS-Kernel/include -I/home/eric/esp/esp-idf/components/freertos/esp_additions/include/freertos -I/home/eric/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include -I/home/eric/esp/esp-idf/components/freertos/esp_additions/include -I/home/eric/esp/esp-idf/components/newlib/platform_include -I/home/eric/esp/esp-idf/components/esp_common/include -I/home/eric/esp/esp-idf/components/esp_timer/include -I/home/eric/esp/esp-idf/components/app_trace/include -I/home/eric/esp/esp-idf/components/esp_event/include -I/home/eric/esp/esp-idf/components/nvs_flash/include -I/home/eric/esp/esp-idf/components/esp_phy/include -I/home/eric/esp/esp-idf/components/esp_phy/esp32/include -I/home/eric/esp/esp-idf/components/vfs/include -I/home/eric/esp/esp-idf/components/lwip/include -I/home/eric/esp/esp-idf/components/lwip/include/apps -I/home/eric/esp/esp-idf/components/lwip/include/apps/sntp -I/home/eric/esp/esp-idf/components/lwip/lwip/src/include -I/home/eric/esp/esp-idf/components/lwip/port/esp32/include -I/home/eric/esp/esp-idf/components/lwip/port/esp32/include/arch -I/home/eric/esp/esp-idf/components/esp_netif/include -I/home/eric/esp/esp-idf/components/wpa_supplicant/include -I/home/eric/esp/esp-idf/components/wpa_supplicant/port/include -I/home/eric/esp/esp-idf/components/wpa_supplicant/esp_supplicant/include -I/home/eric/esp/esp-idf/components/esp_wifi/include -I/home/eric/esp/esp-idf/components/unity/include -I/home/eric/esp/esp-idf/components/unity/unity/src -I/home/eric/esp/esp-idf/components/cmock/CMock/src -I/home/eric/esp/esp-idf/components/console/. -I/home/eric/esp/esp-idf/components/http_parser/. -I/home/eric/esp/esp-idf/components/esp-tls/. -I/home/eric/esp/esp-idf/components/esp-tls/esp-tls-crypto -I/home/eric/esp/esp-idf/components/esp_adc/include -I/home/eric/esp/esp-idf/components/esp_adc/interface -I/home/eric/esp/esp-idf/components/esp_adc/esp32/include -I/home/eric/esp/esp-idf/components/esp_adc/deprecated/include -I/home/eric/esp/esp-idf/components/esp_eth/include -I/home/eric/esp/esp-idf/components/esp_gdbstub/include -I/home/eric/esp/esp-idf/components/esp_hid/include -I/home/eric/esp/esp-idf/components/tcp_transport/include -I/home/eric/esp/esp-idf/components/esp_http_client/include -I/home/eric/esp/esp-idf/components/esp_http_server/include -I/home/eric/esp/esp-idf/components/esp_https_ota/include -I/home/eric/esp/esp-idf/components/esp_lcd/include -I/home/eric/esp/esp-idf/components/esp_lcd/interface -I/home/eric/esp/esp-idf/components/protobuf-c/protobuf-c -I/home/eric/esp/esp-idf/components/protocomm/include/common -I/home/eric/esp/esp-idf/components/protocomm/include/security -I/home/eric/esp/esp-idf/components/protocomm/include/transports -I/home/eric/esp/esp-idf/components/esp_local_ctrl/include -I/home/eric/esp/esp-idf/components/esp_psram/include -I/home/eric/esp/esp-idf/components/espcoredump/include -I/home/eric/esp/esp-idf/components/espcoredump/include/port/xtensa -I/home/eric/esp/esp-idf/components/wear_levelling/include -I/home/eric/esp/esp-idf/components/sdmmc/include -I/home/eric/esp/esp-idf/components/fatfs/diskio -I/home/eric/esp/esp-idf/components/fatfs/vfs -I/home/eric/esp/esp-idf/components/fatfs/src -I/home/eric/esp/esp-idf/components/idf_test/include -I/home/eric/esp/esp-idf/components/idf_test/include/esp32 -I/home/eric/esp/esp-idf/components/ieee802154/include -I/home/eric/esp/esp-idf/components/json/cJSON -I/home/eric/esp/esp-idf/components/mqtt/esp-mqtt/include -I/home/eric/esp/esp-idf/components/perfmon/include -I/home/eric/esp/esp-idf/components/spiffs/include -I/home/eric/esp/esp-idf/components/ulp/ulp_common/include -I/home/eric/esp/esp-idf/components/ulp/ulp_common/include/esp32 -I/home/eric/esp/esp-idf/components/wifi_provisioning/include -I/home/eric/Software/micro_ros_espidf_component/network_interfaces' \
    -DCMAKE_C_STANDARD=17 \
    -DUCLIENT_C_STANDARD=17;
Starting >>> tinydir_vendor
Starting >>> rosidl_adapter
Starting >>> rosidl_typesupport_interface
Starting >>> microcdr
Starting >>> rmw_implementation_cmake
Starting >>> tracetools
Starting >>> tracetools_trace
Starting >>> test_interface_files
Starting >>> tracetools_read
/home/eric/.espressif/python_env/idf5.0_py3.8_env/lib/python3.8/site-packages/setuptools/dist.py:498: SetuptoolsDeprecationWarning: Invalid dash-separated options
!!

        ********************************************************************************
        Usage of dash-separated 'script-dir' will not be supported in future
        versions. Please use the underscore name 'script_dir' instead.

        This deprecation is overdue, please update your project and remove deprecated
        calls to avoid build errors in the future.

        See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
        ********************************************************************************

!!
  opt = self.warn_dash_deprecation(opt, section)
/home/eric/.espressif/python_env/idf5.0_py3.8_env/lib/python3.8/site-packages/setuptools/dist.py:498: SetuptoolsDeprecationWarning: Invalid dash-separated options
!!

        ********************************************************************************
        Usage of dash-separated 'script-dir' will not be supported in future
        versions. Please use the underscore name 'script_dir' instead.

        This deprecation is overdue, please update your project and remove deprecated
        calls to avoid build errors in the future.

        See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
        ********************************************************************************

!!
  opt = self.warn_dash_deprecation(opt, section)
--- stderr: microcdr
CMake Error at /home/eric/Software/micro_ros_espidf_component/micro_ros_src/build/microcdr/CMakeFiles/CMakeTmp/CMakeLists.txt:16 (add_library):
  C_STANDARD is set to invalid value '17'

CMake Error at /usr/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:44 (try_compile):
  Failed to generate test project build system.
Call Stack (most recent call first):
  cmake/SuperBuild.cmake:19 (enable_language)
  CMakeLists.txt:54 (include)

---
Failed   <<< microcdr [0.51s, exited with code 1]
Aborted  <<< tracetools_read [0.43s]
Aborted  <<< tracetools_trace [0.47s]
Aborted  <<< rmw_implementation_cmake [0.50s]
Aborted  <<< rosidl_typesupport_interface [0.53s]
Aborted  <<< rosidl_adapter [0.54s]
Aborted  <<< test_interface_files [0.45s]
Aborted  <<< tinydir_vendor [0.70s]
Aborted  <<< tracetools [0.70s]

Summary: 0 packages finished [1.52s]
  1 package failed: microcdr
  8 packages aborted: rmw_implementation_cmake rosidl_adapter rosidl_typesupport_interface test_interface_files tinydir_vendor tracetools tracetools_read tracetools_trace
  2 packages had stderr output: microcdr tracetools
  48 packages not processed
make: *** [libmicroros.mk:78: /home/eric/Software/micro_ros_espidf_component/micro_ros_src/install] Error 1
-- Components: app_trace app_update bootloader bootloader_support bt cmock console cxx driver efuse esp-tls esp_adc esp_app_format 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_netif 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 main mbedtls micro_ros_espidf_component 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: /home/eric/esp/esp-idf/components/app_trace /home/eric/esp/esp-idf/components/app_update /home/eric/esp/esp-idf/components/bootloader /home/eric/esp/esp-idf/components/bootloader_support /home/eric/esp/esp-idf/components/bt /home/eric/esp/esp-idf/components/cmock /home/eric/esp/esp-idf/components/console /home/eric/esp/esp-idf/components/cxx /home/eric/esp/esp-idf/components/driver /home/eric/esp/esp-idf/components/efuse /home/eric/esp/esp-idf/components/esp-tls /home/eric/esp/esp-idf/components/esp_adc /home/eric/esp/esp-idf/components/esp_app_format /home/eric/esp/esp-idf/components/esp_common /home/eric/esp/esp-idf/components/esp_eth /home/eric/esp/esp-idf/components/esp_event /home/eric/esp/esp-idf/components/esp_gdbstub /home/eric/esp/esp-idf/components/esp_hid /home/eric/esp/esp-idf/components/esp_http_client /home/eric/esp/esp-idf/components/esp_http_server /home/eric/esp/esp-idf/components/esp_https_ota /home/eric/esp/esp-idf/components/esp_https_server /home/eric/esp/esp-idf/components/esp_hw_support /home/eric/esp/esp-idf/components/esp_lcd /home/eric/esp/esp-idf/components/esp_local_ctrl /home/eric/esp/esp-idf/components/esp_netif /home/eric/esp/esp-idf/components/esp_partition /home/eric/esp/esp-idf/components/esp_phy /home/eric/esp/esp-idf/components/esp_pm /home/eric/esp/esp-idf/components/esp_psram /home/eric/esp/esp-idf/components/esp_ringbuf /home/eric/esp/esp-idf/components/esp_rom /home/eric/esp/esp-idf/components/esp_system /home/eric/esp/esp-idf/components/esp_timer /home/eric/esp/esp-idf/components/esp_wifi /home/eric/esp/esp-idf/components/espcoredump /home/eric/esp/esp-idf/components/esptool_py /home/eric/esp/esp-idf/components/fatfs /home/eric/esp/esp-idf/components/freertos /home/eric/esp/esp-idf/components/hal /home/eric/esp/esp-idf/components/heap /home/eric/esp/esp-idf/components/http_parser /home/eric/esp/esp-idf/components/idf_test /home/eric/esp/esp-idf/components/ieee802154 /home/eric/esp/esp-idf/components/json /home/eric/esp/esp-idf/components/log /home/eric/esp/esp-idf/components/lwip /home/eric/Software/micro_ros_espidf_component/examples/int32_publisher/main /home/eric/esp/esp-idf/components/mbedtls /home/eric/Software/micro_ros_espidf_component /home/eric/esp/esp-idf/components/mqtt /home/eric/esp/esp-idf/components/newlib /home/eric/esp/esp-idf/components/nvs_flash /home/eric/esp/esp-idf/components/openthread /home/eric/esp/esp-idf/components/partition_table /home/eric/esp/esp-idf/components/perfmon /home/eric/esp/esp-idf/components/protobuf-c /home/eric/esp/esp-idf/components/protocomm /home/eric/esp/esp-idf/components/pthread /home/eric/esp/esp-idf/components/sdmmc /home/eric/esp/esp-idf/components/soc /home/eric/esp/esp-idf/components/spi_flash /home/eric/esp/esp-idf/components/spiffs /home/eric/esp/esp-idf/components/tcp_transport /home/eric/esp/esp-idf/components/ulp /home/eric/esp/esp-idf/components/unity /home/eric/esp/esp-idf/components/usb /home/eric/esp/esp-idf/components/vfs /home/eric/esp/esp-idf/components/wear_levelling /home/eric/esp/esp-idf/components/wifi_provisioning /home/eric/esp/esp-idf/components/wpa_supplicant /home/eric/esp/esp-idf/components/xtensa
-- Configuring done
-- Generating done
-- Build files have been written to: /home/eric/Software/micro_ros_espidf_component/examples/int32_publisher/build
Scoeerg commented 8 months ago

I believe is has something to do with

https://github.com/micro-ROS/micro_ros_espidf_component/commit/a71fb638eb89d9ccf97b7142b29ec981986a0d44

this commit labeled "C_Standard workaround"

Scoeerg commented 8 months ago

Since you determine which C_Standard to use based on ESP-IDF version within CMakeLists.txt I switched the version from ESP-IDF v5.0.4-dirty to ESP-IDF v4.4.6-98-g5f257494c5, yet again installed via VSCode Extension, which should change C_Standard from 17 to 11 to solve the problem. See:

# CMakeLists.txt
...
if (${IDF_VERSION_MAJOR} EQUAL 5)
    set(CMAKE_C_STANDARD 17)
else()
    set(CMAKE_C_STANDARD 11)
endif()
...

Long story short: does not work, but throws a different error:

Adding "set-target"'s dependency "fullclean" to list of commands with default set of options.
Executing action: fullclean
Executing action: set-target
Set Target to: esp32, new sdkconfig created. Existing sdkconfig renamed to sdkconfig.old.
Running cmake in directory /home/eric/Software/micro_ros_espidf_component/examples/int32_publisher/build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 -DIDF_TARGET=esp32 -DCCACHE_ENABLE=0 /home/eric/Software/micro_ros_espidf_component/examples/int32_publisher"...
-- Found Git: /usr/bin/git (found version "2.25.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: /home/eric/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
-- Check for working C compiler: /home/eric/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
-- Check for working C compiler: /home/eric/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /home/eric/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++
-- Check for working CXX compiler: /home/eric/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32
-- Project sdkconfig file /home/eric/Software/micro_ros_espidf_component/examples/int32_publisher/sdkconfig
Loading defaults file /home/eric/Software/micro_ros_espidf_component/examples/int32_publisher/sdkconfig.defaults...
-- Found Python3: /home/eric/.espressif/python_env/idf4.4_py3.8_env/bin/python3.8 (found version "3.8.10") found components: Interpreter 
-- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS
-- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS - Success
-- App "int32_publisher" version: 1.0.0-1-g0d6a175
-- Adding linker script /home/eric/Software/micro_ros_espidf_component/examples/int32_publisher/build/esp-idf/esp_system/ld/memory.ld
-- Adding linker script /home/eric/esp/esp-idf/components/esp_system/ld/esp32/sections.ld.in
-- Adding linker script /home/eric/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script /home/eric/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script /home/eric/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script /home/eric/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld
-- Adding linker script /home/eric/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld
-- Adding linker script /home/eric/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script /home/eric/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-time.ld
-- Adding linker script /home/eric/esp/esp-idf/components/soc/esp32/ld/esp32.peripherals.ld
rm -f /home/eric/Software/micro_ros_espidf_component/esp32_toolchain.cmake; \
cat /home/eric/Software/micro_ros_espidf_component/esp32_toolchain.cmake.in | \
    sed "s/@CMAKE_C_COMPILER@/\/home\/eric\/.espressif\/tools\/xtensa-esp32-elf\/esp-2021r2-patch5-8.4.0\/xtensa-esp32-elf\/bin\/xtensa-esp32-elf-gcc/g" | \
    sed "s/@CMAKE_CXX_COMPILER@/\/home\/eric\/.espressif\/tools\/xtensa-esp32-elf\/esp-2021r2-patch5-8.4.0\/xtensa-esp32-elf\/bin\/xtensa-esp32-elf-g++/g" | \
    sed "s/@CFLAGS@/-mlongcalls -Wno-frame-address  -ffunction-sections -fdata-sections/g" | \
    sed "s/@CXXFLAGS@/-mlongcalls -Wno-frame-address  -ffunction-sections -fdata-sections/g" | \
    sed "s/@IDF_TARGET@/esp32/g" | \
    sed "s/@IDF_PATH@/\/home\/eric\/esp\/esp-idf/g" | \
    sed "s/@BUILD_CONFIG_DIR@/\/home\/eric\/Software\/micro_ros_espidf_component\/examples\/int32_publisher\/build\/config/g" \
    > /home/eric/Software/micro_ros_espidf_component/esp32_toolchain.cmake
rm -rf micro_ros_dev; \
mkdir micro_ros_dev; cd micro_ros_dev; \
git clone -b foxy https://github.com/ament/ament_cmake src/ament_cmake; \
git clone -b foxy https://github.com/ament/ament_lint src/ament_lint; \
git clone -b foxy https://github.com/ament/ament_package src/ament_package; \
git clone -b foxy https://github.com/ament/googletest src/googletest; \
git clone -b foxy https://github.com/ros2/ament_cmake_ros src/ament_cmake_ros; \
colcon build;
rm -rf micro_ros_src; \
mkdir micro_ros_src; cd micro_ros_src; \
git clone -b foxy https://github.com/eProsima/micro-CDR src/micro-CDR; \
git clone -b foxy https://github.com/eProsima/Micro-XRCE-DDS-Client src/Micro-XRCE-DDS-Client; \
git clone -b foxy https://github.com/micro-ROS/rcl src/rcl; \
git clone -b foxy https://github.com/ros2/rclc src/rclc; \
git clone -b foxy https://github.com/micro-ROS/rcutils src/rcutils; \
git clone -b foxy https://github.com/micro-ROS/micro_ros_msgs src/micro_ros_msgs; \
git clone -b foxy https://github.com/micro-ROS/rmw-microxrcedds src/rmw-microxrcedds; \
git clone -b foxy https://github.com/micro-ROS/rosidl_typesupport src/rosidl_typesupport; \
git clone -b foxy https://github.com/micro-ROS/rosidl_typesupport_microxrcedds src/rosidl_typesupport_microxrcedds; \
git clone -b master https://github.com/ros2/tinydir_vendor src/tinydir_vendor; \
git clone -b foxy https://github.com/ros2/rosidl src/rosidl; \
git clone -b foxy https://github.com/ros2/rmw src/rmw; \
git clone -b foxy https://github.com/ros2/rcl_interfaces src/rcl_interfaces; \
git clone -b foxy https://github.com/ros2/rosidl_defaults src/rosidl_defaults; \
git clone -b foxy https://github.com/ros2/unique_identifier_msgs src/unique_identifier_msgs; \
git clone -b foxy https://github.com/ros2/common_interfaces src/common_interfaces; \
git clone -b foxy https://github.com/ros2/test_interface_files src/test_interface_files; \
git clone -b foxy https://github.com/ros2/rmw_implementation src/rmw_implementation; \
git clone -b foxy_microros https://gitlab.com/micro-ROS/ros_tracing/ros2_tracing src/ros2_tracing; \
touch src/rosidl/rosidl_typesupport_introspection_c/COLCON_IGNORE; \
    touch src/rosidl/rosidl_typesupport_introspection_cpp/COLCON_IGNORE; \
    touch src/rclc/rclc_examples/COLCON_IGNORE; \
touch src/rcl/rcl_yaml_param_parser/COLCON_IGNORE; \
cp -rf /home/eric/Software/micro_ros_espidf_component/extra_packages src/extra_packages || :; \
test -f src/extra_packages/extra_packages.repos && cd src/extra_packages && vcs import --input extra_packages.repos || :;
Cloning into 'src/ament_cmake'...
Cloning into 'src/micro-CDR'...
Cloning into 'src/ament_lint'...
Cloning into 'src/Micro-XRCE-DDS-Client'...
Cloning into 'src/ament_package'...
Cloning into 'src/rcl'...
Cloning into 'src/googletest'...
Cloning into 'src/rclc'...
Cloning into 'src/ament_cmake_ros'...
Cloning into 'src/rcutils'...
Cloning into 'src/micro_ros_msgs'...
[0.288s] WARNING:colcon.colcon_core.prefix_path.colcon:The path '/home/eric/Software/micro_ros_espidf_component/micro_ros_src/install' in the environment variable COLCON_PREFIX_PATH doesn't exist
[0.288s] WARNING:colcon.colcon_ros.prefix_path.ament:The path '/home/eric/Software/micro_ros_espidf_component/micro_ros_dev/install/ament_uncrustify' in the environment variable AMENT_PREFIX_PATH doesn't exist
[0.288s] WARNING:colcon.colcon_ros.prefix_path.ament:The path '/home/eric/Software/micro_ros_espidf_component/micro_ros_dev/install/ament_pycodestyle' in the environment variable AMENT_PREFIX_PATH doesn't exist
[0.288s] WARNING:colcon.colcon_ros.prefix_path.ament:The path '/home/eric/Software/micro_ros_espidf_component/micro_ros_dev/install/ament_package' in the environment variable AMENT_PREFIX_PATH doesn't exist
[0.288s] WARNING:colcon.colcon_ros.prefix_path.ament:The path '/home/eric/Software/micro_ros_espidf_component/micro_ros_dev/install/ament_lint' in the environment variable AMENT_PREFIX_PATH doesn't exist
[0.288s] WARNING:colcon.colcon_ros.prefix_path.ament:The path '/home/eric/Software/micro_ros_espidf_component/micro_ros_dev/install/ament_cppcheck' in the environment variable AMENT_PREFIX_PATH doesn't exist
[0.288s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path '/home/eric/Software/micro_ros_espidf_component/micro_ros_dev/install/gmock_vendor' in the environment variable CMAKE_PREFIX_PATH doesn't exist
[0.288s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path '/home/eric/Software/micro_ros_espidf_component/micro_ros_dev/install/gtest_vendor' in the environment variable CMAKE_PREFIX_PATH doesn't exist
Starting >>> ament_package
Starting >>> ament_lint
Starting >>> gtest_vendor
Starting >>> ament_cppcheck
Starting >>> ament_uncrustify
Starting >>> ament_pycodestyle
Cloning into 'src/rmw-microxrcedds'...
Finished <<< gtest_vendor [0.83s]
Starting >>> gmock_vendor
Cloning into 'src/rosidl_typesupport'...
Finished <<< gmock_vendor [0.12s]
Finished <<< ament_lint [1.23s]
Starting >>> ament_flake8
Finished <<< ament_pycodestyle [1.23s]
Finished <<< ament_cppcheck [1.25s]
Starting >>> ament_pyflakes
Finished <<< ament_uncrustify [1.27s]
Finished <<< ament_package [1.30s]
Cloning into 'src/rosidl_typesupport_microxrcedds'...
Starting >>> ament_cmake_core
--- stderr: ament_cmake_core
Traceback (most recent call last):
  File "/home/eric/Software/micro_ros_espidf_component/micro_ros_dev/src/ament_cmake/ament_cmake_core/cmake/core/package_xml_2_cmake.py", line 21, in <module>
    from catkin_pkg.package import parse_package_string
ModuleNotFoundError: No module named 'catkin_pkg'
CMake Error at cmake/core/ament_package_xml.cmake:94 (message):

  execute_process(/home/eric/.espressif/python_env/idf4.4_py3.8_env/bin/python3
  /home/eric/Software/micro_ros_espidf_component/micro_ros_dev/src/ament_cmake/ament_cmake_core/cmake/core/package_xml_2_cmake.py
  /home/eric/Software/micro_ros_espidf_component/micro_ros_dev/src/ament_cmake/ament_cmake_core/package.xml
  /home/eric/Software/micro_ros_espidf_component/micro_ros_dev/build/ament_cmake_core/ament_cmake_core/package.cmake)
  returned error code 1
Call Stack (most recent call first):
  cmake/core/ament_package_xml.cmake:49 (_ament_package_xml)
  CMakeLists.txt:15 (ament_package_xml)

---
Failed   <<< ament_cmake_core [0.24s, exited with code 1]
Aborted  <<< ament_flake8 [0.60s]
Aborted  <<< ament_pyflakes [0.58s]
Cloning into 'src/tinydir_vendor'...

Summary: 7 packages finished [2.04s]
  1 package failed: ament_cmake_core
  2 packages aborted: ament_flake8 ament_pyflakes
  1 package had stderr output: ament_cmake_core
  47 packages not processed
make: *** [libmicroros.mk:38: /home/eric/Software/micro_ros_espidf_component/micro_ros_dev/install] Error 1
make: *** Waiting for unfinished jobs....
Cloning into 'src/rosidl'...
Cloning into 'src/rmw'...
Cloning into 'src/rcl_interfaces'...
Cloning into 'src/rosidl_defaults'...
Cloning into 'src/unique_identifier_msgs'...
Cloning into 'src/common_interfaces'...
Cloning into 'src/test_interface_files'...
Cloning into 'src/rmw_implementation'...
Cloning into 'src/ros2_tracing'...
warning: redirecting to https://gitlab.com/micro-ROS/ros_tracing/ros2_tracing.git/
-- Components: app_trace app_update asio bootloader bootloader_support bt cbor cmock coap console cxx driver efuse esp-tls esp32 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 micro_ros_espidf_component mqtt newlib nghttp nvs_flash openssl openthread partition_table perfmon protobuf-c protocomm pthread sdmmc soc spi_flash spiffs tcp_transport tcpip_adapter tinyusb ulp unity usb vfs wear_levelling wifi_provisioning wpa_supplicant xtensa
-- Component paths: /home/eric/esp/esp-idf/components/app_trace /home/eric/esp/esp-idf/components/app_update /home/eric/esp/esp-idf/components/asio /home/eric/esp/esp-idf/components/bootloader /home/eric/esp/esp-idf/components/bootloader_support /home/eric/esp/esp-idf/components/bt /home/eric/esp/esp-idf/components/cbor /home/eric/esp/esp-idf/components/cmock /home/eric/esp/esp-idf/components/coap /home/eric/esp/esp-idf/components/console /home/eric/esp/esp-idf/components/cxx /home/eric/esp/esp-idf/components/driver /home/eric/esp/esp-idf/components/efuse /home/eric/esp/esp-idf/components/esp-tls /home/eric/esp/esp-idf/components/esp32 /home/eric/esp/esp-idf/components/esp_adc_cal /home/eric/esp/esp-idf/components/esp_common /home/eric/esp/esp-idf/components/esp_eth /home/eric/esp/esp-idf/components/esp_event /home/eric/esp/esp-idf/components/esp_gdbstub /home/eric/esp/esp-idf/components/esp_hid /home/eric/esp/esp-idf/components/esp_http_client /home/eric/esp/esp-idf/components/esp_http_server /home/eric/esp/esp-idf/components/esp_https_ota /home/eric/esp/esp-idf/components/esp_https_server /home/eric/esp/esp-idf/components/esp_hw_support /home/eric/esp/esp-idf/components/esp_ipc /home/eric/esp/esp-idf/components/esp_lcd /home/eric/esp/esp-idf/components/esp_local_ctrl /home/eric/esp/esp-idf/components/esp_netif /home/eric/esp/esp-idf/components/esp_phy /home/eric/esp/esp-idf/components/esp_pm /home/eric/esp/esp-idf/components/esp_ringbuf /home/eric/esp/esp-idf/components/esp_rom /home/eric/esp/esp-idf/components/esp_serial_slave_link /home/eric/esp/esp-idf/components/esp_system /home/eric/esp/esp-idf/components/esp_timer /home/eric/esp/esp-idf/components/esp_websocket_client /home/eric/esp/esp-idf/components/esp_wifi /home/eric/esp/esp-idf/components/espcoredump /home/eric/esp/esp-idf/components/esptool_py /home/eric/esp/esp-idf/components/expat /home/eric/esp/esp-idf/components/fatfs /home/eric/esp/esp-idf/components/freemodbus /home/eric/esp/esp-idf/components/freertos /home/eric/esp/esp-idf/components/hal /home/eric/esp/esp-idf/components/heap /home/eric/esp/esp-idf/components/idf_test /home/eric/esp/esp-idf/components/ieee802154 /home/eric/esp/esp-idf/components/jsmn /home/eric/esp/esp-idf/components/json /home/eric/esp/esp-idf/components/libsodium /home/eric/esp/esp-idf/components/log /home/eric/esp/esp-idf/components/lwip /home/eric/Software/micro_ros_espidf_component/examples/int32_publisher/main /home/eric/esp/esp-idf/components/mbedtls /home/eric/esp/esp-idf/components/mdns /home/eric/Software/micro_ros_espidf_component /home/eric/esp/esp-idf/components/mqtt /home/eric/esp/esp-idf/components/newlib /home/eric/esp/esp-idf/components/nghttp /home/eric/esp/esp-idf/components/nvs_flash /home/eric/esp/esp-idf/components/openssl /home/eric/esp/esp-idf/components/openthread /home/eric/esp/esp-idf/components/partition_table /home/eric/esp/esp-idf/components/perfmon /home/eric/esp/esp-idf/components/protobuf-c /home/eric/esp/esp-idf/components/protocomm /home/eric/esp/esp-idf/components/pthread /home/eric/esp/esp-idf/components/sdmmc /home/eric/esp/esp-idf/components/soc /home/eric/esp/esp-idf/components/spi_flash /home/eric/esp/esp-idf/components/spiffs /home/eric/esp/esp-idf/components/tcp_transport /home/eric/esp/esp-idf/components/tcpip_adapter /home/eric/esp/esp-idf/components/tinyusb /home/eric/esp/esp-idf/components/ulp /home/eric/esp/esp-idf/components/unity /home/eric/esp/esp-idf/components/usb /home/eric/esp/esp-idf/components/vfs /home/eric/esp/esp-idf/components/wear_levelling /home/eric/esp/esp-idf/components/wifi_provisioning /home/eric/esp/esp-idf/components/wpa_supplicant /home/eric/esp/esp-idf/components/xtensa
-- Configuring done
-- Generating done
-- Build files have been written to: /home/eric/Software/micro_ros_espidf_component/examples/int32_publisher/build
pablogs9 commented 8 months ago

micro-CDR sets C_STANDARD to 99:

https://github.com/eProsima/Micro-CDR/blob/3d1b17703c7cf4f22def2910bc845bdb5152d7b5/CMakeLists.txt#L114-L115

Scoeerg commented 8 months ago

The initial Error regarding C_Standard 17 takes place in

$(somePath)/micro_ros_espidf_component/micro_ros_src/build/microcdr/CMakeFiles/CMakeTmp/CMakeLists.txt:16

which to me seems to be an autogenerated CMakeLists.txt in a temporary directory. I would guess the default micro-CDR standard 99 will be overwritten by the command you are invoking within idf.py set-target esp32, namely:

colcon build \
    --merge-install \
    --packages-ignore-regex=.*_cpp \
    --metas /home/eric/Software/micro_ros_espidf_component/colcon.meta  \
    --cmake-args \
    "--no-warn-unused-cli" \
    -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=OFF \
    -DTHIRDPARTY=ON \
    -DBUILD_SHARED_LIBS=OFF \
    -DBUILD_TESTING=OFF \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_TOOLCHAIN_FILE=/home/eric/Software/micro_ros_espidf_component/esp32_toolchain.cmake \
    -DCMAKE_VERBOSE_MAKEFILE=OFF \
        -DIDF_INCLUDES='-I/home/eric/.../network_interfaces' \
    -DCMAKE_C_STANDARD=17 \
    -DUCLIENT_C_STANDARD=17;

which might explain the temporary CMakelists.txt with DCMAKE_C_STANDARD=17. Thanks for your reply :)

pablogs9 commented 8 months ago

I wonder which is the difference between your environment and the passing CI of this repo https://github.com/micro-ROS/micro_ros_espidf_component/actions/workflows/nightly.yml

Please if you find a solution for this, is possible to open a PR?

Scoeerg commented 8 months ago

Maybe I am blind, but:

Nightly builds Ubuntu Latest (points to Ubuntu 23.10?!) and [humble, iron, rolling] (rolling points to Iron again?!)

where I described my setup to be Ubuntu 20.04 and Foxy. Including of course micro_ros foxy branch.

pablogs9 commented 8 months ago

Nightly builds Ubuntu Latest (points to Ubuntu 23.10?!)

Dockers runs on Github's Ubuntu latest, but the CI build is running on top of the official Espressif docker ("espressif/idf:release-v4.3", "espressif/idf:release-v4.4", "espressif/idf:release-v5.0"). So AFAIK, it is a "common" and "clean" environment: https://github.com/micro-ROS/micro_ros_espidf_component/blob/d0e63d9ab1d4b1b2777e68b715c5ea6d20ad68f4/.github/workflows/nightly.yml#L19

and [humble, iron, rolling] (rolling points to Iron again?!)

Nightly runs from default branch with is iron, and there we are running in the 3 ROS 2 support distros:

https://github.com/micro-ROS/micro_ros_espidf_component/blob/d0e63d9ab1d4b1b2777e68b715c5ea6d20ad68f4/.github/workflows/nightly.yml#L17

Where is Rolling pointing to Iron?

where I described my setup to be Ubuntu 20.04 and Foxy. Including of course micro_ros foxy branch.

I'm not sure about the Ubuntu version compat wrt IDF, but micro-ROS Foxy is deprecated and EOL (as ROS 2 Foxy),

Scoeerg commented 8 months ago

Github Ubuntu Latest is 22.04 see

https://github.blog/changelog/2022-11-09-github-actions-ubuntu-latest-workflows-will-use-ubuntu-22-04/

And "Rolling" is meant to be Ros2 Rolling not the current (rolling) version of Ros2. My bad.

I am aware Foxy is EOL, but with some Nvidia Embedded Hardware currently only supports Ubuntu 20.04 based OS, hence I will have to stick to Foxy for now. By the way, this will be the case for many robotics applications until Q3/2024, see NVIDIA Jetpack Software Roadmap.

Which micro_ros branch (or specific commit) should work, if it's not Foxy-Branch?

pablogs9 commented 8 months ago

iron shall work, but may be incompatibilities at type level with foxy

e271 commented 8 months ago

I tried it with C_Standard 11 and got the same problem as you, first with catkin and then with other depencies.

I solved it with: pip install catkin_pkg pip install empy pip install lark

idf.py clean-microros idf.py set-target esp32

Probably you made it already, but just in case, is also important to set the source so: source /opt/ros/humble/setup.bash

Scoeerg commented 7 months ago

Thanks to @e271

TL;DR solves all problems:

# source ROS
source /opt/ros/foxy/setup.sh
# source ESP-IDF
cd esp-idf
source export.sh
idf.py --versions # returns ESP-IDF v4.4.6-150-g2bab3b36bc
# install missing dependencies in virtual environment:
pip install catkin_pkg
pip install empy
pip install lark
cd $yourpath//micro_ros_espidf_component/examples/int32_publisher
idf.py clean-microros
idf.py set-target esp32

DETAILS

Problem 0)

One has to source ROS2 even though the microros-esp README says not to: If you encounter issues during the build process, ensure that you are running in a clean shell environment without the ROS 2 setup script sourced.

@pablogs9 would be nice if you changed the README accordingly.

Problem 1) In order to compile with C_Standard 11 and not C_Standard 17, one must install ESP-IDF version 4 or earlier, see my earlier comment in this issue.

E.g. via VSCode Extension or manually

git clone -b release/v4.4 --recursive https://github.com/espressif/esp-idf
cd esp-idf
sh ./install.sh
source export.sh
idf.py --versions # returns ESP-IDF v4.4.6-150-g2bab3b36bc

@pablogs9 A fix would be to change the

# CMakeLists.txt
...
if (${IDF_VERSION_MAJOR} EQUAL 5)
    set(CMAKE_C_STANDARD 17)
else()
    set(CMAKE_C_STANDARD 11)
endif()
...

to always set the CMAKE_C_STANDARD to 11.

Problem 2)

Some dependencies are not automatically installed within the Python Virtual Environment, hence you must follow @e271 's comment.

pablogs9 commented 7 months ago

@Scoeerg it is stated in the Readme that you need to install dependecies: https://github.com/micro-ROS/micro_ros_espidf_component#dependencies

Also, the fact of not sourcing the ROS 2 environment has a reason: depending on the installation type, it would interfere with the micro-ROS packages build procedure.

With respect to C standard, it would be nice if you contribute back this patch in order improve this package.

Scoeerg commented 7 months ago

@pablogs9 will do! Thanks for your support!