Valgrind 3.25 cannot start on Arch Linux glibc 2.44, so run it in the CI container
Symptom#
Every valgrind run ends at start-up, before the program runs. The log says: valgrind: Fatal error at startup: a function redirection which is mandatory for this platform-tool combination cannot be set up, then A must-be-redirected function whose name matches the pattern: memcmp in an object with soname matching: ld-linux-x86-64.so.2 was not found. A test runner such as make valgrind-cpp reports the test as failed (Error 1, Error 2), although no code ran.
Cause#
Valgrind 3.25.1 needs a memcmp symbol in the dynamic linker. The ld.so of glibc 2.44 on Arch Linux does not export it. The Debian fix, the package libc6-dbg, does not exist on Arch. Setting DEBUGINFOD_URLS to the Arch debuginfod server did not help.
Fix#
Do not run valgrind natively on that host. Run it inside the Ubuntu CI image, which has a working valgrind. In dftracer-utils use scripts/ci/run_ci_local.sh --filter '<ctest regex>' valgrind-cpp. It needs docker and a copy of the tree that the container may write, because the build directory it creates is owned by root. On a Linux host a container runs at native speed. Docker on a Mac is much slower.
Evidence#
Run on an x86-64 Arch host: native make valgrind-cpp gave FAILED (exit 1) with the redirection error in the log. The same test through scripts/ci/run_ci_local.sh --filter 'trace/views/test_view_duql$' valgrind-cpp ran and gave real results (C++ summary: 1/1 passed under Valgrind, or leak records). valgrind --version was 3.25.1 and pacman -Q glibc was 2.44.
Also found by searching
- valgrind: Fatal error at startup: a function redirection which is mandatory for this platform-tool combination cannot be set up
- valgrind memcmp in an object with soname matching ld-linux-x86-64.so.2 was not found
- valgrind fails on Arch Linux, no libc6-dbg package
- how do I run valgrind on a rolling-release distro whose ld.so has no memcmp symbol