Re: [CMake] Multiple executables sharing object files
On Dec 19, 2007 7:34 AM, Joël Schaerer [EMAIL PROTECTED] wrote: Hi all, is there anything new regarding this issue : http://www.cmake.org/pipermail/cmake/2005-September/007271.html 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
Re: [CMake] Multiple executables sharing object files
I have read this FAQ entry, but it doesn't seem to adress my issue at all... joel Quoting Brandon Van Every [EMAIL PROTECTED]: On Dec 19, 2007 7:34 AM, Joël Schaerer [EMAIL PROTECTED] wrote: Hi all, is there anything new regarding this issue : http://www.cmake.org/pipermail/cmake/2005-September/007271.html 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 ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Multiple executables sharing object files
On Dec 19, 2007 10:47 AM, Joël Schaerer [EMAIL PROTECTED] wrote: I have read this FAQ entry, but it doesn't seem to adress my issue at all... Did you read http://www.cmake.org/Bug/view.php?id=5155 ? Cheers, Brandon Van Every ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Multiple executables sharing object files
On Dec 19, 2007 11:08 AM, Joel Schaerer [EMAIL PROTECTED] wrote: Thanks a lot. This is a real issue since compiling everything two or ten times just for the sake of it is *not* efficient. We are currently considering switching back to makefiles and a custom VS project because of this. I'd be happy to see your comments on this in the bug report. It's not going to get action unless someone other than myself lights a match under the issue. Cheers, Brandon Van Every ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Multiple executables sharing object files
Brandon Van Every wrote: On Dec 19, 2007 11:08 AM, Joel Schaerer [EMAIL PROTECTED] wrote: Thanks a lot. This is a real issue since compiling everything two or ten times just for the sake of it is *not* efficient. We are currently considering switching back to makefiles and a custom VS project because of this. Maybe I am missing something, but why not create a static library and share it with the executables? Why try to reuse object files? CMake makes it very easy to create static libraries and link them to executables. -Bill ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Multiple executables sharing object files
Maybe I am missing something, but why not create a static library and share it with the executables? Why try to reuse object files? CMake makes it very easy to create static libraries and link them to executables. -Bill Because then you have to relink all executables each time you change one of the library files, even the ones that don't rely on that file. Which isn't efficient either. Say you have 100 library files, and 30 executables, which depend on average on 20 library files. Using a intermediary static library is not going to help you... Object files were probably created exactly for this, so they could be shared between multiple targets without being rebuilt needlessly. Why exactly isn't there an option to share the build directory between targets, like it was the standard behavior prior to 2005? joel ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake -- Joël Schaerer PhD. Student Advisors: Patrick Clarysse, Isabelle Magnin CREATIS-LRMN, UMR CNRS 5220, Inserm U630 INSA de Lyon 7 rue Jean Capelle bat. Blaise Pascal, 4ème étage F-69621 Villeurbanne CEDEX France Tel (+33) 4 72 43 63 06 Fax (+33) 4 72 43 85 26 http://www.creatis.insa-lyon.fr ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
RE: [CMake] Multiple executables sharing object files
I work on a similarly large project and have found that building shared libraries for development is much faster (in terms of compile/link time) when making small changes (working in Visual Studio). Nightly or test builds can use static libraries to produce single executables. Provided you have setup suitable declspec macros etc, it is easy to switch between static or shared using the BUILD_SHARED_LIBS cmake option. Mike Maybe I am missing something, but why not create a static library and share it with the executables? Why try to reuse object files? CMake makes it very easy to create static libraries and link them to executables. -Bill Because then you have to relink all executables each time you change one of the library files, even the ones that don't rely on that file. Which isn't efficient either. Say you have 100 library files, and 30 executables, which depend on average on 20 library files. Using a intermediary static library is not going to help you... Object files were probably created exactly for this, so they could be shared between multiple targets without being rebuilt needlessly. Why exactly isn't there an option to share the build directory between targets, like it was the standard behavior prior to 2005? joel ___ 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] Multiple executables sharing object files
On Dec 19, 2007 11:28 AM, Bill Hoffman [EMAIL PROTECTED] wrote: Maybe I am missing something, but why not create a static library and share it with the executables? The end product may not be an executable, it may be a static library. A static library cannot include another static library. I came up with a hack to find CMake's objects and reuse them, so that the user of a static library would not have to add additional link flags. In particular, I wanted the user to be able to specify -lchicken, and not have to specify -lchicken -lpcre. Cheers, Brandon Van Every ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Multiple executables sharing object files
On Wednesday 19 December 2007, Joel Schaerer wrote: Maybe I am missing something, but why not create a static library and share it with the executables? Why try to reuse object files? CMake makes it very easy to create static libraries and link them to executables. -Bill Because then you have to relink all executables each time you change one of the library files, even the ones that don't rely on that file. Which isn't You could organize your static libs so that the executables only link to what they need. Alex ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Multiple executables sharing object files
Quoting Alexander Neundorf [EMAIL PROTECTED]: On Wednesday 19 December 2007, Joel Schaerer wrote: Maybe I am missing something, but why not create a static library and share it with the executables? Why try to reuse object files? CMake makes it very easy to create static libraries and link them to executables. -Bill Because then you have to relink all executables each time you change one of the library files, even the ones that don't rely on that file. Which isn't You could organize your static libs so that the executables only link to what they need. Yeah, you could even create one static library per executable... Awesome! What was the problem with putting all the object files in the same directory, again? Shouldn't that be an option, at least? It would be SO much easier than all the dirty hacks I'm being proposed... joel Alex ___ 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] Multiple executables sharing object files
On Wednesday 19 December 2007, you wrote: ... Yeah, you could even create one static library per executable... Awesome! What was the problem with putting all the object files in the same directory, again? Shouldn't that be an option, at least? It would be SO much easier than all the dirty hacks I'm being proposed... Different targets may be compiled with different compiler flags, defines, etc. So the object files for the same source files can differ. This is used in some projects. Alex ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Multiple executables sharing object files
Quoting Alexander Neundorf [EMAIL PROTECTED]: On Wednesday 19 December 2007, you wrote: ... Yeah, you could even create one static library per executable... Awesome! What was the problem with putting all the object files in the same directory, again? Shouldn't that be an option, at least? It would be SO much easier than all the dirty hacks I'm being proposed... Different targets may be compiled with different compiler flags, defines, etc. So the object files for the same source files can differ. This is used in some projects. Of course this is subjective, but having this questionnably useful feature (I understand it must be useful for some big projects, but for normal small to mid-sized projects, I really don't see any use for that) at the expense of much increased compilation time should be an option (and if you ask me, should be turned off by default). Alex ___ 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] Multiple executables sharing object files
One other very good reason, too: Same target may have two source files of the exact same name, but they exist in different directories (Abc/Object.cxx and Def/Object.cxx). In that case, the object files will be further hidden in subdirectories to avoid two files in the object files directory from having a name collision. On 12/19/07, Alexander Neundorf [EMAIL PROTECTED] wrote: On Wednesday 19 December 2007, you wrote: ... Yeah, you could even create one static library per executable... Awesome! What was the problem with putting all the object files in the same directory, again? Shouldn't that be an option, at least? It would be SO much easier than all the dirty hacks I'm being proposed... Different targets may be compiled with different compiler flags, defines, etc. So the object files for the same source files can differ. This is used in some projects. Alex ___ 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] Multiple executables sharing object files
Quoting David Cole [EMAIL PROTECTED]: One other very good reason, too: Same target may have two source files of the exact same name, but they exist in different directories (Abc/Object.cxx and Def/Object.cxx). In that case, the object files will be further hidden in subdirectories to avoid two files in the object files directory from having a name collision. Does that really justify multiplying compilation time by 2 or more? Who would want multiple files with the same name in the same project anyways? Plus, you could very well create a tree structure in the build directory. I must be missing something but I really don't get how compiling things multiple times for nothing could seem acceptable. On 12/19/07, Alexander Neundorf [EMAIL PROTECTED] wrote: On Wednesday 19 December 2007, you wrote: ... Yeah, you could even create one static library per executable... Awesome! What was the problem with putting all the object files in the same directory, again? Shouldn't that be an option, at least? It would be SO much easier than all the dirty hacks I'm being proposed... Different targets may be compiled with different compiler flags, defines, etc. So the object files for the same source files can differ. This is used in some projects. Alex ___ 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] Multiple executables sharing object files
Compilation time is only multiplied if you are specifying the same source file in multiple targets. If you are seeing a 2x difference, then you must have *all* of your source files listed twice. Shouldn't this only be for a few of your source files at most? I would argue that it's better to be correct, if a bit slower, than it is to have a chance of being subtly incorrect and wasting hours figuring out the subtlety. I bet you have never spent hours or days figuring out that you should not have been re-using an .obj file, but should have recompiled it with the flags to match the rest of the library. I have, so I appreciate CMake's default choice in this case. On 12/19/07, Joël Schaerer [EMAIL PROTECTED] wrote: Quoting David Cole [EMAIL PROTECTED]: One other very good reason, too: Same target may have two source files of the exact same name, but they exist in different directories (Abc/Object.cxx and Def/Object.cxx). In that case, the object files will be further hidden in subdirectories to avoid two files in the object files directory from having a name collision. Does that really justify multiplying compilation time by 2 or more? Who would want multiple files with the same name in the same project anyways? Plus, you could very well create a tree structure in the build directory. I must be missing something but I really don't get how compiling things multiple times for nothing could seem acceptable. On 12/19/07, Alexander Neundorf [EMAIL PROTECTED] wrote: On Wednesday 19 December 2007, you wrote: ... Yeah, you could even create one static library per executable... Awesome! What was the problem with putting all the object files in the same directory, again? Shouldn't that be an option, at least? It would be SO much easier than all the dirty hacks I'm being proposed... Different targets may be compiled with different compiler flags, defines, etc. So the object files for the same source files can differ. This is used in some projects. Alex ___ 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] Multiple executables sharing object files
On Dec 19, 2007 3:41 PM, David Cole [EMAIL PROTECTED] wrote: One other very good reason, too: Same target may have two source files of the exact same name, but they exist in different directories (Abc/Object.cxx and Def/Object.cxx). In that case, the object files will be further hidden in subdirectories to avoid two files in the object files directory from having a name collision. If we had a standard way of finding the location of object files, this wouldn't be an issue as the directory name would be part of what's returned. You guys sure argue a lot about an easy feature to implement. Where's the harm in making it easy for the user to find the object files? Cheers, Brandon Van Every ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Multiple executables sharing object files
On 12/19/07, Brandon Van Every [EMAIL PROTECTED] wrote: ...an easy feature to implement... So easy to implement that the attached patch was 0 bytes...? :-) ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Multiple executables sharing object files
On Dec 19, 2007 3:52 PM, David Cole [EMAIL PROTECTED] wrote: Compilation time is only multiplied if you are specifying the same source file in multiple targets. If you are seeing a 2x difference, then you must have *all* of your source files listed twice. Shouldn't this only be for a few of your source files at most? How would you know? It would depend entirely upon his hierarchy of source file abstractions. A static library cannot include another static library. That severely limits abstractions. That's why you guys end up talking about silliness like one static lib per exe. There are no available abstractions to do otherwise. I didn't want to be forced to recompile PCRE 6 times for all its different consumers, when I knew jolly well they were all supposed to receive exactly the same objects, no flag variations whatsoever. I didn't want the end user to be aware of PCRE, it was an implementation detail of Chicken that they should never have to think about. Cheers, Brandon Van Every ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Multiple executables sharing object files
On Dec 19, 2007 4:24 PM, David Cole [EMAIL PROTECTED] wrote: On 12/19/07, Brandon Van Every [EMAIL PROTECTED] wrote: ...an easy feature to implement... So easy to implement that the attached patch was 0 bytes...? Bill's comments at http://www.cmake.org/Bug/view.php?id=5155 about the difficulty do not make any sense to me. It sounds like he tried to implement fullblown convenience libraries. I just want to know where object files are turning up. I did it in 10 lines of CMake script and it worked everywhere that Chicken was built for many months. What's the problem? Cheers, Brandon Van Every ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] Multiple executables sharing object files
Where are these 10 lines? Can you post them here or point to the chicken .cmake source file that contains them? On 12/19/07, Brandon Van Every [EMAIL PROTECTED] wrote: On Dec 19, 2007 4:24 PM, David Cole [EMAIL PROTECTED] wrote: On 12/19/07, Brandon Van Every [EMAIL PROTECTED] wrote: ...an easy feature to implement... So easy to implement that the attached patch was 0 bytes...? Bill's comments at http://www.cmake.org/Bug/view.php?id=5155 about the difficulty do not make any sense to me. It sounds like he tried to implement fullblown convenience libraries. I just want to know where object files are turning up. I did it in 10 lines of CMake script and it worked everywhere that Chicken was built for many months. What's the problem? 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] Multiple executables sharing object files
On Dec 19, 2007 7:32 PM, David Cole [EMAIL PROTECTED] wrote: Where are these 10 lines? In the bug tracker, conspiciously above Bill's comments. They've been there for 6 months. http://www.cmake.org/Bug/view.php?id=5155 On 12/19/07, Brandon Van Every [EMAIL PROTECTED] wrote: On Dec 19, 2007 4:24 PM, David Cole [EMAIL PROTECTED] wrote: On 12/19/07, Brandon Van Every [EMAIL PROTECTED] wrote: ...an easy feature to implement... So easy to implement that the attached patch was 0 bytes...? Bill's comments at http://www.cmake.org/Bug/view.php?id=5155 about the difficulty do not make any sense to me. It sounds like he tried to implement fullblown convenience libraries. I just want to know where object files are turning up. I did it in 10 lines of CMake script and it worked everywhere that Chicken was built for many months. What's the problem? 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