Re: [CMake] Gathering up required shared libraries
On 8/2/11 9:28 AM, Clinton Stimpson wrote: You shouldn't need to copy GetPrerequisites and BundleUtilities. For Linux you can do: set_target_properties( ... PROPERTIES INSTALL_RPATH \$ORIGIN/../lib) To get/usr/lib/ to be treated as non-system libraries, you can implement gp_resolved_file_type_override() to adjust that behavior. See gp_item_default_embedded_path() in GetPrerequisites for more information. And finally, to copy the dependents into lib/ instead of bin/, you can implement gp_item_default_embedded_path_override() to return a different path. See gp_resolved_file_type() in GetPrerequisites for more information. Great! I knew that there had to be a better way that I was simply missing. Thanks a lot! :-D Cheers, Greg ___ 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
Re: [CMake] Gathering up required shared libraries
On 8/2/11 9:28 AM, Clinton Stimpson wrote: You shouldn't need to copy GetPrerequisites and BundleUtilities. For Linux you can do: set_target_properties( ... PROPERTIES INSTALL_RPATH \$ORIGIN/../lib) To get /usr/lib/ to be treated as non-system libraries, you can implement gp_resolved_file_type_override() to adjust that behavior. See gp_item_default_embedded_path() in GetPrerequisites for more information. And finally, to copy the dependents into lib/ instead of bin/, you can implement gp_item_default_embedded_path_override() to return a different path. See gp_resolved_file_type() in GetPrerequisites for more information. Okay, so that gets me *nearly* everything that I want, but my new problem is that on Mac OSX fixup_bundle incorrectly assumes that the bundle directory is where the executable is --- namely, bin/, rather than the installation directory --- and then complains that the libraries have not been copied into the bundle; if I instead pass in the installation directory then it complains because it isn't a .app dir. Thanks to your advice I now know to specifically look for *_override hooks in the BundleUtilities, but unfortunately unless I am missing something it looks like there are no such hooks that will let me change this behavior, so I will need to copy BundleUtilities and then modify get_dotapp_dir to return the parent of the directory of the executable rather than the directory of the executable itself. Could I request that overrides be added to in BundleUtilities similar to the ones in GetPrerequisites so that someone facing my situation won't have to do this in the future? It looks to me though like an override in get_dotapp_dir might suffice, and I could easily implement that myself by following the pattern for overrides in GetPrerequisites and then send you all a patch, but you all have a better sense of the big picture than a relative newcomer to hacking on CMake like myself so I would be happy for any feedback you have on this idea. :-) Cheers, Greg ___ 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
Re: [CMake] Gathering up required shared libraries
On 8/2/11 12:47 PM, David Cole wrote: The non .app dir problem should go away if you use the recently released CMake 2.8.5. This bug was fixed in that version: http://public.kitware.com/Bug/view.php?id=12034 Thank you very much for the heads up, but I have already been running CMake 2.8.5 already and that particular fix doesn't solve my problem because I was hoping to put the executables and libraries in different directories --- namely bin/ for the executables and lib/ for the libraries, to fit the standard unix-style layout --- and the particular fix that you linked only helps in the case where all the executables and binaries are put in the same directory. Cheers, Greg ___ 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
Re: [CMake] Gathering up required shared libraries
On 8/2/11 12:53 PM, Clinton Stimpson wrote: On Mac, are you making a .app bundle, or are you doing a layout similar to Linux, with bin/, lib/ layout, or something else? The latter --- I was hoping to use a layout similar to Linux with bin/, lib/, etc. since the program is console-based and so it doesn't have a GUI. Cheers, Greg ___ 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
Re: [CMake] Gathering up required shared libraries
On 8/2/11 4:32 PM, Clinton Stimpson wrote: There is no scanning the file system to find which libraries to fix up. Any libraries used by executables will be considered in the set of libraries to fix up, regardless of where they are installed (in bin/ or lib/). Any libraries not found as a dependency can be specified by the second parameter of fixup_bundle(). Plugins are a typical example of that, because executables and libraries don't link against plugins. Doh! For some reason I thought I saw that the code was doing that but I see now that I was mistaken. You don't need to add your libraries to the second parameter. If you did, you'd have to know them all up front, and that defeats one of the purpose of BundleUtilities. Sorry, I obviously didn't make it clear that I was referring to libraries that I was not planning on linking the program against --- that is, libraries provided for the benefit of other developers but not actually used by my program. Having said that, discussing this has made me realize that in my case it would probably make more sense for me to link against my own shared library anyway to prevent code from being duplicated in both program and library, so my use case is not as likely as I had been originally imagining. If you copy BundleUtilities/GetPrerequisites and remove the FATAL_ERROR issued. Then the installation is fixed up correctly, including the libraries in lib/. The fix for this bug is to modify that error check. Okidoke, that sounds easy, and you obviously know what's going on better than me so I'll just run with that solution until it gets fixed in the mainline. Thank you very much for your help!!! :-) Cheers, Greg ___ 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
Re: [CMake] Gathering up required shared libraries
On 08/02/2011 05:36 PM, David Cole wrote: When you do not have a .app directory, and you are not copying into the same directory with the executable, then the question in my mind becomes what exactly is 'the bundle' at this point? With a dir/bin, dir/lib typical Linux style layout, dir would be the bundle... If we really want to support this, perhaps we need another function to extend fixup_bundle so that you pass in the bundle's directory, and its main executable, or a list of executables. Instead of trying to derive it from just the main executable like we do now. David C. For what my two cents are worth, I think that this is a great idea and would be incredibly helpful, though again I will not claim to be an expert here. :-) Cheers, Greg ___ 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
[CMake] Gathering up required shared libraries
Hey everyone, I am using CMake to build a package which has the normal unix layout, i.e. programs are in bin/, libraries are in lib/, etc., and I would like to simply copy all of the required shared non-system libraries into lib/ and make sure that the executable is updated to look for them there so that I can have an standalone distribution. CMake *almost* supports this with fixup_bundle, but unless I am missing something it doesn't seem to give me any control as to where the shared libraries are installed, and it doesn't update the executable except on OSX --- though the latter is not a big deal since if I understand correctly I can just add @executable_path@/../lib to the RPATH. Furthermore, on Linux it incorrectly assumes that libraries in /usr/lib should be considered system libraries (that is, guaranteed to be available everywhere), when in fact only libraries in /lib should be, which means that I can't even easily use get_prerequisites directly to find all of the libraries that I need and then copy them to the correct location myself. (Of course, an alternative would be to just statically-link everything, but frankly having searched around it looks like it is simply impossible for me to force all non-system libraries to be statically linked, especially since once of them is libgfortran which is included automatically by the gfortran compiler and I can't figure out a good way to get CMake to reliably link statically to libgfortran instead of dynamically. If anyone has any recommendations on this front I would be happy to hear them.) So anyway, at the moment to do what I want it looks like I would have to make my own project-specific copies of GetPrerequisites.cmake and BundleUtilities.cmake and then hack them up in order to force them to do what I want. But I can't help but think that there must have lots of people out there who have wanted to do what I want to do and so this problem must have been solved in a much better way. So does anyone have advice for a way to do what I want, i.e. an easy way to copy all non-system libraries (where only /lib is interpreted to be the location of system libraries) to a directory of my choosing relative to the installation prefix and to modify the executable to make sure it finds them? Or is my only option really to copy into my project and hack up GetPrerequisites.cmake and BundleUtilities.cmake? Thanks a lot in advance! :-) Cheers, Greg ___ 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