如何在 Snow Leopard 上编译 Valgrind?

发布于 2024-08-21 19:06:15 字数 37 浏览 2 评论 0原文

如何在 Snow Leopard 上编译 Valgrind?

How can I compile Valgrind on Snow Leopard?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

幸福不弃 2024-08-28 19:06:15

假设您已经安装了 XCode 工具和 SVN 客户端,就可以了。

转到您保存内容的某个目录。
检查 valgrind 源

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

下载 Greg Parker 的 10.6 补丁

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

应用补丁

cd valgrind
patch -p0 < 10.6.patch

编译 valgrind

./autogen.sh
./configure
make

安装它

sudo make install

运行它

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

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
你的心境我的脸 2024-08-28 19:06:15

仅供参考,Valgrind 3.6(2010 年 10 月 21 日发布)正式支持 Snow Leopard 开箱即用。

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

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

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

—━☆沉默づ 2024-08-28 19:06:15

除了diciu的(几乎)完美答案。用于编译 64 位版本的 valgrind(64 位可执行文件所需的,也称为 OS 10.6 中的标准)。您需要像这样运行配置:./configure --enable-only64bit

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

昔日梦未散 2024-08-28 19:06:15

diciu 的答案对于 32 位构建来说完美无缺,但我无法通过调整这些指令来使 64 位构建工作。

找到了一些有关获取 64 位版本 valgrind 的其他工作说明尽管。

(此处复制,稍作修改,因为 os x 上默认情况下未安装 wget)

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

编辑:为了响应评论,要同时拥有 32 位和 64 位,请执行以下命令:(请注意,我不需要 32 位 valgrind ,所以我没有尝试这个,但它应该可以工作)

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

之后两者都将位于 inst32/ 和 inst64/ 中。

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.

鸠魁 2024-08-28 19:06:15

使用 --enable-only64bit 配置标志避免了将 host_cpu="x86_64" 破解到配置脚本中(使用发布的补丁 diciu)

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

夜访吸血鬼 2024-08-28 19:06:15

酿造安装valgrind

更多信息请访问 https://github.com/mxcl/homebrew

brew install valgrind

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

錯遇了你 2024-08-28 19:06:15

你不能。尚不支持。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文