kutschkem
kutschkem

Reputation: 8163

Using BundleUtilities to package executable + dependencies

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?

Upvotes: 3

Views: 1376

Answers (1)

TomBlo
TomBlo

Reputation: 118

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.

Upvotes: 4

Related Questions