[Cmake] Library link line compression (again)
Ian Scott
ian . m . scott at stud . man . ac . uk
Mon, 19 Nov 2001 09:59:04 -0000
Amitha,
I had a go at doing this. I gave up because it didn't have any noticible
effect on DevStudio's loading or linking speed. I've lost the code, but the
algorithm should go something like this
Add a function StripLinkLibrariesToTreeDependecy, called under the control
of some cache variable from cmMakeFile::FinalPass
Method cmMakeFile::StripLinkLibrariesToTreeDependecy
Copy sequence of all linklibraries to LL
start = Beginning of LL
Starting from i = End of LL
--i;
Get Library L = *i
j = i;
While (j!= start)
j--;
if *j = *i
remove *j
shuffle all previous members (start, j-1) of LL up one
++start;
Until i == start;
Copy LL back to LinkLibaries.
End
Alternatively you could put the code in the FinalPass method of a new
Command StripLinkLibrariesToTreeDependecy
Ian.
> -----Original Message-----
> From: Amitha Perera [mailto:perera at cs . rpi . edu]
> Sent: Friday, November 16, 2001 9:40 PM
> To: cmake at public . kitware . com
> Cc: chrisc at cs . rpi . edu
> Subject: [Cmake] Library link line compression (again)
>
>
> Hi all
>
> Would anyone object to adding an option to CMake to allow link line
> compression? In particular, I think that most projects have a tree
> like library dependency, and it is possible for CMake to automatically
> eliminate duplicate libraries without causing linking failures. The
> default mode would be what it is now, which generates a long link line
> (for vxl, at least).
>
> As the message below indicates, this is probably a useful process, and
> a good step in lieu of a full dependency analysis.
>
> Amitha.
>
>
> ----- Forwarded message from "Christopher D. Carothers"
> <chrisc at cs . rpi . edu> -----
>
> To: Amitha Perera <perera at cs . rpi . edu>
> From: "Christopher D. Carothers" <chrisc at cs . rpi . edu>
> Date: Fri, 16 Nov 2001 16:32:43 -0500 (EST)
> Subject: fyi: static linking needs huge swap space!
>
> Folks, to link a static version of online tracining under linux
> (and freebsd, solaris as well I suspect), you need 1.3 GB of swap in
> addition to 256 MB of RAM. I watched "top" as the final link was being
> done and you could just see the vast amount of memory being allocated.
>
> I think the reason for this because the link line has duplicates
> of every lib. Amitha, is there anyway we can cut down on
> these duplicates
> and still avoid unresolved symbols.
>
> My office machine now has 2 GB of swap :-)
>
> Happy compiling!
>
> Chris
>
>
> ----- End forwarded message -----
> _______________________________________________
> Cmake mailing list
> Cmake at public . kitware . com
> http://public . kitware . com/mailman/listinfo/cmake
>