Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Valgrind and macOS Big Sur

I'm having troubles installing Valgrind on the macOS Big Sur through the Homebrew. In the terminal I have tried

$ brew install valgrind

After Homebrew's autoupdate, I got the following message:

valgrind: Linux is required for this software.
Error: An unsatisfied requirement failed this build.

Is there a way I can install Valgrind?

like image 915
J Szum Avatar asked Jan 28 '21 04:01

J Szum


People also ask

Does valgrind work on macOS?

x and later), ARM64/Android, X86/Android (4.0 and later), MIPS32/Android, X86/FreeBSD, AMD64/FreeBSD, X86/Darwin and AMD64/Darwin (Mac OS X 10.12). Valgrind is Open Source / Free Software, and is freely available under the GNU General Public License, version 2.

Does valgrind work on Mac M1?

Valgrind does not seem to work on M1 Macs.

Is macOS Big Sur still supported?

Apple only officially supports the three most recent versions of macOS (currently 10.15 Catalina, 11 Big Sur, and 12 Monterey). If you're running an older version of macOS, it is no longer receiving security or stability updates.


4 Answers

Roughly your only hope is here, a work in progress.

brew tap LouisBrunner/valgrind
brew install --HEAD LouisBrunner/valgrind/valgrind
like image 124
Paul Floyd Avatar answered Oct 04 '22 13:10

Paul Floyd


I’d say Valgrind is a lost cause on macOS. Try looking into Address/Leak Sanitizer. Note that Apple Clang does not support leak checking, so you’ll have to grab llvm off Brew instead. If you use -fsanitize=address, you’ll also have to prepend ASAN_OPTIONS=detect_leaks=1 on macOS.

like image 24
Eric Xu Avatar answered Oct 04 '22 13:10

Eric Xu


Valgrind is not supported by Big Sur, but you can try this

brew tap LouisBrunner/valgrind
brew install --HEAD LouisBrunner/valgrind/valgrind

or a better option in Preferences | Build, Execution, Deployment | CMake -> Cmake options use

-DCMAKE_BUILD_TYPE=ASAN -DCMAKE_CXX_COMPILER=/usr/local/opt/llvm/bin/clang++

and enter image description here

like image 28
Alexander Yalunin Avatar answered Oct 04 '22 12:10

Alexander Yalunin


You can try leaks. I don't know how it compares to valgrind in terms of features, but it's enough for me rn.

leaks -atExit -- ./path/to/binary
like image 22
DesantBucie Avatar answered Oct 04 '22 11:10

DesantBucie