sachin0x18 / rosserial_esp32

rosserial on ESP32 based on ESP-IDF
Other
39 stars 17 forks source link

unable to compile after porting rosserial to idf v4.x #2

Closed VedantParanjape closed 4 years ago

VedantParanjape commented 4 years ago

I added a CMakeLists.txt to rossserial_esp32 component to make it compatible with idf.py

My CMakeLists.txt content:

idf_component_register(SRCS "duration.cpp"
                            "time.cpp"
                            "esp_ros_wifi.c"
                    INCLUDE_DIRS "include"
                    REQUIRES vfs nvs_flash)

my code: https://github.com/VedantParanjape/ROS-Workshop-ESP32-Codes

Error:

[910/911] Linking CXX executable ROS_with_servo_control.elf
FAILED: : && /home/vedant/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++   -mlongcalls -Wno-frame-address   CMakeFiles/ROS_with_servo_control.elf.dir/project_elf_src.c.obj  -o ROS_with_servo_control.elf  esp-idf/xtensa/libxtensa.a esp-idf/esp_ringbuf/libesp_ringbuf.a esp-idf/bootloader_support/libbootloader_support.a esp-idf/efuse/libefuse.a esp-idf/driver/libdriver.a esp-idf/app_update/libapp_update.a esp-idf/nvs_flash/libnvs_flash.a esp-idf/pthread/libpthread.a esp-idf/espcoredump/libespcoredump.a esp-idf/perfmon/libperfmon.a esp-idf/esp32/libesp32.a esp-idf/esp_common/libesp_common.a esp-idf/soc/libsoc.a esp-idf/esp_eth/libesp_eth.a esp-idf/tcpip_adapter/libtcpip_adapter.a esp-idf/esp_netif/libesp_netif.a esp-idf/esp_event/libesp_event.a esp-idf/wpa_supplicant/libwpa_supplicant.a esp-idf/esp_wifi/libesp_wifi.a esp-idf/lwip/liblwip.a esp-idf/log/liblog.a esp-idf/heap/libheap.a esp-idf/app_trace/libapp_trace.a esp-idf/freertos/libfreertos.a esp-idf/vfs/libvfs.a esp-idf/newlib/libnewlib.a esp-idf/cxx/libcxx.a esp-idf/spi_flash/libspi_flash.a esp-idf/spiffs/libspiffs.a esp-idf/nghttp/libnghttp.a esp-idf/esp-tls/libesp-tls.a esp-idf/tcp_transport/libtcp_transport.a esp-idf/mqtt/libmqtt.a esp-idf/sdmmc/libsdmmc.a esp-idf/esp_serial_slave_link/libesp_serial_slave_link.a esp-idf/openssl/libopenssl.a esp-idf/wear_levelling/libwear_levelling.a esp-idf/esp_http_server/libesp_http_server.a esp-idf/cbor/libcbor.a esp-idf/protobuf-c/libprotobuf-c.a esp-idf/console/libconsole.a esp-idf/protocomm/libprotocomm.a esp-idf/mdns/libmdns.a esp-idf/json/libjson.a esp-idf/wifi_provisioning/libwifi_provisioning.a esp-idf/esp_http_client/libesp_http_client.a esp-idf/esp_websocket_client/libesp_websocket_client.a esp-idf/expat/libexpat.a esp-idf/rosserial_esp32/librosserial_esp32.a esp-idf/coap/libcoap.a esp-idf/jsmn/libjsmn.a esp-idf/fatfs/libfatfs.a esp-idf/esp_gdbstub/libesp_gdbstub.a esp-idf/asio/libasio.a esp-idf/esp_adc_cal/libesp_adc_cal.a esp-idf/ROS_SRA19/libROS_SRA19.a esp-idf/esp_https_ota/libesp_https_ota.a esp-idf/libsodium/liblibsodium.a esp-idf/freemodbus/libfreemodbus.a esp-idf/esp_local_ctrl/libesp_local_ctrl.a esp-idf/unity/libunity.a esp-idf/ulp/libulp.a -Wl,--cref -Wl,--Map=/home/vedant/ROS-Workshop-ESP32-Codes/codes/ROS_with_servo_control/build/ROS_with_servo_control.map -fno-rtti -fno-lto esp-idf/json/libjson.a esp-idf/sdmmc/libsdmmc.a esp-idf/wear_levelling/libwear_levelling.a esp-idf/protocomm/libprotocomm.a esp-idf/protobuf-c/libprotobuf-c.a esp-idf/mdns/libmdns.a esp-idf/console/libconsole.a esp-idf/cxx/libcxx.a esp-idf/newlib/libnewlib.a esp-idf/freertos/libfreertos.a esp-idf/heap/libheap.a esp-idf/log/liblog.a esp-idf/lwip/liblwip.a esp-idf/soc/libsoc.a esp-idf/esp_common/libesp_common.a esp-idf/esp32/libesp32.a esp-idf/xtensa/libxtensa.a esp-idf/mbedtls/mbedtls/library/libmbedtls.a esp-idf/mbedtls/mbedtls/library/libmbedcrypto.a esp-idf/mbedtls/mbedtls/library/libmbedx509.a esp-idf/spi_flash/libspi_flash.a esp-idf/efuse/libefuse.a esp-idf/bootloader_support/libbootloader_support.a esp-idf/esp_ringbuf/libesp_ringbuf.a esp-idf/app_update/libapp_update.a esp-idf/driver/libdriver.a esp-idf/app_trace/libapp_trace.a esp-idf/nvs_flash/libnvs_flash.a esp-idf/pthread/libpthread.a esp-idf/vfs/libvfs.a esp-idf/espcoredump/libespcoredump.a esp-idf/perfmon/libperfmon.a esp-idf/ulp/libulp.a esp-idf/esp_http_client/libesp_http_client.a esp-idf/esp_http_server/libesp_http_server.a esp-idf/esp_wifi/libesp_wifi.a esp-idf/wpa_supplicant/libwpa_supplicant.a esp-idf/tcpip_adapter/libtcpip_adapter.a esp-idf/esp_event/libesp_event.a esp-idf/esp_netif/libesp_netif.a esp-idf/esp_eth/libesp_eth.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libcoexist.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libcore.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libespnow.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libmesh.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libnet80211.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libpp.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/librtc.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libsmartconfig.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libphy.a esp-idf/nghttp/libnghttp.a esp-idf/esp-tls/libesp-tls.a esp-idf/tcp_transport/libtcp_transport.a esp-idf/cxx/libcxx.a esp-idf/newlib/libnewlib.a esp-idf/freertos/libfreertos.a esp-idf/heap/libheap.a esp-idf/log/liblog.a esp-idf/lwip/liblwip.a esp-idf/soc/libsoc.a esp-idf/esp_common/libesp_common.a esp-idf/esp32/libesp32.a esp-idf/xtensa/libxtensa.a esp-idf/mbedtls/mbedtls/library/libmbedtls.a esp-idf/mbedtls/mbedtls/library/libmbedcrypto.a esp-idf/mbedtls/mbedtls/library/libmbedx509.a esp-idf/spi_flash/libspi_flash.a esp-idf/efuse/libefuse.a esp-idf/bootloader_support/libbootloader_support.a esp-idf/esp_ringbuf/libesp_ringbuf.a esp-idf/app_update/libapp_update.a esp-idf/driver/libdriver.a esp-idf/app_trace/libapp_trace.a esp-idf/nvs_flash/libnvs_flash.a esp-idf/pthread/libpthread.a esp-idf/vfs/libvfs.a esp-idf/espcoredump/libespcoredump.a esp-idf/perfmon/libperfmon.a esp-idf/ulp/libulp.a esp-idf/esp_http_client/libesp_http_client.a esp-idf/esp_http_server/libesp_http_server.a esp-idf/esp_wifi/libesp_wifi.a esp-idf/wpa_supplicant/libwpa_supplicant.a esp-idf/tcpip_adapter/libtcpip_adapter.a esp-idf/esp_event/libesp_event.a esp-idf/esp_netif/libesp_netif.a esp-idf/esp_eth/libesp_eth.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libcoexist.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libcore.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libespnow.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libmesh.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libnet80211.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libpp.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/librtc.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libsmartconfig.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libphy.a esp-idf/nghttp/libnghttp.a esp-idf/esp-tls/libesp-tls.a esp-idf/tcp_transport/libtcp_transport.a esp-idf/cxx/libcxx.a esp-idf/newlib/libnewlib.a esp-idf/freertos/libfreertos.a esp-idf/heap/libheap.a esp-idf/log/liblog.a esp-idf/lwip/liblwip.a esp-idf/soc/libsoc.a esp-idf/esp_common/libesp_common.a esp-idf/esp32/libesp32.a esp-idf/xtensa/libxtensa.a esp-idf/mbedtls/mbedtls/library/libmbedtls.a esp-idf/mbedtls/mbedtls/library/libmbedcrypto.a esp-idf/mbedtls/mbedtls/library/libmbedx509.a esp-idf/spi_flash/libspi_flash.a esp-idf/efuse/libefuse.a esp-idf/bootloader_support/libbootloader_support.a esp-idf/esp_ringbuf/libesp_ringbuf.a esp-idf/app_update/libapp_update.a esp-idf/driver/libdriver.a esp-idf/app_trace/libapp_trace.a esp-idf/nvs_flash/libnvs_flash.a esp-idf/pthread/libpthread.a esp-idf/vfs/libvfs.a esp-idf/espcoredump/libespcoredump.a esp-idf/perfmon/libperfmon.a esp-idf/ulp/libulp.a esp-idf/esp_http_client/libesp_http_client.a esp-idf/esp_http_server/libesp_http_server.a esp-idf/esp_wifi/libesp_wifi.a esp-idf/wpa_supplicant/libwpa_supplicant.a esp-idf/tcpip_adapter/libtcpip_adapter.a esp-idf/esp_event/libesp_event.a esp-idf/esp_netif/libesp_netif.a esp-idf/esp_eth/libesp_eth.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libcoexist.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libcore.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libespnow.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libmesh.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libnet80211.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libpp.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/librtc.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libsmartconfig.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libphy.a esp-idf/nghttp/libnghttp.a esp-idf/esp-tls/libesp-tls.a esp-idf/tcp_transport/libtcp_transport.a esp-idf/cxx/libcxx.a esp-idf/newlib/libnewlib.a esp-idf/freertos/libfreertos.a esp-idf/heap/libheap.a esp-idf/log/liblog.a esp-idf/lwip/liblwip.a esp-idf/soc/libsoc.a esp-idf/esp_common/libesp_common.a esp-idf/esp32/libesp32.a esp-idf/xtensa/libxtensa.a esp-idf/mbedtls/mbedtls/library/libmbedtls.a esp-idf/mbedtls/mbedtls/library/libmbedcrypto.a esp-idf/mbedtls/mbedtls/library/libmbedx509.a esp-idf/spi_flash/libspi_flash.a esp-idf/efuse/libefuse.a esp-idf/bootloader_support/libbootloader_support.a esp-idf/esp_ringbuf/libesp_ringbuf.a esp-idf/app_update/libapp_update.a esp-idf/driver/libdriver.a esp-idf/app_trace/libapp_trace.a esp-idf/nvs_flash/libnvs_flash.a esp-idf/pthread/libpthread.a esp-idf/vfs/libvfs.a esp-idf/espcoredump/libespcoredump.a esp-idf/perfmon/libperfmon.a esp-idf/ulp/libulp.a esp-idf/esp_http_client/libesp_http_client.a esp-idf/esp_http_server/libesp_http_server.a esp-idf/esp_wifi/libesp_wifi.a esp-idf/wpa_supplicant/libwpa_supplicant.a esp-idf/tcpip_adapter/libtcpip_adapter.a esp-idf/esp_event/libesp_event.a esp-idf/esp_netif/libesp_netif.a esp-idf/esp_eth/libesp_eth.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libcoexist.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libcore.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libespnow.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libmesh.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libnet80211.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libpp.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/librtc.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libsmartconfig.a /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32/libphy.a esp-idf/nghttp/libnghttp.a esp-idf/esp-tls/libesp-tls.a esp-idf/tcp_transport/libtcp_transport.a -u __cxa_guard_dummy -lstdc++ esp-idf/pthread/libpthread.a -u __cxx_fatal_exception -lm esp-idf/newlib/libnewlib.a -u newlib_include_locks_impl -u newlib_include_heap_impl -u newlib_include_syscalls_impl -u newlib_include_pthread_impl -Wl,--undefined=uxTopUsedPriority -L /home/vedant/esp/esp-idf/components/esp_rom/esp32/ld -T esp32.rom.newlib-funcs-time.ld -T esp32.rom.ld -T esp32.rom.libgcc.ld -T esp32.rom.newlib-data.ld -T esp32.rom.syscalls.ld -T esp32.rom.newlib-funcs.ld -Wl,--gc-sections -L /home/vedant/ROS-Workshop-ESP32-Codes/codes/ROS_with_servo_control/build/esp-idf/esp32 -T esp32_out.ld -u app_main -L /home/vedant/ROS-Workshop-ESP32-Codes/codes/ROS_with_servo_control/build/esp-idf/esp32/ld -T esp32.project.ld -L /home/vedant/esp/esp-idf/components/esp32/ld -T esp32.peripherals.ld -lgcc -u call_user_start_cpu0 -u ld_include_panic_highint_hdl /home/vedant/esp/esp-idf/components/xtensa/esp32/libhal.a -u esp_app_desc esp-idf/app_trace/libapp_trace.a -lgcov esp-idf/app_trace/libapp_trace.a -lgcov -lc -u pthread_include_pthread_impl -u pthread_include_pthread_cond_impl -u pthread_include_pthread_local_storage_impl -u vfs_include_syscalls_impl -L /home/vedant/esp/esp-idf/components/esp_wifi/lib/esp32 && :
/home/vedant/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/esp32/libesp32.a(cpu_start.c.obj):(.literal.main_task+0x18): undefined reference to `app_main'
/home/vedant/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/esp32/libesp32.a(cpu_start.c.obj): in function `main_task':
/home/vedant/esp/esp-idf/components/esp32/cpu_start.c:550: undefined reference to `app_main'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
sachin0x18 commented 4 years ago

You will need to add a CMakeLists.txt file inside the main folder of your project (https://github.com/VedantParanjape/ROS-Workshop-ESP32-Codes/tree/master/codes/ROS_with_servo_control/main).

main folder is treated as a component and hence it requires its own CMakeLists.txt. Since there is no CMakeLists.txt inside the main folder, the build system excludes it and hence could not find reference to app_main

VedantParanjape commented 4 years ago

It compiles ! Thanks !

Getting some issues with linker while binary generation.

Error message

VedantParanjape commented 4 years ago

Update: deleting the build folder and recompiling fixed the issue