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

Allow using prebuilt libkvscproducer through pkg-config (#1193) #1217

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

stefankiesz
Copy link
Contributor

@stefankiesz stefankiesz commented Dec 18, 2024

Original PR: #1193

Description of Changes

(aside from original PR changes)

  • Introduced a new CMake option to control the building of the KVS Producer C dependency library.
    • Before, the library was always built from source (regardless of the value of the BUILD_DEPENDENCIES option). Now, whether it is built from source or found using pkg-config can be controlled with the new option.

Testing

These changes were tested locally on an M2 Mac with AppleClang-16 compiler using the following steps:

  1. Clone, then build and install the KVS Producer C SDK using the following commands:
mkdir build && cd build
cmake .. -DBUILD_COMMON_LWS=FALSE -DBUILD_COMMON_CURL=TRUE
make
make install
  1. Move the Producer C dependency library files into the same installation directory as the libcproducer and libkvsCommonCurl library files which were installed in the previous step.

    In my case, library files are using the .dylib extension and libcproducer.dylib and libkvsCommonCurl.dylib were located in /usr/local/lib.

    The dependency library files to move to that directory are:
    • libcrypto.dylib, libssl.dylib, and libcurl.dylib which are located in amazon-kinesis-video-streams-producer-c/open-source/lib/
    • amazon-kinesis-video-streams-producer-c/open-source/lib/pkgconfig directory with its contents
    • amazon-kinesis-video-streams-producer-c/open-source/lib/cmake directory with its contents

  1. Clone, then build the KVS Producer Cpp SDK using the following commands:
mkdir build && cd build
cmake .. -DBUILD_PRODUCER_C=OFF -DBUILD_GSTREAMER_PLUGIN=ON
make

  1. Use the following command to verify the libraries linked to the outputted KVS Producer Cpp library:
otool -L libKinesisVideoProducer.dylib 

The output should show that the library is using Producer Cpp dependency(s) local to the build (currently just the log4cplus dependency) but using rpath for the Producer C libraries (libkvsCommonCurl and libcproducer):

libKinesisVideoProducer.dylib:
        @rpath/libKinesisVideoProducer.dylib (compatibility version 0.0.0, current version 0.0.0)
        @rpath/libkvsCommonCurl.1.dylib (compatibility version 1.0.0, current version 1.5.4)
        @rpath/libcproducer.1.dylib (compatibility version 1.0.0, current version 1.5.4)
        /my/path/to/amazon-kinesis-video-streams-producer-sdk-cpp/open-source/local/lib/liblog4cplus-2.0.3.dylib (compatibility version 6.0.0, current version 6.2.0)

  1. Run a sample application to verify the build succeeded:
./kvs_gstreamer_sample myStreamName


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@stefankiesz stefankiesz added build Changes to CMakeLists.txt gstreamer Changes to kvssink or the kvssink samples and removed gstreamer Changes to kvssink or the kvssink samples labels Dec 18, 2024
fetch_repo(kvscproducer)
add_subdirectory(${DEPENDENCY_DOWNLOAD_PATH}/libkvscproducer/kvscproducer-src EXCLUDE_FROM_ALL)
else()
pkg_check_modules(KVSCPRODUCER REQUIRED libcproducer)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if you can add a new job to the CI that does this to make sure it doesn't get broken in the future?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Changes to CMakeLists.txt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants