Re: [CMake] Creating a static lib from other static libs, HOW?
On 9/18/07, Juan Sanchez [EMAIL PROTECTED] wrote: Hello Brandon, How do you create the final archive without the ar command? The FAQ points at feature request #5155 where this is explained. If the explanation given is not clear, let me know. Cheers, Brandon Van Every ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Creating a static lib from other static libs, HOW?
I guess you'd have to come up with a way of renaming each object file with a prefix special to each original archive. The v option (GNU ar) will tell you the name object being extracted. Maybe you can use an external script to automate the process of renaming the files as they are being extracted. Even with Brandon's solution, I don't think ar let you add multiple .o files of the same name in the archive. The symbols of the first .o file will get replaced by the symbols of the second .o file to be added. Juan Goswin von Brederlow wrote: Juan Sanchez [EMAIL PROTECTED] writes: Hello, The ar command can be used to extract the .o files from a .a file. Extracting them all into the same directory, perhaps you can use some file globbing to find all the objects and add them to another archive. Juan I tried that. It fails if two *.o files have the same name as I noticed. MfG Goswin -- Juan Sanchez [EMAIL PROTECTED] 800-538-8450 Ext. 54395 512-602-4395 ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Creating a static lib from other static libs, HOW?
On 9/18/07, Juan Sanchez [EMAIL PROTECTED] wrote: Even with Brandon's solution, I don't think ar let you add multiple .o files of the same name in the archive. I'm going to guess you meant, Even with Brandon's solution that doesn't use AR, you can't add multiple .o files of the same name to a library. I'm not sure about that. When I pass CMake objects to a library, I provide qualified pathnames, so I don't know if the name of the object file matters. You can't have multiple function definitions, but that's about the code, not the object files. I've not had to deal with this issue myself. You'd need to try my way and see what happens. Cheers, Brandon Van Every ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Creating a static lib from other static libs, HOW?
Brandon Van Every [EMAIL PROTECTED] writes: On 9/16/07, Juan Sanchez [EMAIL PROTECTED] wrote: Hello, The ar command can be used to extract the .o files from a .a file. Extracting them all into the same directory, perhaps you can use some file globbing to find all the objects and add them to another archive. Yeah but that's the ar command, which is specific to Unixy systems. Doesn't help a cross-platform build solution that includes MSVC. I just got done telling all you guys how to reuse objects in a platform independent manner. And it's in the FAQ now for handy reference. Problems arise when you have too many objects for the command line. You need succesive links steps then. Did you consider that? MfG Goswin ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Creating a static lib from other static libs, HOW?
Hello Brandon, How do you create the final archive without the ar command? Juan Brandon Van Every wrote: On 9/18/07, Juan Sanchez [EMAIL PROTECTED] wrote: Even with Brandon's solution, I don't think ar let you add multiple .o files of the same name in the archive. I'm going to guess you meant, Even with Brandon's solution that doesn't use AR, you can't add multiple .o files of the same name to a library. I'm not sure about that. When I pass CMake objects to a library, I provide qualified pathnames, so I don't know if the name of the object file matters. You can't have multiple function definitions, but that's about the code, not the object files. I've not had to deal with this issue myself. You'd need to try my way and see what happens. Cheers, Brandon Van Every ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake -- Juan Sanchez [EMAIL PROTECTED] 800-538-8450 Ext. 54395 512-602-4395 ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Creating a static lib from other static libs, HOW?
To be posix compliant, the path name is not to be encoded into the archive. While I was able to create an archive ar crv foo.a A/a.o B/a.o and the symbols from both object appeared, this doesn't seem to be very safe. Especially since doing this: ar crv foo.a A/a.o ar crv foo.a B/a.o will result in an archive with only the symbols from B/a.o. There is a non-posix compliant extension to gnu ar, but it seems to be fraught with peril. From the ar manpage: P Use the full path name when matching names in the archive. GNU ar can not create an archive with a full path name (such archives are not POSIX complaint), but other archive creators can. This option will cause GNU ar to match file names using a complete path name, which can be convenient when extracting a single file from an archive created by another tool. Juan Sanchez wrote: Hello Brandon, How do you create the final archive without the ar command? Juan Brandon Van Every wrote: On 9/18/07, Juan Sanchez [EMAIL PROTECTED] wrote: Even with Brandon's solution, I don't think ar let you add multiple .o files of the same name in the archive. I'm going to guess you meant, Even with Brandon's solution that doesn't use AR, you can't add multiple .o files of the same name to a library. I'm not sure about that. When I pass CMake objects to a library, I provide qualified pathnames, so I don't know if the name of the object file matters. You can't have multiple function definitions, but that's about the code, not the object files. I've not had to deal with this issue myself. You'd need to try my way and see what happens. Cheers, Brandon Van Every ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
RE: [CMake] Creating a static lib from other static libs, HOW?
Could you post the link to the faq? I don't see which question covers the topic. Juan -Original Message- From: [EMAIL PROTECTED] on behalf of Brandon Van Every Sent: Mon 9/17/2007 1:10 AM To: cmake@cmake.org Subject: Re: [CMake] Creating a static lib from other static libs, HOW? On 9/16/07, Juan Sanchez [EMAIL PROTECTED] wrote: Hello, The ar command can be used to extract the .o files from a .a file. Extracting them all into the same directory, perhaps you can use some file globbing to find all the objects and add them to another archive. Yeah but that's the ar command, which is specific to Unixy systems. Doesn't help a cross-platform build solution that includes MSVC. I just got done telling all you guys how to reuse objects in a platform independent manner. And it's in the FAQ now for handy reference. Cheers, Brandon Van Every ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Creating a static lib from other static libs, HOW?
On 9/17/07, Sanchez, Juan [EMAIL PROTECTED] wrote: Could you post the link to the faq? I don't see which question covers the topic. http://www.cmake.org/Wiki/CMake_FAQ#Does_that_mean_I_have_to_build_all_my_library_objects_twice.2C_once_for_shared_and_once_for_static.3F.21__I_don.27t_like_that.21 Cheers, Brandon Van Every ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake