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

Re: [*] about gcc



Junichi Uekawa <ti0113@mail4.doshisha.ac.jp> writes:

> On Sun, 6 Feb 2000 13:55:08 -0600, Brad <lists@anomie.ods.org> was crying out from somewhere
>   about: Re: [*] about gcc
> 
> lists> On Mon, Feb 07, 2000 at 04:38:32AM +0900, Junichi Uekawa wrote:
> lists> > you need to do 
> lists> > 
> lists> > gcc -lm
> lists> > 
> lists> > to link the maths library.
> lists> > 
> lists> > Don't ask me why. 
> lists> 
> lists> Because the actual code for the sqrt function is in the math library,
> lists> and the math library isn't linked in by default.
> 
> One thing I would really like to know is, why isn't it linked in by default?
> 
> Well, it would make people realize that these functions actually reside in the libraries, and tells people of the use of -lm from the early stages.
> 
> But, why isn't it, really, not linked in as default?

Because most programs don't need math functions. On my Debian system,
here are the programs i can find with a simple script[1] that link
libm:

in /bin:
ae

in /sbin:
cfdisk

in /usr/bin (for reasons I won't go into, this includes
/usr/X11R6/bin) (note also that at least GTK+ links libm, and anything
here that links gtk may only report libm because of transient
dependencies - unfortunately, ldd doesn't have an option I know of to
hide transient dependecies) (finally note that several program names
are links to one program, such as emacs, emacs20, and emacs-20.5):
XF86_FBDev XF86_SVGA a2p a2p-5.005 addftinfo another_clock_applet ant
apt-cache apt-cdrom apt-config apt-get asclock_applet attraction
aweset awk background-properties-capplet battery_applet
bell-properties-capplet bitmap blaster blitspin bouboule braid bsod
bubbles bumps ccurve cdplayer_applet charpick_applet clockmail_applet
compass coral cpumemusage_applet critical crystal cynosure decayscreen
deco deluxe demon deskguide_applet dialer_applet discrete
diskusage_applet distort dns-helper drift drivemount_applet editor
eeyes emacs emacs-20.5 emacs20 epicycle eqn esd esdcat esdctl esdfilt
esdloop esdmon esdplay esdrec esdsample factor fadeplot fifteen_applet
find-scanner flag flame flow forest galaxy gconfigger gdb gdm
gdmchooser gdmlogin gen_util_applet geqn gimp gmenu
gnome-dump-metadata gnome-edit gnome-edit-properties-capplet
gnome-gen-mimedb gnome-login-check gnome-moz-remote gnome-name-service
gnome-session gnome-smproxy gnome-terminal gnome_segv gnomecc
gnomepager_applet goad-browser goop gpic grav greynetic grodvi groff
grohtml grolj4 grops grotty gs gtbl gv gxditview halo helix hopalong
hpftodit hypercube ifs imsmap indxbib interference jbc_applet jigsaw
julia kaleidescope keyboard-properties kumppa laser life_applet
lightning lisa lissie lkbib lmorph loadshlib lookbib loop lynx mawk
maze mime-type-capplet mini_commander_applet mixer_applet mkfontdir
modemlights_applet moire moire2 mountain mouse-properties-capplet
multiload_applet munch mysql mysqladmin mysqldump mysqlimport
mysqlshow nawk new-object noseguy oclock panel pdfimages pdfinfo
pdftopbm pdftops pdftotext pedal penetrate penrose perl perl-5.005
perl5.005 perl5.00503 petri pfbtops phosphor pic pyro qix rd-bomb
refer ripples rocks rorschach rotor save-session sawmill scanimage
screensaver-properties-capplet seq session-properties
session-properties-capplet sfxload sfxtest shadebobs sierpinski
slidescreen slip soelim sonar sound-properties sox sphere spiral
spotlight squiral starfish strange swirl t3d tasklist_applet tasksel
tbl tfmtodit theme-selector-capplet triangle troff truchet
ui-properties update-menus url-properties vines wander
webcontrol_applet whiptail wine wineclipsrv wineserver
wm-properties-capplet x-window-manager x11perf xcam xdpyinfo xflame
xieperf xjack xlyap xmag xmatrix xpdf xroger xsane xscanimage
xscreensaver-demo xsublim xworm

Lastly, from /usr/sbin:
install-menu saned

This is 1 of 61 from /bin, 1 of 77 from /sbin, 244 of 698 from
/usr/{X11R6/,}bin, and 2 of 94 from /usr/sbin. All said, this is 248
of 930 (on my system), or about 27%. Most programs don't need libm, so
there is no compelling reason to link it by default.

[1]
#!/bin/sh
for i in *
 do
  if (ldd $i 2>/dev/null | grep libm > /dev/null)
 then
  echo "$i "
 fi
done

-- 
Jakob 'sparky' Kaivo - jkaivo@ndn.net - http://jakob.kaivo.net/


Reply to: