开发者

How can I compile Valgrind on Snow Leopard?

How can I c开发者_开发技巧ompile Valgrind on Snow Leopard?


Assuming you've got XCode tools installed and an SVN client, here it goes.

Go to some directory you keep stuff in. Checkout valgrind sources

svn co svn://svn.valgrind.org/valgrind/tags/VALGRIND_3_5_0 valgrind

Download Greg Parker's 10.6 patch

curl http://bugsfiles.kde.org/attachment.cgi?id=36999 > 10.6.patch
mv 10.6.patch ./valgrind

Apply the patch

cd valgrind
patch -p0 < 10.6.patch

Compile valgrind

./autogen.sh
./configure
make

Install it

sudo make install

Run it

valgrind --leak-check=full --show-reachable=yes /tmp/a.out


FYI, Valgrind 3.6 (released October 21, 2010) officially supports Snow Leopard out-of-the-box.

http://valgrind.org/docs/manual/dist.news.html


In addition to the (almost) perfect answer of diciu. For compiling a 64 bit version of valgrind (required for 64 bit executables, aka. the standard in OS 10.6). You will need to run configure like this: ./configure --enable-only64bit


diciu's answer worked flawlessly for a 32 bit build, but I couldn't get a 64 bit build working by adapting those instructions.

Found some other working instructions for getting a 64bit build of valgrind though.

(replicated here, slightly adapted, since wget is not installed by default on os x)

svn co -r 11104 svn://svn.valgrind.org/valgrind/trunk valgrind
cd valgrind
curl http://bugsfiles.kde.org/attachment.cgi?id=40091 -o snow-leopard.patch
curl http://bugsfiles.kde.org/attachment.cgi?id=40900 -o arc4random.patch
curl http://bugsfiles.kde.org/attachment.cgi?id=42530 -o sidt.patch 
curl http://bugsfiles.kde.org/attachment.cgi?id=42892 -o signal.patch
patch -p0 < snow-leopard.patch
patch -p0 < arc4random.patch
patch -p1 < signal.patch
cd VEX; patch -p0 < ../sidt.patch ; cd ..
touch darwin10-drd.supp
touch darwin10.supp
./autogen.sh || autoreconf -fvi
./configure --prefix=`pwd`/inst64 --build=amd64-darwin
make -j 8 && make install

Edit: in response to the comments, to have both 32 and 64 bit also do the following commands: (note that I have no need for a 32bit valgrind, so I didn't try this, but it should work)

make clean
 ./configure --prefix=`pwd`/inst32
make -j 8 && make install

Both will be located in inst32/ and inst64/ afterwards.


Using the --enable-only64bit configure flag avoided having to hack host_cpu="x86_64" into the configure script (using the patch diciu posted)


brew install valgrind

More info at https://github.com/mxcl/homebrew


You can't. It isn't supported yet.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜