aws-samples / amazon-kinesis-video-streams-webrtc-sdk-c-for-freertos

Apache License 2.0
37 stars 26 forks source link

multiple rules generate esp-idf/main/lib/usrsctp/usrsctplib/libusrsctp.a #18

Closed TVD-Contributor closed 1 year ago

TVD-Contributor commented 2 years ago

I've checked out & patched as described in the readme, but get a build issue:

ninja: error: build.ninja:18619: multiple rules generate esp-idf/main/lib/usrsctp/usrsctplib/libusrsctp.a [-w dupbuild=err]

I've repeated the git clone & patch operations several times with the same result. I believe my ESP-IDF environment & tools is 4.3.2, though I reverted the esp-idf code to 4.3.1 so I could patch mbedtls. I'm building on Windows 10.

`D:\src\tvd\ESP32\aws-kinesis-video-webrtc>idf.py menuconfig Executing action: menuconfig Running cmake in directory d:\src\tvd\esp32\aws-kinesis-video-webrtc\build Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 -DIDF_TARGET=esp32 -DCCACHE_ENABLE=1 d:\src\tvd\esp32\aws-kinesis-video-webrtc"... -- Found Git: D:/Program Files/Git/cmd/git.exe (found version "2.31.0.windows.1") CMake Warning at C:/Users/xxx/esp/esp-idf/tools/cmake/git_submodules.cmake:52 (message): Git submodule components/mbedtls/mbedtls is out of date. Run 'git submodule update --init --recursive' to fix. Call Stack (most recent call first): C:/Users/xxx/esp/esp-idf/tools/cmake/build.cmake:77 (git_submodule_check) C:/Users/xxx/esp/esp-idf/tools/cmake/build.cmake:165 (build_get_idf_git_revision) C:/Users/xxx/esp/esp-idf/tools/cmake/idf.cmake:50 (build_init) C:/Users/xxx/esp/esp-idf/tools/cmake/project.cmake:7 (include) CMakeLists.txt:5 (include)

-- ccache will be used for faster recompilation -- The C compiler identification is GNU 8.4.0 -- The CXX compiler identification is GNU 8.4.0 -- The ASM compiler identification is GNU -- Found assembler: C:/Users/xxx/.espressif/tools/xtensa-esp32-elf/esp-2021r1-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe -- Check for working C compiler: C:/Users/xxx/.espressif/tools/xtensa-esp32-elf/esp-2021r1-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe -- Check for working C compiler: C:/Users/xxx/.espressif/tools/xtensa-esp32-elf/esp-2021r1-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe -- 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: C:/Users/xxx/.espressif/tools/xtensa-esp32-elf/esp-2021r1-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++.exe -- Check for working CXX compiler: C:/Users/xxx/.espressif/tools/xtensa-esp32-elf/esp-2021r1-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++.exe -- 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 D:/src/tvd/ESP32/aws-kinesis-video-webrtc/sdkconfig D:/src/tvd/ESP32/aws-kinesis-video-webrtc/sdkconfig:321 CONFIG_ESP32_PANIC_PRINT_REBOOT was replaced with CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT D:/src/tvd/ESP32/aws-kinesis-video-webrtc/sdkconfig:512 CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE was replaced with CONFIG_ESP_COREDUMP_ENABLE_TO_NONE D:/src/tvd/ESP32/aws-kinesis-video-webrtc/sdkconfig:988 CONFIG_SEMIHOSTFS_MAX_MOUNT_POINTS was replaced with CONFIG_VFS_SEMIHOSTFS_MAX_MOUNT_POINTS D:/src/tvd/ESP32/aws-kinesis-video-webrtc/sdkconfig:989 CONFIG_SEMIHOSTFS_HOST_PATH_MAX_LEN was replaced with CONFIG_VFS_SEMIHOSTFS_HOST_PATH_MAX_LEN -- Found PythonInterp: C:/Users/xxx/.espressif/python_env/idf4.3_py3.8_env/Scripts/python.exe (found version "3.8.7") -- Could NOT find Perl (missing: PERL_EXECUTABLE) -- App "webrtc_example" version: 6e9598d-dirty -- Adding linker script C:/Users/xxx/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld -- Adding linker script C:/Users/xxx/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.api.ld -- Adding linker script C:/Users/xxx/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld -- Adding linker script C:/Users/xxx/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld -- Adding linker script C:/Users/xxx/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld -- Adding linker script D:/src/tvd/ESP32/aws-kinesis-video-webrtc/build/esp-idf/esp32/esp32_out.ld -- Adding linker script C:/Users/xxx/esp/esp-idf/components/esp32/ld/esp32.project.ld.in -- Adding linker script C:/Users/xxx/esp/esp-idf/components/esp32/ld/esp32.peripherals.ld ############################## start llhttp ############################## ############################## start wslay ############################## -- Looking for arpa/inet.h -- Looking for arpa/inet.h - not found -- Looking for netinet/in.h -- Looking for netinet/in.h - not found -- Looking for winsock2.h -- Looking for winsock2.h - not found -- Check if the system is big endian -- Searching 16 bit integer -- 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 unsigned short -- Check size of unsigned short - done -- Using unsigned short -- Check if the system is big endian - little endian CMake Warning (dev) at main/lib/wslay/lib/CMakeLists.txt:43 (add_library): ADD_LIBRARY called with SHARED option but the target platform does not support dynamic linking. Building a STATIC library instead. This may lead to problems. This warning is for project developers. Use -Wno-dev to suppress it.

KVS_LIBWSLAY_INCLUDE_DIRS:D:/src/tvd/ESP32/aws-kinesis-video-webrtc/main/lib/wslay/lib/includes;D:/src/tvd/ESP32/aws-kinesis-video-webrtc/build/esp-idf/main/lib/wslay/lib/includes ############################## start srtp ############################## -- Looking for byteswap.h -- Looking for byteswap.h - not found -- Looking for inttypes.h -- Looking for inttypes.h - found -- Looking for machine/types.h -- Looking for machine/types.h - not found -- Looking for stdlib.h -- Looking for stdlib.h - found -- Looking for sys/int_types.h -- Looking for sys/int_types.h - not found -- Looking for sys/socket.h -- Looking for sys/socket.h - not found -- Looking for unistd.h -- Looking for unistd.h - found -- Looking for windows.h -- Looking for windows.h - not found -- Looking for sigaction -- Looking for sigaction - not found -- Looking for inet_aton -- Looking for inet_aton - not found -- Looking for usleep -- Looking for usleep - not found -- Check size of uint8_t -- Check size of uint8_t - done -- Check size of uint16_t -- Check size of uint16_t - done -- Check size of uint32_t -- Check size of uint32_t - done -- Check size of uint64_t -- Check size of uint64_t - done -- Check size of int32_t -- Check size of int32_t - done -- Check size of unsigned long -- Check size of unsigned long - done -- Check size of unsigned long long -- Check size of unsigned long long - done -- Performing Test HAVE_INLINE -- Performing Test HAVE_INLINE - Success ############################## start sctp ############################## -- No build type selected, using DEBUG -- Looking for include file sys/queue.h -- Looking for include file sys/queue.h - found -- Looking for include files sys/socket.h, linux/if_addr.h -- Looking for include files sys/socket.h, linux/if_addr.h - not found -- Looking for include files sys/socket.h, linux/rtnetlink.h -- Looking for include files sys/socket.h, linux/rtnetlink.h - not found -- Looking for 4 include files sys/types.h, ..., netinet/ip_icmp.h -- Looking for 4 include files sys/types.h, ..., netinet/ip_icmp.h - not found -- Looking for include file stdatomic.h -- Looking for include file stdatomic.h - found -- Looking for usrsctp.h -- Looking for usrsctp.h - not found -- Performing Test have_sa_len -- Performing Test have_sa_len - Failed -- Performing Test have_sin_len -- Performing Test have_sin_len - Failed -- Performing Test have_sin6_len -- Performing Test have_sin6_len - Failed -- Performing Test have_sconn_len -- Performing Test have_sconn_len - Failed -- HAVE_SCONN_LEN -- Performing Test has_wfloat_equal -- Performing Test has_wfloat_equal - Success -- Performing Test has_wshadow -- Performing Test has_wshadow - Success -- Performing Test has_wpointer_aritih -- Performing Test has_wpointer_aritih - Success -- Performing Test has_wunreachable_code -- Performing Test has_wunreachable_code - Success -- Performing Test has_winit_self -- Performing Test has_winit_self - Success -- Performing Test has_wno_unused_function -- Performing Test has_wno_unused_function - Success -- Performing Test has_wno_unused_parameter -- Performing Test has_wno_unused_parameter - Success -- Performing Test has_wno_unreachable_code -- Performing Test has_wno_unreachable_code - Success -- Performing Test has_wstrict_prototypes -- Performing Test has_wstrict_prototypes - Success -- Compiler flags (CMAKE_C_FLAGS): -mlongcalls -Wno-frame-address -std=c99 -pedantic -Wall -Wextra -Wfloat-equal -Wshadow -Wpointer-arith -Wunreachable-code -Winit-self -Wno-unused-function -Wno-unused-parameter -Wno-unreachable-code -Wstrict-prototypes -- Performing Test has_wno_address_of_packed_member -- Performing Test has_wno_address_of_packed_member - Success -- Performing Test has_wno_deprecated_declarations -- Performing Test has_wno_deprecated_declarations - Success CMake Warning (dev) at main/lib/usrsctp/usrsctplib/CMakeLists.txt:183 (add_library): ADD_LIBRARY called with SHARED option but the target platform does not support dynamic linking. Building a STATIC library instead. This may lead to problems. This warning is for project developers. Use -Wno-dev to suppress it.

############################## start webrtc ############################## -- Looking for include file ifaddrs.h -- Looking for include file ifaddrs.h - not found -- Looking for getifaddrs -- Looking for getifaddrs - not found -- Looking for getenv -- Looking for getenv - found -- Looking for include file netinet/tcp.h -- Looking for include file netinet/tcp.h - not found -- Kinesis Video WebRTC Client path is D:/src/tvd/ESP32/aws-kinesis-video-webrtc/main/lib/amazon-kinesis-video-streams-webrtc-sdk-c -- dependencies install path is -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - not found -- Check if compiler accepts -pthread -- Check if compiler accepts -pthread - no -- Could NOT find Threads (missing: Threads_FOUND) -- Found PkgConfig: D:/gstreamer/1.0/msvc_x86_64/bin/pkg-config.exe (found version "0.29.2") -- Checking for module 'gstreamer-1.0' -- Found gstreamer-1.0, version 1.20.0 -- Checking for module 'glib-2.0' -- Found glib-2.0, version 2.62.6 -- Checking for module 'gstreamer-app-1.0' -- Found gstreamer-app-1.0, version 1.20.0 -- Checking for module 'gobject-2.0' -- Found gobject-2.0, version 2.62.6 gstreamer found. Will build gstreamer samples -- 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_local_ctrl esp_netif 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 jsmn json libsodium log lwip main mbedtls mdns mqtt newlib nghttp nvs_flash openssl partition_table perfmon protobuf-c protocomm pthread sdmmc soc spi_flash spiffs tcp_transport tcpip_adapter tinyusb ulp unity vfs wear_levelling wifi_provisioning wpa_supplicant xtensa -- Component paths: C:/Users/xxx/esp/esp-idf/components/app_trace C:/Users/xxx/esp/esp-idf/components/app_update C:/Users/xxx/esp/esp-idf/components/asio C:/Users/xxx/esp/esp-idf/components/bootloader C:/Users/xxx/esp/esp-idf/components/bootloader_support C:/Users/xxx/esp/esp-idf/components/bt C:/Users/xxx/esp/esp-idf/components/cbor C:/Users/xxx/esp/esp-idf/components/cmock C:/Users/xxx/esp/esp-idf/components/coap C:/Users/xxx/esp/esp-idf/components/console C:/Users/xxx/esp/esp-idf/components/cxx C:/Users/xxx/esp/esp-idf/components/driver C:/Users/xxx/esp/esp-idf/components/efuse C:/Users/xxx/esp/esp-idf/components/esp-tls C:/Users/xxx/esp/esp-idf/components/esp32 C:/Users/xxx/esp/esp-idf/components/esp_adc_cal C:/Users/xxx/esp/esp-idf/components/esp_common C:/Users/xxx/esp/esp-idf/components/esp_eth C:/Users/xxx/esp/esp-idf/components/esp_event C:/Users/xxx/esp/esp-idf/components/esp_gdbstub C:/Users/xxx/esp/esp-idf/components/esp_hid C:/Users/xxx/esp/esp-idf/components/esp_http_client C:/Users/xxx/esp/esp-idf/components/esp_http_server C:/Users/xxx/esp/esp-idf/components/esp_https_ota C:/Users/xxx/esp/esp-idf/components/esp_https_server C:/Users/xxx/esp/esp-idf/components/esp_hw_support C:/Users/xxx/esp/esp-idf/components/esp_ipc C:/Users/xxx/esp/esp-idf/components/esp_local_ctrl C:/Users/xxx/esp/esp-idf/components/esp_netif C:/Users/xxx/esp/esp-idf/components/esp_pm C:/Users/xxx/esp/esp-idf/components/esp_ringbuf C:/Users/xxx/esp/esp-idf/components/esp_rom C:/Users/xxx/esp/esp-idf/components/esp_serial_slave_link C:/Users/xxx/esp/esp-idf/components/esp_system C:/Users/xxx/esp/esp-idf/components/esp_timer C:/Users/xxx/esp/esp-idf/components/esp_websocket_client C:/Users/xxx/esp/esp-idf/components/esp_wifi C:/Users/xxx/esp/esp-idf/components/espcoredump C:/Users/xxx/esp/esp-idf/components/esptool_py C:/Users/xxx/esp/esp-idf/components/expat C:/Users/xxx/esp/esp-idf/components/fatfs C:/Users/xxx/esp/esp-idf/components/freemodbus C:/Users/xxx/esp/esp-idf/components/freertos C:/Users/xxx/esp/esp-idf/components/hal C:/Users/xxx/esp/esp-idf/components/heap C:/Users/xxx/esp/esp-idf/components/idf_test C:/Users/xxx/esp/esp-idf/components/jsmn C:/Users/xxx/esp/esp-idf/components/json C:/Users/xxx/esp/esp-idf/components/libsodium C:/Users/xxx/esp/esp-idf/components/log C:/Users/xxx/esp/esp-idf/components/lwip D:/src/tvd/ESP32/aws-kinesis-video-webrtc/main C:/Users/xxx/esp/esp-idf/components/mbedtls C:/Users/xxx/esp/esp-idf/components/mdns C:/Users/xxx/esp/esp-idf/components/mqtt C:/Users/xxx/esp/esp-idf/components/newlib C:/Users/xxx/esp/esp-idf/components/nghttp C:/Users/xxx/esp/esp-idf/components/nvs_flash C:/Users/xxx/esp/esp-idf/components/openssl C:/Users/xxx/esp/esp-idf/components/partition_table C:/Users/xxx/esp/esp-idf/components/perfmon C:/Users/xxx/esp/esp-idf/components/protobuf-c C:/Users/xxx/esp/esp-idf/components/protocomm C:/Users/xxx/esp/esp-idf/components/pthread C:/Users/xxx/esp/esp-idf/components/sdmmc C:/Users/xxx/esp/esp-idf/components/soc C:/Users/xxx/esp/esp-idf/components/spi_flash C:/Users/xxx/esp/esp-idf/components/spiffs C:/Users/xxx/esp/esp-idf/components/tcp_transport C:/Users/xxx/esp/esp-idf/components/tcpip_adapter C:/Users/xxx/esp/esp-idf/components/tinyusb C:/Users/xxx/esp/esp-idf/components/ulp C:/Users/xxx/esp/esp-idf/components/unity C:/Users/xxx/esp/esp-idf/components/vfs C:/Users/xxx/esp/esp-idf/components/wear_levelling C:/Users/xxx/esp/esp-idf/components/wifi_provisioning C:/Users/xxx/esp/esp-idf/components/wpa_supplicant C:/Users/xxx/esp/esp-idf/components/xtensa -- Configuring done -- Generating done -- Build files have been written to: D:/src/tvd/ESP32/aws-kinesis-video-webrtc/build Running ninja in directory d:\src\tvd\esp32\aws-kinesis-video-webrtc\build Executing "ninja menuconfig"... ninja: error: build.ninja:18619: multiple rules generate esp-idf/main/lib/usrsctp/usrsctplib/libusrsctp.a [-w dupbuild=err]

ninja failed with exit code 1`

TVD-Contributor commented 2 years ago

@ycyang1229 Hoping you might be able to look at this, I'm not very familiar with CMake/Ninja etc.

dhornacek-spindance commented 2 years ago

@TVD-Contributor wanted to check in and see if you found any solution in the meantime? I am running into the same issue for the same file. Cannot pinpoint where this duplication is occurring.

Update (5/4) - @TVD-Contributor we were able to get past this, and successfully configure, by pointing master back to commit 05cd8cd0a0ad2d660bf0d499c9cc6810983a2a8f which is just before usrsctp was added. I think this module only affects the data channeling feature. Obviously not a fix by any means but a workaround in the meantime in case anyone else runs into this.

TVD-Contributor commented 2 years ago

@TVD-Contributor wanted to check in and see if you found any solution in the meantime? I am running into the same issue for the same file. Cannot pinpoint where this duplication is occurring.

Glad you found a work-around. My solution was to comment out this line in main\lib\usrsctp\usrsctplib\CMakeLists.txt (line 203 in my copy):

# set_target_properties(usrsctp-static PROPERTIES OUTPUT_NAME "usrsctp")

I also needed to add an audio track in order for the demo to work in Chrome (I think it was?) by uncommenting these lines in AppCommon.c (lines 649-660). Without it, it'll be missing from the ESP32's SDP and Chrome will reject the negotiation, as Chrome demands all of its media tracks are at least acknowledged. It can be simply set to "inactive" but it must be present.

CHK_STATUS((queryMediaAudioCap(pAppConfiguration->pMediaContext, &codec)));
CHK_STATUS((addSupportedCodec(pStreamingSession->pPeerConnection, codec)));
pAudioTrack->kind = MEDIA_STREAM_TRACK_KIND_AUDIO;
pAudioTrack->codec = codec;
//audioRtpTransceiverInit.direction = RTC_RTP_TRANSCEIVER_DIRECTION_SENDONLY;
audioRtpTransceiverInit.direction = RTC_RTP_TRANSCEIVER_DIRECTION_INACTIVE;
STRCPY(pAudioTrack->streamId, APP_AUDIO_TRACK_STREAM_ID);
STRCPY(pAudioTrack->trackId, APP_AUDIO_TRACK_ID);
CHK_STATUS((addTransceiver(pStreamingSession->pPeerConnection, pAudioTrack, &audioRtpTransceiverInit, &pStreamingSession->pAudioRtcRtpTransceiver)));

CHK_STATUS((transceiverOnBandwidthEstimation(pStreamingSession->pAudioRtcRtpTransceiver, (UINT64) pStreamingSession, onBandwidthEstimationHandler)));
dhornacek-spindance commented 2 years ago

@TVD-Contributor Thanks for the response! Appreciate the extra info about the audio. I was able to configure, but am currently running into compile errors when trying to build. I am curious if you ran into these also? It's mostly error: redefinition of typedef 'UINT32' with different type for multiple files. I am also running into a lot of inline function ... declared but never defined. Wanted to check just in case.

TVD-Contributor commented 2 years ago

@dhornacek-spindance I don't recall those compiler errors when compiling with ESP-IDF 4.3.1 environment (and make sure you follow the full steps to apply all the patches supplied in the AWS-KVS sample). So that's Xtensa esp-2021r1-8.4.0 - obviously I'm targeting ESP32 (not ESP32S2 etc.). I'm using VSCode.

I haven't tried compiling for IDF 4.4 yet.

TVD-Contributor commented 2 years ago

@dhornacek-spindance Oh, I'm also on Windows, perhaps the redefinitions are a consequence of WIN32 being defined, or not?

ayazalavi commented 2 years ago

I am having same build error. I am using idf v4.4.1. Can anyone guide to fix this problem? Above fixes are not working either.

@TVD-Contributor wanted to check in and see if you found any solution in the meantime? I am running into the same issue for the same file. Cannot pinpoint where this duplication is occurring.

Update (5/4) - @TVD-Contributor we were able to get past this, and successfully configure, by pointing master back to commit 05cd8cd0a0ad2d660bf0d499c9cc6810983a2a8f which is just before usrsctp was added. I think this module only affects the data channeling feature. Obviously not a fix by any means but a workaround in the meantime in case anyone else runs into this.

Will this let me do WebRTC call with peer?

ayazalavi commented 2 years ago

any one having this problem can turn off data channel by editing line 2 in CMakeLists.txt to:

option(ENABLE_DATA_CHANNEL "enable the data channel" OFF)

ycyang1229 commented 1 year ago

Please try the new commits and it should be fixed.