gpt4 book ai didi

cmake - 使用 BundleUtilities 打包可执行文件 + 依赖项

转载 作者:行者123 更新时间:2023-12-05 05:11:52 26 4
gpt4 key购买 nike

我想创建一个可执行文件 + 共享库依赖项的独立包,以部署在最小的 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)

它想告诉我一些事情,有人可以翻译吗?是不是找不到可执行文件?它是否找到可执行文件但缺少一些参数?

最佳答案

我在构建 docker 镜像时遇到了同样的问题。问题是缺少 unix 命令"file"。在我的例子中,使用以下命令安装"file": apt-get 安装文件

修复它。

关于cmake - 使用 BundleUtilities 打包可执行文件 + 依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55004698/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com