Discussion:
[cmake-developers] BundleUtilities question
Kinga Kasa
2018-08-24 12:24:39 UTC
Permalink
Hello!

I have a question regarding BundleUtilities.
I need to deploy an application on mac (building the application, then making a bundle from it, then fixing up the dependencies in order for it to be stand-alone).
I need to make a macos app bundle which has the following structure:

-MyApp.app
-Contents
-Frameworks (all dependencies are here)
-MacOS
-MyExecutable1
-MyExecutable2
-Resources
-PlugIns (QT deploy made this folder)

So as this application uses QT, I tried to used macdeployqt, but it just doesn't work with two executables in one bundle (doesn't fixing the dependencies, if I check with otool, some of the libraries and frameworks were not be able to become resolved).
So I decided to use cmakes' BundleUtilities as I am also using cmake build system.
I call the function like this:

include(BundleUtilities)
set(APPS "MyApp.app")
fixup_bundle("${APPS}" "" "")

It fixes up everything good, only the QT related dependencies (and another 3rd party lib). It says:

Error: copying file (when tries to copy the framework to the correct place)
and
"warning: cannot resolve item @rpath/QtNetwork.framework/Versions/5/QtNetwork
warning: gp_resolved_file_type non-absolute file '@rpath/QtNetwork.framework/Versions/5/QtNetwork' returning type 'other' - possibly incorrect"

All the QT related frameworks are in the app bundle already, as I called macdeployqt, so it copied the QT frameworks in the bundles' Frameworks directory.

I could not find any hint on the web, so I hope here I can get some advice on how to proceed.


Thank you in advance!


Kinga
Ben Boeckel
2018-09-07 12:02:57 UTC
Permalink
Post by Kinga Kasa
Error: copying file (when tries to copy the framework to the correct place)
and
It appears that the libraries linking to Qt (and the other third party
library) are missing rpath entries which would allow them to find Qt.
When using `@rpath` as a library ID on macOS, rpath entries *must* be
added in order to use them.

--Ben
--
Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake-developers
Loading...