Processed: Re: Bug#978616: mediastreamer2: doesn't build correct libraries with cmake?
Processing control commands: > forwarded -1 > https://github.com/BelledonneCommunications/mediastreamer2/pull/27 Bug #978616 [src:mediastreamer2] mediastreamer2: doesn't build correct libraries with cmake? Set Bug forwarded-to-address to 'https://github.com/BelledonneCommunications/mediastreamer2/pull/27'. -- 978616: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=978616 Debian Bug Tracking System Contact ow...@bugs.debian.org with problems
Bug#978616: mediastreamer2: doesn't build correct libraries with cmake?
control: forwarded -1 https://github.com/BelledonneCommunications/mediastreamer2/pull/27 thanks G.
Bug#978616: mediastreamer2: doesn't build correct libraries with cmake?
On Wed, 30 Dec 2020 17:18:41 +0100 Bernhard Schmidt wrote: > Dear Gianfranco, > > Thanks for filing this bug report. I’m away for the next couple of days and > could not check, but wouldn’t just patching the pkgconfig file (your second > option) be a lot easier? Upstream merged both libraries and they probably > just forgot to change the pkgconfig file as well. > > In the end linphone upstream does not seem to care much about other programs > using their library. > I did my assumption based on this: [2.9.0] - 2013-05-27 Added [...] Changed Split the libmediastreamer library in two libraries: libmediastreamer_base and libmediastreamer_voip. For VoIP support, both libraries must be linked to the executable. So I thought that upstream was moving from 1 library into 2 different libs. If upstream moved from 2 to 1, patching the pkgconfig file is indeed the right (and upstreamable) thing to do. But according to git log, you seems to be right: commit 50c9633712a57910612c4c58d237fbe5652843dd Author: Ghislain MARY Date: Mon Oct 15 10:51:37 2018 +0200 Build a single mediastreamer library (instead of mediastreamer_base and mediastreamer_voip) and a single mediastreamer2 framework for iOS. So, ok for the easier approach! Description: Fix pkgconfig linkage Author: Gianfranco Costamagna Last-Update: 2020-12-31 --- mediastreamer2-4.4.21.orig/mediastreamer.pc.in +++ mediastreamer2-4.4.21/mediastreamer.pc.in @@ -7,5 +7,5 @@ Name: mediastreamer Description: A mediastreaming library for telephony applications Requires: ortp bctoolbox Version: @MEDIASTREAMER_VERSION@ -Libs: -L@libdir@ -lmediastreamer_base -lmediastreamer_voip +Libs: -L@libdir@ -lmediastreamer Cflags: -I@includedir@ @MS_PUBLIC_CFLAGS@ This one should do the trick. I'll upstream it in a pull request shortly! G.
Bug#978616: mediastreamer2: doesn't build correct libraries with cmake?
Dear Gianfranco, Thanks for filing this bug report. I’m away for the next couple of days and could not check, but wouldn’t just patching the pkgconfig file (your second option) be a lot easier? Upstream merged both libraries and they probably just forgot to change the pkgconfig file as well. In the end linphone upstream does not seem to care much about other programs using their library. Bernhard > Am 29.12.2020 um 11:00 schrieb Gianfranco Costamagna > : > Source: mediastreamer2 > Version: 1:4.4.21-2 > Severity: serious > > Hello, looks like with autotools, the library provides libmediastreamer_base > and libmediastreamer_voip, > while with cmake it doesn't. > > the pkgconfig file is obviously wrong, but I don't know which solution you > prefer (and if you are aware of this issue). > > I propose two solutions: > 1) implement the library split in cmake, and upstream it (this might be the > preferred and easier solution to this issue) > 2) patch pkgconfig file and cmake helpers to provide only one library to link. > > if we choose 1, we should probably also change the ABI, so call it > libmediastreamer11a or similar, to trigger a rebuild of reverse dependencies. > > If you agree with 1) I can try to provide a patch as soon as possible. > > thanks > > Gianfranco
Bug#978616: mediastreamer2: doesn't build correct libraries with cmake?
This might be a patch that works if the library is found via pkgconfig but not via cmake --- mediastreamer2-4.4.21.orig/src/CMakeLists.txt +++ mediastreamer2-4.4.21/src/CMakeLists.txt @@ -495,12 +495,16 @@ if(ENABLE_STATIC) ) endif() if(ENABLE_SHARED) - add_library(mediastreamer SHARED ${MEDIASTREAMER2_HEADER_FILES} ${SOURCE_FILES_ALL}) - set_target_properties(mediastreamer PROPERTIES LINKER_LANGUAGE CXX) + add_library(mediastreamer_base SHARED ${MEDIASTREAMER2_HEADER_FILES} ${BASE_SOURCE_FILES_C}) + set_target_properties(mediastreamer_base PROPERTIES LINKER_LANGUAGE CXX) + add_library(mediastreamer_voip SHARED ${MEDIASTREAMER2_HEADER_FILES} ${VOIP_SOURCE_FILES_ALL}) + set_target_properties(mediastreamer_voip PROPERTIES LINKER_LANGUAGE CXX) if(LINK_FLAGS_STR) - set_target_properties(mediastreamer PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}") + set_target_properties(mediastreamer_base PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}") + set_target_properties(mediastreamer_voip PROPERTIES LINK_FLAGS "${LINK_FLAGS_STR}") endif() - add_dependencies(mediastreamer ${MS2_DEPENDENCIES}) + add_dependencies(mediastreamer_base ${MS2_DEPENDENCIES}) + add_dependencies(mediastreamer_voip ${MS2_DEPENDENCIES}) if(APPLE) if(IOS) set(MIN_OS ${LINPHONE_IOS_DEPLOYMENT_TARGET}) @@ -526,14 +530,21 @@ if(ENABLE_SHARED) endif() else() # Do not version shared library on Android - set_target_properties(mediastreamer PROPERTIES SOVERSION ${MEDIASTREAMER_SO_VERSION}) + set_target_properties(mediastreamer_base PROPERTIES SOVERSION ${MEDIASTREAMER_SO_VERSION}) + set_target_properties(mediastreamer_voip PROPERTIES SOVERSION ${MEDIASTREAMER_SO_VERSION}) endif() - target_include_directories(mediastreamer INTERFACE + target_include_directories(mediastreamer_base INTERFACE $ $ PRIVATE ${MEDIASTREAMER2_INCLUDE_DIRS} ) -target_link_libraries(mediastreamer PRIVATE ${LINK_LIBS}) + target_include_directories(mediastreamer_voip INTERFACE + $ + $ + PRIVATE ${MEDIASTREAMER2_INCLUDE_DIRS} + ) +target_link_libraries(mediastreamer_base PRIVATE ${LINK_LIBS}) +target_link_libraries(mediastreamer_voip PRIVATE ${LINK_LIBS}) if(IOS) target_link_libraries(mediastreamer INTERFACE "-framework Foundation" "-framework AVFoundation") endif() @@ -545,7 +556,14 @@ if(ENABLE_SHARED) ) endif() endif() - install(TARGETS mediastreamer EXPORT ${EXPORT_TARGETS_NAME}Targets + install(TARGETS mediastreamer_base EXPORT ${EXPORT_TARGETS_NAME}Targets + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + FRAMEWORK DESTINATION Frameworks + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) + install(TARGETS mediastreamer_voip EXPORT ${EXPORT_TARGETS_NAME}Targets RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} --- mediastreamer2-4.4.21.orig/tools/CMakeLists.txt +++ mediastreamer2-4.4.21/tools/CMakeLists.txt @@ -28,7 +28,7 @@ if (IOS) endif() if(ENABLE_SHARED) - set(MS2_LIBS_FOR_TOOLS mediastreamer) + set(MS2_LIBS_FOR_TOOLS mediastreamer_voip mediastreamer_base) else() set(MS2_LIBS_FOR_TOOLS mediastreamer-static) if(XV_FOUND) --- mediastreamer2-4.4.21.orig/cmake/Mediastreamer2Config.cmake.in +++ mediastreamer2-4.4.21/cmake/Mediastreamer2Config.cmake.in @@ -36,7 +36,7 @@ include(CMakeFindDependencyMacro) include("${CMAKE_CURRENT_LIST_DIR}/Mediastreamer2Targets.cmake") if(@ENABLE_SHARED@) - set(MEDIASTREAMER2_TARGETNAME mediastreamer) + set(MEDIASTREAMER2_TARGETNAME mediastreamer_voip mediastreamer_base) set(MEDIASTREAMER2_LIBRARIES ${MEDIASTREAMER2_TARGETNAME}) else() set(MEDIASTREAMER2_TARGETNAME mediastreamer-static) I don't understand how such interfaces work... G. I tried a simple CMakeLists.txt project(foo) cmake_minimum_required(VERSION 3.18) find_package(Mediastreamer2 REQUIRED) add_executable(main main.c) target_link_libraries(main mediastreamer2) but fails with: cmake .. -- The C compiler identification is GNU 10.2.1 -- The CXX compiler identification is GNU 10.2.1 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done --
Bug#978616: mediastreamer2: doesn't build correct libraries with cmake?
Source: mediastreamer2 Version: 1:4.4.21-2 Severity: serious Hello, looks like with autotools, the library provides libmediastreamer_base and libmediastreamer_voip, while with cmake it doesn't. the pkgconfig file is obviously wrong, but I don't know which solution you prefer (and if you are aware of this issue). I propose two solutions: 1) implement the library split in cmake, and upstream it (this might be the preferred and easier solution to this issue) 2) patch pkgconfig file and cmake helpers to provide only one library to link. if we choose 1, we should probably also change the ABI, so call it libmediastreamer11a or similar, to trigger a rebuild of reverse dependencies. If you agree with 1) I can try to provide a patch as soon as possible. thanks Gianfranco