1

When I execute Valgrind on Clion Editor, the following error shows up.

/usr/local/bin/valgrind --tool=memcheck --xml=yes --xml-file=/private/var/folders/gq/r_j6y6112zlccqkwxp0rj_v00000gn/T/clion-valgrind6333974d-afb4-4c0b-8c03-407df60789cf/valgrind_output_%p --gen-suppressions=all --leak-check=full --leak-resolution=med --track-origins=yes --vgdb=no /Users/hayashi-ay/Projects/tests/cmake-build-debug/main --gtest_filter=* --gtest_color=no
Testing started at 2:10 ...
dyld[8729]: Library not loaded: /usr/lib/libc++.1.dylib
  Referenced from: /Users/hayashi-ay/Projects/tests/cmake-build-debug
  Reason: tried: '/usr/lib/libc++.1.dylib' (no such file), '/usr/local/lib/libc++.1.dylib' (no such file)

main uses following dynamic libraries

otool -L main
main:
        /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1200.3.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0)

But simply run ./main works fine, so I guess valgrind can't handle dynamic linking.


My Environment:

OS:

sw_vers
ProductName:    macOS
ProductVersion: 12.0.1
BuildVersion:   21A559

Valgrind:

valgrind --version
valgrind-3.18.0.GIT-lbmacos

CLion:

CLion 2021.2.2
Build #CL-212.5284.51, built on September 17, 2021
Licensed to xxxxxxxxxxxxxx
Subscription is active until October 6, 2022.
For educational use only.
Runtime version: 11.0.12+7-b1504.28 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.0.1
GC: G1 Young Generation, G1 Old Generation
Memory: 2000M
Cores: 8
Registry: run.processes.with.pty=TRUE
Non-Bundled Plugins: com.intellij.plugins.vscodekeymap (212.3116.29)
4
  • Which version of macOS? Which version of Valgrind? Which version of CLion? Commented Oct 29, 2021 at 8:34
  • Thanks I added a comment. Commented Nov 1, 2021 at 12:13
  • I haven't done much work on Valgrind on macOS. Valgrind most definitely doee support dynamic linking on Linux, FreeBSD and Solaris. However, as far as I'm aware, the issue is that Apple added a mechanism with Big Sur to hide the dynamic library files (in /System/Library/dyld/dyld_shared_cache_x86_64). Valgrind doesn't know how to read that. There is a tool to extract the libraries (for debuggers) called dsc_extractor. I haven't tried and and can't say how you would go about getting Valgrind to read the right information from the extracted libraries. Commented Nov 1, 2021 at 21:07
  • Valgrind memcheck used to work fine on macOS 10.* I recently installed Monterey 12.5.1 and I get the same error as reported. Commented Aug 30, 2022 at 13:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.