On Sun, 22 Jun 2025, at 17:52, Kenneth Wolcott wrote:
> sudo port -v -s install valgrind-macos-devel
> Error: Cannot install valgrind-macos-devel for the arch 'x86_64' because
> Error: its dependency libtool is only installed for the arch 'arm64'
> Error: and does not have a universal variant.
> Error: Unable to execute port valgrind-macos-devel: architecture mismatch

It is trying to tell you the port is x86-only.

https://github.com/macports/macports-ports/blob/8d8bf9caacf9dc40f381ba7aef5440657f522a82/devel/valgrind/Portfile#L10

> supported_archs     i386 x86_64

There is some experimental arm64 support in this fork...
https://github.com/LouisBrunner/valgrind-macos

...but there is also a bug report that says it might crash your computer.
https://github.com/LouisBrunner/valgrind-macos/issues/123

> Is there some substitute to valgrind for MacOS arm64?

valgrind does many things.  What debugging features are you after?

if you want to look for malloc leaks,
man 1 leaks

I have never used this in anger.  I tried it out just now on a toy program with 
a leak, and it did give me useful output with 'MallocStackLogging' set in the 
environment.  (I am typing on an old Intel machine.  leaks(1) is from Apple so 
one would expect it to work on all their platforms.)

I was about to suggest ASan/LSan...
https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer

...but it seems that, too, does not work reliably on darwin/arm64.
https://discourse.llvm.org/t/does-leaksanitizer-not-work-on-macos-13-apple-silicon/73148

So now I am also wondering how people get work done on this platform. :)  If 
you find an answer, I would be interested to hear your solution.  Maybe most 
Apple developers just use Instruments in their Xcode projects.

If the software you are trying to debug is portable, and if you have the 
source, it might be easier to do your debugging on an x86 machine or on a 
developer friendly operating system.  (And hope the bug shows up in a build 
there.)  tcmalloc is nice for profiling (and also has some LSan-like features) 
but is from Google and so only works on Linux AFAIK.

Good luck!

Reply via email to