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

[libdatachannel] configure failure #36177

Closed
vipcxj opened this issue Jan 15, 2024 · 1 comment · Fixed by #36191
Closed

[libdatachannel] configure failure #36177

vipcxj opened this issue Jan 15, 2024 · 1 comment · Fixed by #36191
Assignees
Labels
category:port-bug The issue is with a library, which is something the port should already support

Comments

@vipcxj
Copy link
Contributor

vipcxj commented Jan 15, 2024

Operating system

ubuntu

Compiler

gcc

Steps to reproduce the behavior

cmake --preset default

Failure logs

CMake Error at /home/ps/workspace/projects/vcpkg/scripts/buildsystems/vcpkg.cmake:598 (_add_executable):
Target "demo" links to target "unofficial::usrsctp::usrsctp" but the target
was not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
Call Stack (most recent call first):
CMakeLists.txt:8 (add_executable)

Additional context

This is my vcpkg.json

{
  "dependencies": [
    "ffmpeg",
    {
      "name": "libdatachannel",
      "features": [
        "srtp"
      ]
    },
    "poco",
    "socket-io-client"
  ]
}

This is my CMakePresets.json

{
    "version": 3,
    "configurePresets": [
        {
            "name": "default",
            "binaryDir": "${sourceDir}/build",
            "cacheVariables": {
                "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
            }
        }
    ]
}

This is my CMakeLists.txt

cmake_minimum_required(VERSION 3.22)

project(cwebrtc-demo)
set(SOURCES
    main.cpp
)

add_executable(demo ${SOURCES})

set_target_properties(demo PROPERTIES
	CXX_STANDARD 17
	OUTPUT_NAME demo)

#find_package(unofficial-usrsctp CONFIG REQUIRED) // without this line, error raised. usrsctp is dependency of libdatachannel, not my project
find_package(sioclient CONFIG REQUIRED)
find_package(Poco REQUIRED COMPONENTS Foundation Net)
find_package(LibDataChannel CONFIG REQUIRED)

target_link_libraries(demo PRIVATE 
	LibDataChannel::LibDataChannelStatic 
	sioclient::sioclient sioclient::sioclient_tls
	Poco::Foundation Poco::Net 
)
find_package(FFMPEG REQUIRED)
target_include_directories(demo PRIVATE ${FFMPEG_INCLUDE_DIRS})
target_link_directories(demo PRIVATE ${FFMPEG_LIBRARY_DIRS})
target_link_libraries(demo PRIVATE ${FFMPEG_LIBRARIES})

If I change

#find_package(unofficial-usrsctp CONFIG REQUIRED)

to

find_package(unofficial-usrsctp CONFIG REQUIRED)

error disappeared. but my project not directly depend on usrsctp
usrsctp is the dependcy of libdatachannel

if I change vcpkg.json from

{
  "dependencies": [
    "ffmpeg",
    {
      "name": "libdatachannel",
      "features": [
        "srtp"
      ]
    },
    "poco",
    "socket-io-client"
  ]
}

to

{
  "dependencies": [
    "ffmpeg",
    "libdatachannel",
    "poco",
    "socket-io-client"
  ]
}

The error changed.

  Could not find a package configuration file provided by "libSRTP" with any
  of the following names:

    libSRTPConfig.cmake
    libsrtp-config.cmake

  Add the installation prefix of "libSRTP" to CMAKE_PREFIX_PATH or set
  "libSRTP_DIR" to a directory containing one of the above files.  If
  "libSRTP" provides a separate development package or SDK, be sure it has
  been installed.
@vipcxj
Copy link
Contributor Author

vipcxj commented Jan 15, 2024

I found error appeared on windows, as well.

  Could not find a package configuration file provided by "libSRTP" with any
  of the following names:

    libSRTPConfig.cmake
    libsrtp-config.cmake

  Add the installation prefix of "libSRTP" to CMAKE_PREFIX_PATH or set
  "libSRTP_DIR" to a directory containing one of the above files.  If
  "libSRTP" provides a separate development package or SDK, be sure it has
  been installed.

when using such vcpkg.json

{
  "dependencies": [
    "libdatachannel",
  ]
}

When change to

{
  "dependencies": [
    {
      "name": "libdatachannel",
      "features": [
        "srtp"
      ]
    },
  ]
}

cmake config successfully. No need to add find_package(unofficial-usrsctp CONFIG REQUIRED) on windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants