Yes David I fully agree with you I am not arguing on the fact that the lib cannot be retrieved from the exe - obviously it cannot and this is why the lib is a parameter of fixbundle
I am just arguing that I would expect this block: INSTALL(TARGETS plugin BUNDLE DESTINATION . COMPONENT Runtime to copy the lib inside the bundle directory. Best Regards Guillaume On Wed, Apr 20, 2011 at 8:25 PM, David Cole <david.c...@kitware.com> wrote: > On Wed, Apr 20, 2011 at 10:40 AM, tog <guillaume.all...@gmail.com> wrote: >> >> Well I thought that the BUNDLE line in my INSTALL command would take >> care of that. Actually it is the case for the other 2 libs. > > The other 2 libs show up in the following output: > otool -L your_main_executable > > The plugin does not. > > >> >> What is wrong with that one ? > > Nothing is wrong with it, but there is no link from the app to the plugin, > so fixup_bundle cannot determine that it's necessary and automatically pull > it in. The plugin, from the app's point of view, is something that may or > may not exist, and if it does, it's dynamically loaded. So you need to > install it into the bundle first, and then you need to tell fixup_bundle > about it so that it gets included in the set of fixed up libraries. > > Hope this helps, > David > > > >> >> I guess I am missing something with those "plugin" libraries ... >> >> >> ADD_LIBRARY(plugin MODULE plugin.cpp) >> >> INSTALL(TARGETS plugin >> BUNDLE DESTINATION . COMPONENT Runtime >> RUNTIME DESTINATION ${EXAMPLE_INSTALL_PLUGIN_LIB_DIR} >> COMPONENT RuntimeLibraries >> LIBRARY DESTINATION ${EXAMPLE_INSTALL_PLUGIN_LIB_DIR} >> COMPONENT RuntimeLibraries >> ARCHIVE DESTINATION ${EXAMPLE_INSTALL_PLUGIN_LIB_DIR} >> COMPONENT Development >> ) >> >> On Wed, Apr 20, 2011 at 6:30 PM, David Cole <david.c...@kitware.com> >> wrote: >> > The error message tells you what to do: >> > >> > "Install or copy the item into the bundle before calling fixup_bundle" >> > >> > That means that libplugin.so must be underneath "/tmp/example/main.app" >> > before you call fixup_bundle. (Because it's a plugin, it will not appear >> > in >> > any file's otool -L output, so it has to be installed first in the >> > bundle >> > before it can be fixed up...) >> > >> > >> > On Wed, Apr 20, 2011 at 6:54 AM, tog <guillaume.all...@gmail.com> wrote: >> >> >> >> Some small progress after using INSTALL(CODE ...) but still an error. >> >> (Small) code is still there https://github.com/galleon/CMakeOSX for >> >> those interested. >> >> >> >> Any idea what is going wrong ? >> >> >> >> Best Regards >> >> Guillaume >> >> >> >> .... >> >> >> >> -- 4/8: copying >> >> '/Users/alleon/PROJECTS/CMakeOSX_build/foo/libfoo.1.dylib' >> >> -- fixup_bundle: fixing... >> >> -- 5/8: fixing up >> >> '/Users/alleon/PROJECTS/CMakeOSX_build/plugin/libplugin.so' >> >> exe_dotapp_dir/='/tmp/example/main.app/' >> >> item_substring='/Users/alleon/PROJECTS' >> >> >> >> >> >> resolved_embedded_item='/Users/alleon/PROJECTS/CMakeOSX_build/plugin/libplugin.so' >> >> >> >> Install or copy the item into the bundle before calling fixup_bundle >> >> >> >> CMake Error at /Applications/CMake >> >> 2.8-4.app/Contents/share/cmake-2.8/Modules/BundleUtilities.cmake:557 >> >> (message): >> >> cannot fixup an item that is not in the bundle... >> >> Call Stack (most recent call first): >> >> /Applications/CMake >> >> 2.8-4.app/Contents/share/cmake-2.8/Modules/BundleUtilities.cmake:645 >> >> (fixup_bundle_item) >> >> example/cmake_install.cmake:44 (fixup_bundle) >> >> cmake_install.cmake:35 (INCLUDE) >> >> >> >> >> >> make: *** [install] Error 1 >> >> >> >> >> >> >> >> On Wed, Apr 20, 2011 at 12:03 PM, tog <guillaume.all...@gmail.com> >> >> wrote: >> >> > Hi, >> >> > >> >> > Yes I have used the references you send me i.e. the link to the >> >> > QtTest >> >> > project. >> >> > This project is nevertheless simpler than mine since only an >> >> > executable is generated - no libraries (excepted those taken from >> >> > Qt). >> >> > >> >> > If my understanding is correct - FIXUP_BUNDLE shall be used after the >> >> > bundle is created. Shall it be called for each artifacts i.e each >> >> > library and executable or only for the main executable. >> >> > >> >> > My problem is that I got an "fixup_bundle: not a valid bundle" error >> >> > message when using FIXUP_BUNDLE. >> >> > >> >> > I have created a very simplified project here if one wants to have a >> >> > look to my problem: https://github.com/galleon/CMakeOSX >> >> > >> >> > Best Regards >> >> > Guillaume >> >> > >> >> > >> >> > >> >> > On Tue, Apr 19, 2011 at 9:10 PM, Michael Jackson >> >> > <mike.jack...@bluequartz.net> wrote: >> >> >> Use the "SHARED" library type for your shared library and "MODULE" >> >> >> for >> >> >> your plugin. >> >> >> >> >> >> Have you downloaded the Qt example from the Wiki? It shows what you >> >> >> need to do. The terse summary of how some of us do it is this: >> >> >> >> >> >> Write a configurable *.cmake.in file that gets configured at cmake >> >> >> time. An install rule is also added that executes the .cmake file at >> >> >> install >> >> >> time. inside this file is cmake code to over ride some CMake >> >> >> functions for >> >> >> your use and then include the BundleUtilities. And then call >> >> >> "fixup_bundle". >> >> >> The tail end of my own file looks like this: >> >> >> >> >> >> # -- Run the BundleUtilities cmake code >> >> >> include(BundleUtilities) >> >> >> fixup_bundle("${CMAKE_INSTALL_PREFIX}/IPHelperApp_debug.app" >> >> >> # Plugins to Install >> >> >> >> >> >> >> >> >> "${CMAKE_INSTALL_PREFIX}/IPHelperApp_debug.app/Contents/plugins/imageformats/libqgif.dylib;${CMAKE_INSTALL_PREFIX}/IPHelperApp_debug.app/Contents/plugins/imageformats/libqjpeg.dylib;${CMAKE_INSTALL_PREFIX}/IPHelperApp_debug.app/Contents/plugins/imageformats/libqtiff.dylib;${CMAKE_INSTALL_PREFIX}/IPHelperApp_debug.app/Contents/plugins/libEMMPMPlugin_debug.plugin;${CMAKE_INSTALL_PREFIX}/IPHelperApp_debug.app/Contents/plugins/libCrossCorrelationPlugin_debug.plugin" >> >> >> # Directories to Search for Libraries >> >> >> >> >> >> >> >> >> "/Users/mjackson/Workspace/IPHelper/Build/Bin;/Users/mjackson/Workspace/IPHelper/Build/Bin" >> >> >> ) >> >> >> >> >> >> This is for a Qt based project where I need some of the Qt plugins >> >> >> for >> >> >> image loading and I have produced my own plugins that need to get >> >> >> copied >> >> >> into the application bundle. Note that this will get called at >> >> >> INSTALL time >> >> >> NOT at build time. You should have code in your main executable that >> >> >> looks >> >> >> for the plugins in a few locations so your executable will work from >> >> >> both >> >> >> the build directory and the installed location. Again, if you happen >> >> >> to be >> >> >> working with Qt I can share some code that I use. >> >> >> >> >> >> If you take a look at >> >> >> http://scm.bluequartz.net/support-libraries/cmp/trees/master there >> >> >> are some >> >> >> Macros (cmpCMakeMacros.cmake) that I use in my project. There is >> >> >> also the >> >> >> example configured file in the OSX_Tools directory >> >> >> (CompleteBundle.cmake.in). >> >> >> >> >> >> The "cmp" project is just a collection of CMake code that I use over >> >> >> and over in all my projects so I just made a Git module out of it >> >> >> and I use >> >> >> it as a git submodule in all my projects. >> >> >> ___________________________________________________________ >> >> >> Mike Jackson www.bluequartz.net >> >> >> Principal Software Engineer mike.jack...@bluequartz.net >> >> >> BlueQuartz Software Dayton, Ohio >> >> >> >> >> >> On Apr 19, 2011, at 11:21 AM, tog wrote: >> >> >> >> >> >>> Hi Mike >> >> >>> >> >> >>> Thanks for this very helpful answer. >> >> >>> I am nevertheless still facing few problems. My project contains: >> >> >>> - a shared library >> >> >>> - an executable using the shared lib >> >> >>> - a plugin lib (loaded using dylib) >> >> >>> >> >> >>> I have modified my exec target to be >> >> >>> ADD_EXECUTABLE(main MACOSX_BUNDLE main.cpp sub.cpp) >> >> >>> then I have something like >> >> >>> INSTALL(TARGETS main BUNDLE DESTINATION Applications RUNTIME) >> >> >>> >> >> >>> the make install does create Application.app and add the main exec. >> >> >>> >> >> >>> Fir the lib I am facing 2 problems: >> >> >>> 1- I don't understand how to add them to the bundle. They are both >> >> >>> created using: >> >> >>> >> >> >>> ADD_LIBRARY(foo ${EXAMPLE_LIBRARY_TYPE} foo.cpp) >> >> >>> EXAMPLE_LIBRARY_TYPE=SHARED >> >> >>> >> >> >>> INSTALL(TARGETS foo >> >> >>> RUNTIME DESTINATION ${EXAMPLE_INSTALL_LIB_DIR} >> >> >>> COMPONENT >> >> >>> RuntimeLibraries >> >> >>> LIBRARY DESTINATION ${EXAMPLE_INSTALL_LIB_DIR} >> >> >>> COMPONENT >> >> >>> RuntimeLibraries >> >> >>> ARCHIVE DESTINATION ${EXAMPLE_INSTALL_LIB_DIR} >> >> >>> COMPONENT >> >> >>> Development >> >> >>> >> >> >>> nothing is added to the app. >> >> >>> >> >> >>> 2- According to the doc. For a library loaded at runtime the doc >> >> >>> suggests to use MODULE but I end up having this error. Is that >> >> >>> supported on Mac >> >> >>> >> >> >>> Linking CXX shared module libplugin.so >> >> >>> cd /Users/alleon/PROJECTS/example_build/plugin && >> >> >>> "/Applications/CMake >> >> >>> 2.8-4.app/Contents/bin/cmake" -E cmake_link_script >> >> >>> CMakeFiles/plugin.dir/link.txt --verbose=1 >> >> >>> /usr/bin/c++ -bundle -Wl,-headerpad_max_install_names >> >> >>> -compatibility_version 1.0.0 -current_version 1.2.3 -o >> >> >>> libplugin.1.2.3.so CMakeFiles/plugin.dir/plugin.cpp.o >> >> >>> i686-apple-darwin10-g++-4.2.1: -compatibility_version only allowed >> >> >>> with -dynamiclib >> >> >>> make[2]: *** [plugin/libplugin.1.2.3.so] Error 1 >> >> >>> >> >> >>> >> >> >>> Thanks >> >> >>> Guillaume >> >> >>> >> >> >>> >> >> >>> On Sat, Apr 16, 2011 at 6:51 PM, Michael Jackson >> >> >>> <mike.jack...@bluequartz.net> wrote: >> >> >>>> You need to process your executable with "install_name_tool" >> >> >>>> either >> >> >>>> manually or using the "BundleUtilities" functionality built into >> >> >>>> CMake. Note >> >> >>>> that there is a bug in the current CMake 2.8.4 that will NOT allow >> >> >>>> bundleUtilities to work on a command line type app. Your app MUST >> >> >>>> be in a >> >> >>>> .app bundle. If you search for BUndleUtilities on the Wiki there >> >> >>>> is a small >> >> >>>> Qt based project that shows a simple use of BundleUtilities. >> >> >>>> >> >> >>>> Hope that helps. >> >> >>>> ___________________________________________________________ >> >> >>>> Mike Jackson www.bluequartz.net >> >> >>>> Principal Software Engineer mike.jack...@bluequartz.net >> >> >>>> BlueQuartz Software Dayton, Ohio >> >> >>>> >> >> >>>> >> >> >>>> >> >> >>>> On Apr 15, 2011, at 7:17 AM, tog wrote: >> >> >>>> >> >> >>>>> Dear all >> >> >>>>> >> >> >>>>> I have a project in which I would like to use rpath on Mac OS. >> >> >>>>> Everything is going fine if I am building everything manually >> >> >>>>> (i.e. >> >> >>>>> without CMake) >> >> >>>>> >> >> >>>>> With CMake all is fine for the libs between the build and the >> >> >>>>> installation, all libs are processed with install_name_tool. >> >> >>>>> But nothing is done for the executable (checked from >> >> >>>>> cmake_install.cmake) >> >> >>>>> >> >> >>>>> In the build phase, I don't see any -Wl,-rpath,... added on the >> >> >>>>> command line. >> >> >>>>> >> >> >>>>> What do I miss there ? >> >> >>>>> >> >> >>>>> I have been using: >> >> >>>>> >> >> >>>>> SET(CMAKE_SKIP_BUILD_RPATH FALSE) >> >> >>>>> SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) >> >> >>>>> SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) >> >> >>>>> SET(CMAKE_INSTALL_RPATH "${EXAMPLE_INSTALL_LIB_DIR}") >> >> >>>>> >> >> >>>>> as indicated in the Wiki. >> >> >>>>> >> >> >>>>> Is there tool on the Mac to get rpath from the executable ? >> >> >>>>> >> >> >>>>> >> >> >>>>> Thanks for your help >> >> >>>>> Guillaume >> >> >>>>> >> >> >>>>> -- >> >> >>>>> PGP KeyID: 2048R/EA31CFC9 subkeys.pgp.net >> >> >>>>> _______________________________________________ >> >> >>>>> Powered by www.kitware.com >> >> >>>>> >> >> >>>>> Visit other Kitware open-source projects at >> >> >>>>> http://www.kitware.com/opensource/opensource.html >> >> >>>>> >> >> >>>>> Please keep messages on-topic and check the CMake FAQ at: >> >> >>>>> http://www.cmake.org/Wiki/CMake_FAQ >> >> >>>>> >> >> >>>>> Follow this link to subscribe/unsubscribe: >> >> >>>>> http://www.cmake.org/mailman/listinfo/cmake >> >> >>>> >> >> >>>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> -- >> >> >>> PGP KeyID: 2048R/EA31CFC9 subkeys.pgp.net >> >> >> >> >> >> _______________________________________________ >> >> >> Powered by www.kitware.com >> >> >> >> >> >> Visit other Kitware open-source projects at >> >> >> http://www.kitware.com/opensource/opensource.html >> >> >> >> >> >> Please keep messages on-topic and check the CMake FAQ at: >> >> >> http://www.cmake.org/Wiki/CMake_FAQ >> >> >> >> >> >> Follow this link to subscribe/unsubscribe: >> >> >> http://www.cmake.org/mailman/listinfo/cmake >> >> >> >> >> > >> >> > >> >> > >> >> > -- >> >> > PGP KeyID: 2048R/EA31CFC9 subkeys.pgp.net >> >> > >> >> >> >> >> >> >> >> -- >> >> PGP KeyID: 2048R/EA31CFC9 subkeys.pgp.net >> >> _______________________________________________ >> >> Powered by www.kitware.com >> >> >> >> Visit other Kitware open-source projects at >> >> http://www.kitware.com/opensource/opensource.html >> >> >> >> Please keep messages on-topic and check the CMake FAQ at: >> >> http://www.cmake.org/Wiki/CMake_FAQ >> >> >> >> Follow this link to subscribe/unsubscribe: >> >> http://www.cmake.org/mailman/listinfo/cmake >> > >> > >> >> >> >> -- >> PGP KeyID: 2048R/EA31CFC9 subkeys.pgp.net > > -- PGP KeyID: 2048R/EA31CFC9 subkeys.pgp.net _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake