我想创建一个包含可执行文件和共享库依赖项的自包含程序包,以部署在最小的Docker容器中。
根据我的研究,看起来BundleUtitilies可以用来让cmake创建自包含的应用程序。但是,我无法使其正常运行,并且缺少良好的示例。
install (TARGETS testPublisher_ecal RUNTIME DESTINATION bin OPTIONAL)
if(BUNDLE)
install (CODE "
include(BundleUtilities)
fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/bin/testPublisher_ecal\" \"\" \"\")
" OPTIONAL)
else()
endif()
我的理解是fixup_bundle主要需要可执行文件的路径。但是上面的代码片段只会产生
Install the project...
-- Install configuration: "Release"
-- Installing: /app/install/bin/testPublisher_ecal
-- Set runtime path of "/app/install/bin/testPublisher_ecal" to ""
-- fixup_bundle
-- app='/app/install/bin/testPublisher_ecal'
-- libs=''
-- dirs=''
-- ignoreItems=''
-- warning: No 'file' command, skipping execute_process...
-- warning: *NOT* handled - not .app dir, not executable file...
[91mCMake Error at /opt/cmake/share/cmake-3.12/Modules/BundleUtilities.cmake:966 (message):
error: fixup_bundle: not a valid bundle
Call Stack (most recent call first):
algos/testsProto/publisher/ecal/cmake_install.cmake:63 (fixup_bundle)
algos/testsProto/publisher/cmake_install.cmake:43 (include)
cmake_install.cmake:43 (include)
它试图告诉我一些事情,有人可以翻译吗?是否找不到可执行文件?是否找到可执行文件但缺少一些参数?
答案 0 :(得分:0)
在docker映像中构建时,我遇到了同样的问题。 问题是unix命令'file'丢失了。 在我的情况下,使用以下命令安装“文件”: apt-get安装文件
修复了该问题。