c++ - Can't use fixup_bundle() to create a portable bundle with Qt -


i searched issue on other posts, nothing far. here am.

i'd create bundle portable. portable in "i can run on os x machine, if required libs (qt) not installed". unfortunately, can't figure out how use fixup_bundle() (which seems right tool it) achieve goal.

here minimal cmake generated c++ project :

main.cpp

#include <qstring> #include <iostream>  int main() {         qstring s("hello, world!");     std::cout << s.tostdstring() << std::endl;     return 0; } 

cmakelists.txt

cmake_minimum_required(version 2.8.11)  project(test)  # part because use custom build of qt. that's not # relevant part (i guess?) file(glob qtroots path_to_qt/qt-4.8.1/osx/bin/qmake) find_program(qt_qmake_executable names qmake paths ${qtroots}) find_package(qt4 components qtcore required) include(${qt_use_file})  add_executable(test macosx_bundle main.cpp)  target_link_libraries(test ${qt_libraries})  install(script bundle.cmake) 

bundle.cmake

include(bundleutilities) fixup_bundle(test.app "" "") 

here's resulting test.app structure

test.app  - contents     - info.plist     - frameworks        - qtcore.framework           - versions              - 4                 - qtcore     - macos        - test 

everything needed seems in bundle. compiles smoothly, runs well, when invoke fixup_bundle, that's :

vincent@hpcd0016-lion:tmp/test_bundle/ (0) > make install  [100%] built target test install project... -- install configuration: "" -- fixup_bundle --   app='test.app' --   libs='' --   dirs='' -- fixup_bundle: preparing... -- fixup_bundle: copying... -- 1/4: *not* copying '/users/vincent/tmp/test_bundle/test.app/contents/macos/test' -- 2/4: copying 'path_to_qt/qt-4.8.1/osx/lib//qtcore.framework/versions/4/qtcore' -- fixup_bundle: fixing... -- 3/4: fixing '/users/vincent/tmp/test_bundle/test.app/contents/macos/test'   exe_dotapp_dir/='test.app/contents/macos/'   item_substring='/users/vincent/t'   resolved_embedded_item='/users/vincent/tmp/test_bundle/test.app/contents/macos/test'  install or copy item bundle before calling fixup_bundle. or maybe there's typo or incorrect path in 1 of args fixup_bundle?  cmake error @ /applications/cmake 2.8-11.app/contents/share/cmake-2.8/modules/bundleutilities.cmake:568 (message):   cannot fixup item not in bundle... call stack (most recent call first):   /applications/cmake 2.8-11.app/contents/share/cmake-2.8/modules/bundleutilities.cmake:656 (fixup_bundle_item)   bundle.cmake:2 (fixup_bundle)   cmake_install.cmake:31 (include)   make: *** [install] error 1 

there's dependencies path (given otool -l) :

vincent@hpcd0016-lion:test.app/contents/ (0) > otool -l test.app/contents/macos/test          test.app/contents/macos/test:         path_to_qt/qt-4.8.1/osx/lib//qtcore.framework/versions/4/qtcore (compatibility version 4.8.0, current version 4.8.1)         /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0)         /usr/lib/libsystem.b.dylib (compatibility version 1.0.0, current version 169.3.0)  vincent@hpcd0016-lion:tmp/test_bundle/ (0) > otool -l test.app/contents/frameworks/qtcore.framework/versions/4/qtcore     test.app/contents/frameworks/qtcore.framework/versions/4/qtcore:         path_to_qt/qt-4.8.1/osx/lib//qtcore.framework/versions/4/qtcore (compatibility version 4.8.0, current version 4.8.1)         /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)         /usr/lib/libsystem.b.dylib (compatibility version 1.0.0, current version 159.1.0)         /system/library/frameworks/applicationservices.framework/versions/a/applicationservices (compatibility version 1.0.0, current version 41.0.0)         /system/library/frameworks/corefoundation.framework/versions/a/corefoundation (compatibility version 150.0.0, current version 635.15.0)         /system/library/frameworks/security.framework/versions/a/security (compatibility version 1.0.0, current version 55010.0.0)         /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)         /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1094.0.0)         /system/library/frameworks/coreservices.framework/versions/a/coreservices (compatibility version 1.0.0, current version 53.0.0) 

obviously, fixup_bundle did not fix bundle binaries still have ids set machine's paths.

what doing wrong on simple example?

i added line @ top of cmakelists.txt

set(cmake_install_prefix ${cmake_binary_dir}) 

and it.

by default, apparently, cmake_install_prefix set /usr/local on machine. if changing current working directory solved issue, means cmake trying perform operations on /usr/local (which not allowed do). why error message not mention such right access error?

i don't know if haven't read enough documentation, or if documentation needs precisions...


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -