[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Lots of packages with unneeded dependencies.



On Sun, 25 Oct 1998, [iso-8859-1] Nicolás Lichtmaier wrote:

>  The libstdc++ library is only required if the program uses templates,
> exceptions or some other new feature of the compiler. Most C++ programs
> don't, and can be built without needing this library. My package lftp (C++)
> is an example.

Actually this is almost completely wrong :> libstdc++ contains the IO
stream classes which are used by almost every C++ program that does simple
console IO (cout, cerr, etc). It contains the C++ string class which is
used by many modern programs for string handling. It may contain support
functions for exception handling and RTTI but I think many of those might
be staticly linked..

Template functions and classes are compiler generated and do not require
the library, exceptions (save for the possibility of the helper functions)
do not require the library either. RTTI will use the library as the
typename base class is in there.

I'd be surprised if any serios C++ program worked without libstdc++!

>  1) Compile with -fno-rtti -fno-exceptions, this will also save some space.

Some programs use rtti and some programs use exceptions. The space savings
from RTTI is trivial enough that I don't worry however exceptions can have
a huge overhead sometimes. The newest egcs seems substantially better
however to the point that I'm not concerned :>

>  2) In debian/rules, just after `make' remove the binaries built, and
> run `make CPP=cc'. 
> 
>  Example from lftp's debian/rules:
> 
>         make CXXFLAGS="-O -Wall -fno-exceptions -fno-rtti"
>         rm src/lftp src/ftpget
>         make -C src CXX=gcc CXXFLAGS="-O -Wall -fno-exceptions -fno-rtti"
                     ^^^^^^^^^

Don't you dare! I can't imagine that actually -works-! The Debian C++
compiler is g++ (or c++ or eg++) which happens to map to EGCS 1.1. The
Debian C compiler is gcc which is GCC 2.7 compiling c++ binaries with the
old gcc should be advoided as much as possible, especially since the old
compiler cannot understand the include files in libstdc++2.8/2.9 and
cannot generate compatible binaries.

You'll actually find that egcs generates substantially smaller binaries
than gcc in alot of cases.  Just to illistrate a point here are the sizes
for APT compiled with eg++ 1.0 (hamm),

   text    data     bss     dec     hex filename   
  97563   28828     176  126567   1ee67 /usr/bin/apt-get 
  75173   22324     148   97645   17d6d /usr/bin/apt-cache 

Here are the sizes for eg++ 1.1 (slink),
   text    data     bss     dec     hex filename
  43667    6484     420   50571    c58b apt-get
  29660    4348     116   34124    854c apt-cache  

Notice a slight difference? :> -fno-exceptions makes a small but not
really worthwhile reduction in size.

Jason


Reply to: