Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using BundleUtilities to package executable + dependencies

Tags:

cmake

I want to create a self-contained package of an executable + shared library dependencies, to deploy in a minimal Docker container.

From my research, it looks like BundleUtitilies can bes used to let cmake create self-contained applications. However I can't get it to work, and lack good minimal examples.

 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()

My understanding is that fixup_bundle mainly needs the path to the executable. However above snippet only produces

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)

It is trying to tell me something, can someone translate? Is it not finding the executable? Is it finding the executable but is missing some arguments?

like image 465
kutschkem Avatar asked Sep 21 '26 18:09

kutschkem


1 Answers

i had the same problem when building inside a docker image. The problem is that the unix command 'file' is missing. In my case installing 'file' by using: apt-get install file

fixed it.

like image 86
TomBlo Avatar answered Sep 24 '26 18:09

TomBlo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!