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] fail to link Usrsctp::Usrsctp #35863

Closed
helywin opened this issue Dec 25, 2023 · 4 comments
Closed

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

helywin opened this issue Dec 25, 2023 · 4 comments
Assignees
Labels
category:port-bug The issue is with a library, which is something the port should already support

Comments

@helywin
Copy link

helywin commented Dec 25, 2023

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

Environment

  • OS: Linux
  • Compiler: gcc 13.2

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 MonicaLiu0311 added requires:repro The issue is not currently repro-able category:port-bug The issue is with a library, which is something the port should already support and removed requires:repro The issue is not currently repro-able labels Dec 25, 2023
@MonicaLiu0311
Copy link
Contributor

Fixing by #35618.

@waywardmonkeys
Copy link
Contributor

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

@vipcxj
Copy link
Contributor

vipcxj commented Jan 15, 2024

@MonicaLiu0311 it broken the build on ubuntu. please reopen

@MonicaLiu0311 MonicaLiu0311 changed the title LibDataChannel fail to link Usrsctp::Usrsctp [LibDataChannel] fail to link Usrsctp::Usrsctp Jan 15, 2024
@MonicaLiu0311 MonicaLiu0311 reopened this Jan 15, 2024
@MonicaLiu0311
Copy link
Contributor

MonicaLiu0311 commented Jan 16, 2024

An emerging issue has been reported in #36177.

Edit: Fixed by #36191.

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.

4 participants