microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
22.8k stars 6.3k forks source link

[LibDataChannel] fail to link Usrsctp::Usrsctp #35863

Closed helywin closed 7 months ago

helywin commented 8 months ago

Describe the bug usrsctp lib has no cmake file to import itself as Usrsctp::Usrsctp

Environment

To Reproduce Steps to reproduce the behavior:

use this code to reproduce

project(voice_intercom)
cmake_minimum_required(VERSION 2.8)
set(CMAKE_CXX_STANDARD 17)

find_package(LibDataChannel CONFIG REQUIRED)
add_executable(robot_voice main.cpp)

target_link_libraries(robot_voice
        LibDataChannel::LibDataChannelStatic
        dl
)
// main.cpp
#include <rtc/rtc.hpp>

#define SAMPLE_RATE 48000
#define CHANNELS 2
#define FRAME_SIZE 960
#define BITRATE 64000

int main(int argc, char *argv[])
{
    rtc::Configuration config;
    rtc::PeerConnection pc(config);
    std::shared_ptr<rtc::DataChannel> dc = pc.createDataChannel("audio");

    float input[FRAME_SIZE * CHANNELS];
    unsigned char encodedData[FRAME_SIZE * CHANNELS * 2];
    std::size_t encodedLength = 0;
    while (true) {
            dc->send((std::byte *)encodedData, encodedLength);
    }
}

Expected behavior no compile error

Failure logs compile error

/usr/bin/ld: cannot find -lUsrsctp::Usrsctp
collect2: error: ld returned 1 exit status

Additional context

I modified vcpkg/installed/x64-linux/share/LibDataChannel/LibDataChannelTargets.cmake line 63 as below and solve the problem

-  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Threads::Threads>;\$<LINK_ONLY:Usrsctp::Usrsctp>;\$<LINK_ONLY:plog::plog>;\$<LINK_ONLY:OpenSSL::SSL>;\$<LINK_ONLY:LibJuice::LibJuice>"
+  INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Threads::Threads>;\$<LINK_ONLY:usrsctp>;\$<LINK_ONLY:plog::plog>;\$<LINK_ONLY:OpenSSL::SSL>;\$<LINK_ONLY:LibJuice::LibJuice>"
MonicaLiu0311 commented 8 months ago

Fixing by #35618.

waywardmonkeys commented 8 months ago

@MonicaLiu0311 @jimwang118 I think this can be closed now?

vipcxj commented 8 months ago

@MonicaLiu0311 it broken the build on ubuntu. please reopen

MonicaLiu0311 commented 8 months ago

An emerging issue has been reported in #36177.

Edit: Fixed by #36191.