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

Package/libdatachannel #26013

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

metalMajor
Copy link
Contributor

Summary

New recipe: libdatachannel/0.22.2

Motivation

A new package not yet in conan, which allows to setup WebRTC video, audio and datastreams between peers.

Details

This PR is a duplicate, but the other one is closed due to inactivity.


@metalMajor metalMajor marked this pull request as draft November 22, 2024 13:31
@metalMajor metalMajor marked this pull request as ready for review November 22, 2024 15:21
@metalMajor
Copy link
Contributor Author

There is just one thing: using the 'libdatachannel/*:shared=True' option is failing the build, it seems to not link openssl with either libnice or libjuice.

@AbrilRBS AbrilRBS self-assigned this Nov 25, 2024
@AbrilRBS
Copy link
Member

Hi @metalMajor thanks again for taking the time to create the PR. I've done some changes to support shared builds and Windows, as well as using other ssl implementations (Although currently I can't get mbedtls to compile!)

The most important fix here was to use the CMakeDeps integration so that then cmake can properly find the dependencies. This was the root cause of not being able to link to you saw. Windows support just needed to follow upstream definitions for shard/static builds and necessary defines, otherwise most of the work was already done. Tomorrow I'll post compilation logs with non-default options if the CI passes, and take some time to look into the mbedtls compilation failures, which locally for me present as:

-------- Installing package libdatachannel/0.22.2 (7 of 7) --------
libdatachannel/0.22.2: Building from source
libdatachannel/0.22.2: Package libdatachannel/0.22.2:067c42719d2dc13d822ba75aef10ffad33c1c1cf
libdatachannel/0.22.2: Copying sources to build folder
libdatachannel/0.22.2: Building your package in /Users/abril/.conan2/p/b/libdafd0995e33eb5b/b
libdatachannel/0.22.2: Calling generate()
libdatachannel/0.22.2: Generators folder: /Users/abril/.conan2/p/b/libdafd0995e33eb5b/b/build/Release/generators
libdatachannel/0.22.2: CMakeToolchain generated: conan_toolchain.cmake
libdatachannel/0.22.2: CMakeToolchain generated: /Users/abril/.conan2/p/b/libdafd0995e33eb5b/b/build/Release/generators/CMakePresets.json
libdatachannel/0.22.2: CMakeToolchain generated: /Users/abril/.conan2/p/b/libdafd0995e33eb5b/b/src/CMakeUserPresets.json
libdatachannel/0.22.2: CMakeDeps necessary find_package() and targets for your CMakeLists.txt
    find_package(MbedTLS)
    find_package(plog)
    find_package(usrsctp)
    find_package(libSRTP)
    find_package(nlohmann_json)
    find_package(LibJuice)
    target_link_libraries(... MbedTLS::mbedtls plog::plog Usrsctp::Usrsctp libSRTP::srtp2 nlohmann_json::nlohmann_json LibJuice::LibJuice)
libdatachannel/0.22.2: Generating aggregated env files
libdatachannel/0.22.2: Generated aggregated env files: ['conanbuild.sh', 'conanrun.sh']
libdatachannel/0.22.2: Calling build()
libdatachannel/0.22.2: Running CMake.configure()
libdatachannel/0.22.2: RUN: cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/Users/abril/.conan2/p/b/libdafd0995e33eb5b/p" -DPREFER_SYSTEM_LIB="ON" -DUSE_SYSTEM_SRTP="ON" -DUSE_SYSTEM_USRSCTP="ON" -DUSE_SYSTEM_PLOG="ON" -DUSE_SYSTEM_JSON="ON" -DNO_EXAMPLES="ON" -DNO_TESTS="ON" -DNO_WEBSOCKET="OFF" -DUSE_NICE="OFF" -DUSE_SYSTEM_JUICE="ON" -DUSE_MBEDTLS="ON" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "/Users/abril/.conan2/p/b/libdafd0995e33eb5b/b/src"
-- Using Conan toolchain: /Users/abril/.conan2/p/b/libdafd0995e33eb5b/b/build/Release/generators/conan_toolchain.cmake
-- Conan toolchain: Setting CMAKE_POSITION_INDEPENDENT_CODE=ON (options.fPIC)
-- Conan toolchain: Defining libcxx as C++ flags: -stdlib=libc++
-- Conan toolchain: C++ Standard 17 with extensions ON
-- Conan toolchain: Setting BUILD_SHARED_LIBS = OFF
-- The CXX compiler identification is AppleClang 16.0.0.16000026
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Conan: Target declared 'plog::plog'
-- Conan: Target declared 'Usrsctp::Usrsctp'
-- Conan: Target declared 'libSRTP::srtp2'
-- Conan: Component target declared 'MbedTLS::mbedcrypto'
-- Conan: Component target declared 'MbedTLS::mbedx509'
-- Conan: Component target declared 'MbedTLS::MbedTLS'
-- Conan: Target declared 'MbedTLS::mbedtls'
-- Conan: Target declared 'LibJuice::LibJuice'
-- Configuring done (1.0s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/abril/.conan2/p/b/libdafd0995e33eb5b/b/build/Release

libdatachannel/0.22.2: Running CMake.build()
libdatachannel/0.22.2: RUN: cmake --build "/Users/abril/.conan2/p/b/libdafd0995e33eb5b/b/build/Release" -- -j12
[  0%] Building CXX object CMakeFiles/datachannel.dir/src/candidate.cpp.o
[  2%] Building CXX object CMakeFiles/datachannel.dir/src/configuration.cpp.o
[  4%] Building CXX object CMakeFiles/datachannel.dir/src/channel.cpp.o
[  6%] Building CXX object CMakeFiles/datachannel.dir/src/track.cpp.o
[  8%] Building CXX object CMakeFiles/datachannel.dir/src/datachannel.cpp.o
[  8%] Building CXX object CMakeFiles/datachannel.dir/src/global.cpp.o
[ 10%] Building CXX object CMakeFiles/datachannel.dir/src/mediahandler.cpp.o
[ 12%] Building CXX object CMakeFiles/datachannel.dir/src/websocket.cpp.o
[ 14%] Building CXX object CMakeFiles/datachannel.dir/src/description.cpp.o
[ 16%] Building CXX object CMakeFiles/datachannel.dir/src/peerconnection.cpp.o
[ 18%] Building CXX object CMakeFiles/datachannel.dir/src/rtcpreceivingsession.cpp.o
[ 20%] Building CXX object CMakeFiles/datachannel.dir/src/message.cpp.o
[ 22%] Building CXX object CMakeFiles/datachannel.dir/src/rtppacketizationconfig.cpp.o
[ 22%] Building CXX object CMakeFiles/datachannel.dir/src/websocketserver.cpp.o
[ 24%] Building CXX object CMakeFiles/datachannel.dir/src/rtcpsrreporter.cpp.o
[ 26%] Building CXX object CMakeFiles/datachannel.dir/src/rtppacketizer.cpp.o
[ 28%] Building CXX object CMakeFiles/datachannel.dir/src/rtpdepacketizer.cpp.o
[ 30%] Building CXX object CMakeFiles/datachannel.dir/src/h264rtppacketizer.cpp.o
[ 32%] Building CXX object CMakeFiles/datachannel.dir/src/h264rtpdepacketizer.cpp.o
[ 32%] Building CXX object CMakeFiles/datachannel.dir/src/nalunit.cpp.o
[ 34%] Building CXX object CMakeFiles/datachannel.dir/src/h265rtppacketizer.cpp.o
[ 36%] Building CXX object CMakeFiles/datachannel.dir/src/h265nalunit.cpp.o
[ 38%] Building CXX object CMakeFiles/datachannel.dir/src/av1rtppacketizer.cpp.o
[ 40%] Building CXX object CMakeFiles/datachannel.dir/src/rtcpnackresponder.cpp.o
[ 42%] Building CXX object CMakeFiles/datachannel.dir/src/rtp.cpp.o
[ 44%] Building CXX object CMakeFiles/datachannel.dir/src/capi.cpp.o
[ 44%] Building CXX object CMakeFiles/datachannel.dir/src/plihandler.cpp.o
[ 46%] Building CXX object CMakeFiles/datachannel.dir/src/pacinghandler.cpp.o
[ 48%] Building CXX object CMakeFiles/datachannel.dir/src/rembhandler.cpp.o
[ 50%] Building CXX object CMakeFiles/datachannel.dir/src/impl/certificate.cpp.o
[ 52%] Building CXX object CMakeFiles/datachannel.dir/src/impl/channel.cpp.o
[ 54%] Building CXX object CMakeFiles/datachannel.dir/src/impl/datachannel.cpp.o
[ 54%] Building CXX object CMakeFiles/datachannel.dir/src/impl/dtlssrtptransport.cpp.o
[ 56%] Building CXX object CMakeFiles/datachannel.dir/src/impl/dtlstransport.cpp.o
[ 58%] Building CXX object CMakeFiles/datachannel.dir/src/impl/icetransport.cpp.o
[ 60%] Building CXX object CMakeFiles/datachannel.dir/src/impl/init.cpp.o
[ 62%] Building CXX object CMakeFiles/datachannel.dir/src/impl/peerconnection.cpp.o
[ 64%] Building CXX object CMakeFiles/datachannel.dir/src/impl/logcounter.cpp.o
[ 66%] Building CXX object CMakeFiles/datachannel.dir/src/impl/sctptransport.cpp.o
[ 66%] Building CXX object CMakeFiles/datachannel.dir/src/impl/threadpool.cpp.o
[ 68%] Building CXX object CMakeFiles/datachannel.dir/src/impl/tls.cpp.o
/Users/abril/.conan2/p/b/libdafd0995e33eb5b/b/src/src/impl/dtlssrtptransport.cpp:272:2: error: use of undeclared identifier 'mbedtls_dtls_srtp_info'; did you mean 'mbedtls_x509_crt_info'?
  272 |         mbedtls_dtls_srtp_info srtpInfo;
      |         ^~~~~~~~~~~~~~~~~~~~~~
      |         mbedtls_x509_crt_info
/Users/abril/.conan2/p/b/mbedt6e0a9295e63aa/p/include/mbedtls/x509_crt.h:581:5: note: 'mbedtls_x509_crt_info' declared here
  581 | int mbedtls_x509_crt_info(char *buf, size_t size, const char *prefix,
      |     ^
/Users/abril/.conan2/p/b/libdafd0995e33eb5b/b/src/src/impl/dtlssrtptransport.cpp:272:24: error: expected ';' after expression
  272 |         mbedtls_dtls_srtp_info srtpInfo;
      |                               ^
      |                               ;
/Users/abril/.conan2/p/b/libdafd0995e33eb5b/b/src/src/impl/dtlssrtptransport.cpp:272:25: error: use of undeclared identifier 'srtpInfo'
  272 |         mbedtls_dtls_srtp_info srtpInfo;
      |                                ^
/Users/abril/.conan2/p/b/libdafd0995e33eb5b/b/src/src/impl/dtlssrtptransport.cpp:273:55: error: use of undeclared identifier 'srtpInfo'
  273 |         mbedtls_ssl_get_dtls_srtp_negotiation_result(&mSsl, &srtpInfo);
      |                                                              ^
/Users/abril/.conan2/p/b/libdafd0995e33eb5b/b/src/src/impl/dtlssrtptransport.cpp:274:6: error: use of undeclared identifier 'srtpInfo'
  274 |         if (srtpInfo.MBEDTLS_PRIVATE(chosen_dtls_srtp_profile) != MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_80)
      |             ^
/Users/abril/.conan2/p/b/libdafd0995e33eb5b/b/src/src/impl/dtlssrtptransport.cpp:274:60: error: use of undeclared identifier 'MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_80'
  274 |         if (srtpInfo.MBEDTLS_PRIVATE(chosen_dtls_srtp_profile) != MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_80)
      |                                                                   ^
/Users/abril/.conan2/p/b/libdafd0995e33eb5b/b/src/src/impl/dtlssrtptransport.cpp:272:2: warning: expression result unused [-Wunused-value]
  272 |         mbedtls_dtls_srtp_info srtpInfo;
      |         ^~~~~~~~~~~~~~~~~~~~~~
[ 70%] Building CXX object CMakeFiles/datachannel.dir/src/impl/track.cpp.o
1 warning and 6 errors generated.
make[2]: *** [CMakeFiles/datachannel.dir/src/impl/dtlssrtptransport.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/Users/abril/.conan2/p/b/libdafd0995e33eb5b/b/src/src/impl/dtlstransport.cpp:373:7: error: unknown type name 'mbedtls_ssl_srtp_profile'; did you mean 'mbedtls_x509_crt_profile'?
  373 | const mbedtls_ssl_srtp_profile srtpSupportedProtectionProfiles[] = {
      |       ^~~~~~~~~~~~~~~~~~~~~~~~
      |       mbedtls_x509_crt_profile
/Users/abril/.conan2/p/b/mbedt6e0a9295e63aa/p/include/mbedtls/x509_crt.h:133:1: note: 'mbedtls_x509_crt_profile' declared here
  133 | mbedtls_x509_crt_profile;
      | ^
/Users/abril/.conan2/p/b/libdafd0995e33eb5b/b/src/src/impl/dtlstransport.cpp:374:5: error: use of undeclared identifier 'MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_80'
  374 |     MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_80,
      |     ^
/Users/abril/.conan2/p/b/libdafd0995e33eb5b/b/src/src/impl/dtlstransport.cpp:375:5: error: use of undeclared identifier 'MBEDTLS_TLS_SRTP_UNSET'
  375 |     MBEDTLS_TLS_SRTP_UNSET,
      |     ^
/Users/abril/.conan2/p/b/libdafd0995e33eb5b/b/src/src/impl/dtlstransport.cpp:414:3: error: use of undeclared identifier 'mbedtls_ssl_conf_dtls_srtp_protection_profiles'
  414 |                 mbedtls_ssl_conf_dtls_srtp_protection_profiles(&mConf, srtpSupportedProtectionProfiles);
      |                 ^
4 errors generated.
make[2]: *** [CMakeFiles/datachannel.dir/src/impl/dtlstransport.cpp.o] Error 1
make[1]: *** [CMakeFiles/datachannel.dir/all] Error 2
make: *** [all] Error 2

libdatachannel/0.22.2: ERROR: 
Package '067c42719d2dc13d822ba75aef10ffad33c1c1cf' build failed
libdatachannel/0.22.2: WARN: Build folder /Users/abril/.conan2/p/b/libdafd0995e33eb5b/b/build/Release
ERROR: libdatachannel/0.22.2: Error in build() method, line 104
	cmake.build()
	ConanException: Error 2 while executing

which might arise from the component taking on the component target name!

@metalMajor
Copy link
Contributor Author

Thanks! That is some more advanced conan hehe 👍 good job!!

by the way, the patch is now not needed in the conan context, but I think i will notify upstream because it really fixes a bug with the names in their findlibjuice cmake file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants