We developing some CV application, based of OpenCV, Boost, LibVLC and Caffe. Some of our customers want to deploy it on outdated(or unpopular) Linux distributions, so we must bundle all it's dependencies(and some vlc plugins), most of them can be found in any actual distro, but we have custom build of libcaffe vendored in our repo. So, now i solve it with this bash script:
#!/bin/bash set -uex export LD_LIBRARY_PATH=./contrib/caffe.arch32/lib/ function copy_deps { libs=$(LD_TRACE_LOADED_OBJECTS=1 /lib/ld-linux.so.2 "$1" | cut -d" " -f 3 | sort |uniq | grep -v '^$') for lib in $libs do cp -un "$lib" ./bundle done } mkdir -p bundle mkdir -p ./bundle/vlc/plugins cp -r /usr/lib/vlc/plugins ./bundle/vlc rm -rf ./bundle/vlc/plugins/lua rm -rf ./bundle/vlc/plugins/gui rm -rf ./bundle/vlc/plugins/visualization for plugin in $(find ./bundle/vlc/plugins -name "*.so") do copy_deps "$plugin" done copy_deps ./detector cp /lib/ld-linux.so.2 ./bundle cp ./detector ./bundle cp ./config.ini ./bundle mkdir -p ./bundle/config cp -r ./config/nn ./bundle/config cp -r ./config/neuron ./bundle/config echo "LD_LIBRARY_PATH=./ ./ld-linux.so.2 ./detector 2> /dev/null" > ./bundle/run.sh chmod +x ./bundle/run.sh zip -q -r bundle.zip bundle It works fine, but only for executable build(we need shared lib too), only for x86_32 distros. We build our project with cmake, so after reading it's docs i noticed, that fixup_bundle is cmake-way for bundling. All examples and blogs about fixup_bundle is very simple, or related with OSX or Windows. So, i append my CMakeLists.txt
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}) set(BUNDLE_NAME ${PROJECT_NAME}) set(BUNDLE_PATH "${CMAKE_INSTALL_PREFIX}/${BUNDLE_NAME}") set(APPS ${BUNDLE_PATH}) list(APPEND DIRS ${CMAKE_INSTALL_PREFIX}/${LIBDIR} ${CAFFE_LINK_PATH} /lib/ /usr/lib) list(APPEND LIBS) INSTALL(CODE " include(BundleUtilities) fixup_bundle(\"${APPS}\" \"${LIBS}\" \"${DIRS}\") " COMPONENT Runtime) And then try to run make install, I noticed that only our custom libcaffe is bundled, no boost, no opencv, no VLC. Why? How to bundle all dependencies?
OS: Arch Linux.