sewardj | 83abe43 | 2002-07-01 08:46:27 +0000 | [diff] [blame] | 1 | |
sewardj | bc39ad2 | 2007-12-09 02:24:02 +0000 | [diff] [blame] | 2 | These notes were significantly updated on 6 Dec 2007 for the Valgrind |
| 3 | 3.3.0 release. |
| 4 | |
sewardj | 83abe43 | 2002-07-01 08:46:27 +0000 | [diff] [blame] | 5 | Greetings, packaging person! This information is aimed at people |
| 6 | building binary distributions of Valgrind. |
| 7 | |
sewardj | bc39ad2 | 2007-12-09 02:24:02 +0000 | [diff] [blame] | 8 | Thanks for taking the time and effort to make a binary distribution of |
| 9 | Valgrind. The following notes may save you some trouble. |
| 10 | |
| 11 | |
| 12 | -- Do not ship your Linux distro with a completely stripped |
| 13 | /lib/ld.so. At least leave the debugging symbol names on -- line |
| 14 | number info isn't necessary. If you don't want to leave symbols on |
| 15 | ld.so, alternatively you can have your distro install ld.so's |
| 16 | debuginfo package by default, or make ld.so.debuginfo be a |
| 17 | requirement of your Valgrind RPM/DEB/whatever. |
| 18 | |
| 19 | Reason for this is that Valgrind's Memcheck tool needs to intercept |
| 20 | calls to, and provide replacements for, some symbols in ld.so at |
| 21 | startup (most importantly strlen). If it cannot do that, Memcheck |
| 22 | shows a large number of false positives due to the highly optimised |
| 23 | strlen (etc) routines in ld.so. This has caused some trouble in |
| 24 | the past. As of version 3.3.0, on some targets (ppc32-linux, |
| 25 | ppc64-linux), Memcheck will simply stop at startup (and print an |
| 26 | error message) if such symbols are not present, because it is |
| 27 | infeasible to continue. |
| 28 | |
| 29 | It's not like this is going to cost you much space. We only need |
| 30 | the symbols for ld.so (a few K at most). Not the debug info and |
| 31 | not any debuginfo or extra symbols for any other libraries. |
sewardj | 83abe43 | 2002-07-01 08:46:27 +0000 | [diff] [blame] | 32 | |
| 33 | |
| 34 | -- (Unfortunate but true) When you configure to build with the |
| 35 | --prefix=/foo/bar/xyzzy option, the prefix /foo/bar/xyzzy gets |
nethercote | 6bd3ebd | 2004-08-24 13:56:54 +0000 | [diff] [blame] | 36 | baked into valgrind. The consequence is that you _must_ install |
sewardj | 83abe43 | 2002-07-01 08:46:27 +0000 | [diff] [blame] | 37 | valgrind at the location specified in the prefix. If you don't, |
| 38 | it may appear to work, but will break doing some obscure things, |
| 39 | particularly doing fork() and exec(). |
| 40 | |
| 41 | So you can't build a relocatable RPM / whatever from Valgrind. |
| 42 | |
| 43 | |
sewardj | bc39ad2 | 2007-12-09 02:24:02 +0000 | [diff] [blame] | 44 | -- Don't strip the debug info off lib/valgrind/$platform/vgpreload*.so |
| 45 | in the installation tree. Either Valgrind won't work at all, or it |
| 46 | will still work if you do, but will generate less helpful error |
| 47 | messages. Here's an example: |
sewardj | 83abe43 | 2002-07-01 08:46:27 +0000 | [diff] [blame] | 48 | |
| 49 | Mismatched free() / delete / delete [] |
| 50 | at 0x40043249: free (vg_clientfuncs.c:171) |
| 51 | by 0x4102BB4E: QGArray::~QGArray(void) (tools/qgarray.cpp:149) |
| 52 | by 0x4C261C41: PptDoc::~PptDoc(void) (include/qmemarray.h:60) |
| 53 | by 0x4C261F0E: PptXml::~PptXml(void) (pptxml.cc:44) |
| 54 | Address 0x4BB292A8 is 0 bytes inside a block of size 64 alloc'd |
| 55 | at 0x4004318C: __builtin_vec_new (vg_clientfuncs.c:152) |
| 56 | by 0x4C21BC15: KLaola::readSBStream(int) const (klaola.cc:314) |
| 57 | by 0x4C21C155: KLaola::stream(KLaola::OLENode const *) (klaola.cc:416) |
| 58 | by 0x4C21788F: OLEFilter::convert(QCString const &) (olefilter.cc:272) |
| 59 | |
| 60 | This tells you that some memory allocated with new[] was freed with |
sewardj | bc39ad2 | 2007-12-09 02:24:02 +0000 | [diff] [blame] | 61 | free(). |
sewardj | 83abe43 | 2002-07-01 08:46:27 +0000 | [diff] [blame] | 62 | |
| 63 | Mismatched free() / delete / delete [] |
sewardj | bc39ad2 | 2007-12-09 02:24:02 +0000 | [diff] [blame] | 64 | at 0x40043249: (inside vgpreload_memcheck.so) |
sewardj | 83abe43 | 2002-07-01 08:46:27 +0000 | [diff] [blame] | 65 | by 0x4102BB4E: QGArray::~QGArray(void) (tools/qgarray.cpp:149) |
| 66 | by 0x4C261C41: PptDoc::~PptDoc(void) (include/qmemarray.h:60) |
| 67 | by 0x4C261F0E: PptXml::~PptXml(void) (pptxml.cc:44) |
| 68 | Address 0x4BB292A8 is 0 bytes inside a block of size 64 alloc'd |
sewardj | bc39ad2 | 2007-12-09 02:24:02 +0000 | [diff] [blame] | 69 | at 0x4004318C: (inside vgpreload_memcheck.so) |
sewardj | 83abe43 | 2002-07-01 08:46:27 +0000 | [diff] [blame] | 70 | by 0x4C21BC15: KLaola::readSBStream(int) const (klaola.cc:314) |
| 71 | by 0x4C21C155: KLaola::stream(KLaola::OLENode const *) (klaola.cc:416) |
| 72 | by 0x4C21788F: OLEFilter::convert(QCString const &) (olefilter.cc:272) |
| 73 | |
| 74 | This isn't so helpful. Although you can tell there is a mismatch, |
| 75 | the names of the allocating and deallocating functions are no longer |
| 76 | visible. The same kind of thing occurs in various other messages |
| 77 | from valgrind. |
| 78 | |
| 79 | |
sewardj | bc39ad2 | 2007-12-09 02:24:02 +0000 | [diff] [blame] | 80 | -- Don't strip symbols from lib/valgrind/$platform/{cachegrind, |
bart | ccf17de | 2008-07-04 15:14:35 +0000 | [diff] [blame] | 81 | callgrind,drd,exp-omega,helgrind,lackey,massif,memcheck,none} |
sewardj | bc39ad2 | 2007-12-09 02:24:02 +0000 | [diff] [blame] | 82 | in the installation tree. Doing so will likely cause problems. |
| 83 | Removing the line number info is probably OK, although that has not |
| 84 | been tested by the Valgrind developers. |
sewardj | 83abe43 | 2002-07-01 08:46:27 +0000 | [diff] [blame] | 85 | |
sewardj | 83abe43 | 2002-07-01 08:46:27 +0000 | [diff] [blame] | 86 | |
sewardj | bc39ad2 | 2007-12-09 02:24:02 +0000 | [diff] [blame] | 87 | -- Please test the final installation works by running it on something |
| 88 | huge. I suggest checking that it can start and exit successfully |
| 89 | both Firefox-2.0.0.X and OpenOffice.org 2.3.X. I use these as test |
| 90 | programs, and I know they fairly thoroughly exercise Valgrind. The |
| 91 | command lines to use are: |
| 92 | |
| 93 | valgrind -v --trace-children=yes mozilla |
| 94 | |
| 95 | valgrind -v --trace-children=yes soffice |
sewardj | 83abe43 | 2002-07-01 08:46:27 +0000 | [diff] [blame] | 96 | |
| 97 | |
mueller | 2b317b5 | 2004-01-02 23:11:35 +0000 | [diff] [blame] | 98 | If you find any more hints/tips for packaging, please report |
njn | 272b216 | 2005-05-17 03:22:38 +0000 | [diff] [blame] | 99 | it as a bugreport. See http://www.valgrind.org for details. |