鍍金池/ 問答/C  iOS  網(wǎng)絡安全/ macOS 10.13 無法成功安裝 Valgrind

macOS 10.13 無法成功安裝 Valgrind

首先嘗試用brew安裝,報錯:

$ brew install valgrind
valgrind: This formula either does not compile or function as expected on macOS
versions newer than Sierra due to an upstream incompatibility.

然后嘗試編譯安裝,官網(wǎng)下載的3.13.0版本,提示我gcc版本不對

$ ./configure
...
checking for a supported version of gcc... Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
no (applellvm-9.1.0)
configure: error: please use gcc >= 3.0 or clang >= 2.9 or icc >= 13.0

本機gcc版本

$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
回答
編輯回答
骨殘心

查了蠻久雖然沒有搞清楚問題原因是什么但是找到了解決的方法。
依然是使用brew安裝

brew edit valgrind

1.修改head下的url
head section
將url替換為

git://sourceware.org/git/valgrind.git

2.更新Homebrew

brew update

3.最后安裝head版本就可以了

brew install --HEAD valgrind 

原文鏈接:How to Install Valgrind on macOS High Sierra

2018年2月20日 23:32