amazon-kinesis-video-streams-producer-sdk-cpp icon indicating copy to clipboard operation
amazon-kinesis-video-streams-producer-sdk-cpp copied to clipboard

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

Open stefankiesz opened this issue 11 months ago • 0 comments

Original PR: https://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-cpp/pull/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
  2. 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 avatar Dec 18 '24 01:12 stefankiesz