millicast / millicast-native-sdk

SDK to build native clients using the Millicast platform.
Other
17 stars 5 forks source link

ABI issue when tyring to compile with flutter #8

Closed Kofhein closed 9 months ago

Kofhein commented 1 year ago

I'm making millicast based plugin for flutter-elinux, but when I try to compile I receive next undefined reference

/usr/bin/ld: ../plugins/millicast/libmillicast_plugin.so: undefined reference to `flutter::internal::ReplyManager::SendResponseData(std::__1::vector<unsigned char, std::__1::allocator<unsigned char> >
const*)'
/usr/bin/ld: ../plugins/millicast/libmillicast_plugin.so: undefined reference to `flutter::PluginRegistrar::AddPlugin(std::__1::unique_ptr<flutter::Plugin, std::__1::default_delete<flutter::Plugin> >)'
/usr/bin/ld: ../plugins/millicast/libmillicast_plugin.so: undefined reference to `flutter::internal::ReplyManager::ReplyManager(std::__1::function<void (unsigned char const*, unsigned long)>)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

This is being printed if find_package( MillicastSDK REQUIRED ) is included in cmake file. In case I don't use find_package and link directly to .so libs provided by millicast-native-sdk package next undefined reference occurs -

/usr/bin/ld: ../plugins/millicast/libmillicast_plugin.so: undefined reference to `millicast::Client::get_supported_audio_codecs[abi:cxx11]()'
/usr/bin/ld: ../plugins/millicast/libmillicast_plugin.so: undefined reference to `millicast::Source::name[abi:cxx11]() const'
/usr/bin/ld: ../plugins/millicast/libmillicast_plugin.so: undefined reference to `millicast::Client::get_supported_video_codecs[abi:cxx11]()'

Currently only workaround is to recompile flutter libs, but it's not that easy. Also it's possible to run app when this functions are commented, but at least it prevents setting up correct source as I can't access name.

Native SDK: millicast-native-sdk-1.4.2-Linux OS: Ubuntu 20.04.5 LTS Compiler: Clang 10.0

Santiago-Souto commented 1 year ago

Hi @Kofhein, while we are investigating this issue, please provide the following information:

  1. Did this work with SDK version 1.4.1?
  2. What architecture does your target device have? We only support x86_64 on Linux at the moment.
  3. What flutter and flutter-elinux versions are you using?
Kofhein commented 1 year ago

Hi @Santiago-Souto , 1) No, same behavior 2) It's running on laptop based on Intel Core i7, so it's x86_64 3) Here's printout of flutter-elinux run ( it's based on flutter engine so versions are same, for flutter-elinux github repo it tagged 3.3.7 commit 40ce536d59be849f3d49bf4441bfa4acb2f78ac9 )

zsh >> flutter-elinux run -d elinux-x11                   
Flutter 3.3.7 • channel unknown • unknown source
Framework • revision e99c9c7cd9 (6 weeks ago) • 2022-11-01 16:59:00 -0700
Engine • revision 857bd6b74c
Tools • Dart 2.18.4 • DevTools 2.15.0

It looks that flutter uses libstdc++ , while millicast libc++, cause if comment set( CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS}" ) in MillicastSDKConfig.cmake it leads to change from flutter undefined refs to millicast undefined refs one.

You can test it with my flutter-elinux plugin that is located here: https://github.com/Kofhein/flutter-elinux-plugins/tree/main/packages/millicast

Santiago-Souto commented 1 year ago

Thanks for the response! We were able to reproduce the error. We will be reporting back.

djova-dolby commented 9 months ago

The problem here was because there was only an LLVM/libc++ version of Ubuntu SDK provided. As of 1.7 we now provide the gnu/libstdc++ versions also. Please use: