Greetings,packagingperson!Thisinformationisaimedatpeople
buildingbinarydistributionsofValgrind.
Thanksfortakingthetimeandefforttomakeabinarydistributionof
Valgrind.Thefollowingnotesmaysaveyousometrouble.
--DonotshipyourLinuxdistrowithacompletelystripped
/lib/ld.so.Atleastleavethedebuggingsymbolnameson--line
numberinfoisn'tnecessary.Ifyoudon'twanttoleavesymbolson
ld.so,alternativelyyoucanhaveyourdistroinstallld.so's
debuginfopackagebydefault,ormakeld.so.debuginfobea
requirementofyourValgrindRPM/DEB/whatever.
ReasonforthisisthatValgrind'sMemchecktoolneedstointercept
callsto,andprovidereplacementsfor,somesymbolsinld.soat
startup(mostimportantlystrlen).Ifitcannotdothat,Memcheck
showsalargenumberoffalsepositivesduetothehighlyoptimised
strlen(etc)routinesinld.so.Thishascausedsometroublein
thepast.Asofversion3.3.0,onsometargets(ppc32-linux,
ppc64-linux),Memcheckwillsimplystopatstartup(andprintan
errormessage)ifsuchsymbolsarenotpresent,becauseitis
infeasibletocontinue.
It'snotlikethisisgoingtocostyoumuchspace.Weonlyneed
thesymbolsforld.so(afewKatmost).Notthedebuginfoand
notanydebuginfoorextrasymbolsforanyotherlibraries.
--(Unfortunatebuttrue)Whenyouconfiguretobuildwiththe
--prefix=/foo/bar/xyzzyoption,theprefix/foo/bar/xyzzygets
bakedintovalgrind.Theconsequenceisthatyou_must_install
valgrindatthelocationspecifiedintheprefix.Ifyoudon't,
itmayappeartowork,butwillbreakdoingsomeobscurethings,
particularlydoingfork()andexec().
Soyoucan'tbuildarelocatableRPM/whateverfromValgrind.
--Don'tstripthedebuginfoofflib/valgrind/$platform/vgpreload*.so
intheinstallationtree.EitherValgrindwon'tworkatall,orit
willstillworkifyoudo,butwillgeneratelesshelpfulerror
messages.Here'sanexample:
Mismatchedfree()/delete/delete[]
at0x40043249:free(vg_clientfuncs.c:171)
by0x4102BB4E:QGArray::~QGArray(void)(tools/qgarray.cpp:149)
by0x4C261C41:PptDoc::~PptDoc(void)(include/qmemarray.h:60)
by0x4C261F0E:PptXml::~PptXml(void)(pptxml.cc:44)
Address0x4BB292A8is0bytesinsideablockofsize64alloc'd
at0x4004318C:__builtin_vec_new(vg_clientfuncs.c:152)
by0x4C21BC15:KLaola::readSBStream(int)const(klaola.cc:314)
by0x4C21C155:KLaola::stream(KLaola::OLENodeconst*)(klaola.cc:416)
by0x4C21788F:OLEFilter::convert(QCStringconst&)(olefilter.cc:272)
Thistellsyouthatsomememoryallocatedwithnew[]wasfreedwith
free().
Mismatchedfree()/delete/delete[]
at0x40043249:(insidevgpreload_memcheck.so)
by0x4102BB4E:QGArray::~QGArray(void)(tools/qgarray.cpp:149)
by0x4C261C41:PptDoc::~PptDoc(void)(include/qmemarray.h:60)
by0x4C261F0E:PptXml::~PptXml(void)(pptxml.cc:44)
Address0x4BB292A8is0bytesinsideablockofsize64alloc'd
at0x4004318C:(insidevgpreload_memcheck.so)
by0x4C21BC15:KLaola::readSBStream(int)const(klaola.cc:314)
by0x4C21C155:KLaola::stream(KLaola::OLENodeconst*)(klaola.cc:416)
by0x4C21788F:OLEFilter::convert(QCStringconst&)(olefilter.cc:272)
Thisisn'tsohelpful.Althoughyoucantellthereisamismatch,
thenamesoftheallocatinganddeallocatingfunctionsarenolonger
visible.Thesamekindofthingoccursinvariousothermessages
fromvalgrind.
--Don'tstripsymbolsfromlib/valgrind/*intheinstallationtree.
Doingsowilllikelycauseproblems.Removingthelinenumberinfois
probablyOK(atleastforsomeofthefilesinthatdirectory),although
thathasnotbeentestedbytheValgrinddevelopers.
--Pleasetestthefinalinstallationworksbyrunningitonsomething
huge.Isuggestcheckingthatitcanstartandexitsuccessfully
bothFirefoxandOpenOffice.org.Iusetheseastestprograms,andI
knowtheyfairlythoroughlyexerciseValgrind.Thecommandlinestouse
are:
valgrind-v--trace-children=yesfirefox
valgrind-v--trace-children=yessoffice
Ifyoufindanymorehints/tipsforpackaging,pleasereport
itasabugreport.Seehttp://www.valgrind.orgfordetails.