Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: [SOLVED] valgrind doesn't work (Read 5396 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

Re: valgrind doesn't work

Reply #15
I have the same issue.

Code: [Select]
env | grep "debug"
DEBUGINFOD_URLS=https://debuginfod.artixlinux.org

and yet ...


Code: [Select]
==2277== Memcheck, a memory error detector
==2277== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==2277== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info
==2277== Command: ls
==2277==

valgrind:  Fatal error at startup: a function redirection
valgrind:  which is mandatory for this platform-tool combination
valgrind:  cannot be set up.  Details of the redirection are:
valgrind:
valgrind:  A must-be-redirected function
valgrind:  whose name matches the pattern:      strlen
valgrind:  in an object with soname matching:   ld-linux-x86-64.so.2
valgrind:  was not found whilst processing
valgrind:  symbols from the object with soname: ld-linux-x86-64.so.2
valgrind:
valgrind:  Possible fixes: (1, short term): install glibc's debuginfo
valgrind:  package on this machine.  (2, longer term): ask the packagers
valgrind:  for your Linux distribution to please in future ship a non-
valgrind:  stripped ld.so (or whatever the dynamic linker .so is called)
valgrind:  that exports the above-named function using the standard
valgrind:  calling conventions for this platform.  The package you need
valgrind:  to install for fix (1) is called
valgrind:
valgrind:    On Debian, Ubuntu:                 libc6-dbg
valgrind:    On SuSE, openSuSE, Fedora, RHEL:   glibc-debuginfo
valgrind:
valgrind:  Note that if you are debugging a 32 bit process on a
valgrind:  64 bit system, you will need a corresponding 32 bit debuginfo
valgrind:  package (e.g. libc6-dbg:i386).
valgrind:
valgrind:  Cannot continue -- exiting now.  Sorry.

Re: valgrind doesn't work

Reply #16
There are some conf files for debuginfod, check if you have .pacnew versions?
Code: [Select]
debuginfod /etc/
debuginfod /etc/debuginfod/
debuginfod /etc/debuginfod/artixlinux.urls
debuginfod /etc/profile.d/
debuginfod /etc/profile.d/debuginfod.csh
debuginfod /etc/profile.d/debuginfod.sh
The concept is this debuginfod package accesses the debug symbols which are in an online server rather than on your system. For this to work the glibc package on your machine must match the online version(s) so you must be fully updated and not doing anything weird with your package management or using unusual packages, like some special GLIBC from the AUR. I guess the web request could fail, possibly due to security restrictions you have enabled, or the versions don't match because you have an old glibc. Also you can always use the traditional method of building glibc and anything else you need with debug symbols enabled, it can be done fairly easily by altering some values in /etc/makepkg.conf and possibly the related PKGBUILD's, that's how I always used to use valgrind and gdb. If this is also a longstanding installation that has stopped working then perhaps try reinstalling it after removal, as it seems a fresh install is working for those who have tried, and MESYETI had an old existing install? Also re the shell environment version, possibly if you are not using BASH as your shell, this could potentially cause difficulties.

Re: valgrind doesn't work

Reply #17
i have the same issue with valgrind, and maybe the solution...

--2022-11-27 21:52:43--  http://debuginfod.artixlinux.org/
Resolving debuginfod.artixlinux.org (debuginfod.artixlinux.org)... 209.126.11.233
Connecting to debuginfod.artixlinux.org (debuginfod.artixlinux.org)|209.126.11.233|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://debuginfod.artixlinux.org/ [following]
--2022-11-27 21:52:43--  https://debuginfod.artixlinux.org/
Loaded CA certificate '/etc/ssl/certs/ca-certificates.crt'
Connecting to debuginfod.artixlinux.org (debuginfod.artixlinux.org)|209.126.11.233|:443... connected.
ERROR: The certificate of ‘debuginfod.artixlinux.org’ is not trusted.
ERROR: The certificate of ‘debuginfod.artixlinux.org’ has expired.
The certificate has expired



Re: [SOLVED] valgrind doesn't work

Reply #19
Hi, same issue here:

Code: [Select]
==8172== Memcheck, a memory error detector
==8172== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==8172== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info
==8172== Command: ./newsraft -l flog
==8172==

valgrind:  Fatal error at startup: a function redirection
valgrind:  which is mandatory for this platform-tool combination
valgrind:  cannot be set up.  Details of the redirection are:
valgrind: 
valgrind:  A must-be-redirected function
valgrind:  whose name matches the pattern:      strlen
valgrind:  in an object with soname matching:   ld-linux-x86-64.so.2
valgrind:  was not found whilst processing
valgrind:  symbols from the object with soname: ld-linux-x86-64.so.2
valgrind: 
valgrind:  Possible fixes: (1, short term): install glibc's debuginfo
valgrind:  package on this machine.  (2, longer term): ask the packagers
valgrind:  for your Linux distribution to please in future ship a non-
valgrind:  stripped ld.so (or whatever the dynamic linker .so is called)
valgrind:  that exports the above-named function using the standard
valgrind:  calling conventions for this platform.  The package you need
valgrind:  to install for fix (1) is called
valgrind: 
valgrind:    On Debian, Ubuntu:                 libc6-dbg
valgrind:    On SuSE, openSuSE, Fedora, RHEL:   glibc-debuginfo
valgrind: 
valgrind:  Note that if you are debugging a 32 bit process on a
valgrind:  64 bit system, you will need a corresponding 32 bit debuginfo
valgrind:  package (e.g. libc6-dbg:i386).
valgrind: 
valgrind:  Cannot continue -- exiting now.  Sorry.

I installed debuginfod and my env has
Code: [Select]
DEBUGINFOD_URLS=https://debuginfod.artixlinux.org
Maybe second possible fix that valgrind message mentions

Code: [Select]
valgrind:  package on this machine.  (2, longer term): ask the packagers
valgrind:  for your Linux distribution to please in future ship a non-
valgrind:  stripped ld.so (or whatever the dynamic linker .so is called)
valgrind:  that exports the above-named function using the standard
valgrind:  calling conventions for this platform.

has to do something with the issue? It seems we have a stripped ld in repos:

Code: [Select]
~ $ file /usr/lib/ld-linux-x86-64.so.2
/usr/lib/ld-linux-x86-64.so.2: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), static-pie linked, BuildID[sha1]=c177c50fe3563f80e1e8ff4dcefc29a862783bd4, stripped

So maybe it should be unstripped?

EDIT:

Nevermind, I just tested valgrind in Arch Linux and it works despite ld.so binary is stripped. I wonder what is the problem exactly in Artix Linux...

Code: [Select]
 ~ $ valgrind --debuginfo-server=https://debuginfod.artixlinux.org ls

doesn't work either.

Re: [SOLVED] valgrind doesn't work

Reply #20
I think I've found what's the issue here! Debug package might be okay overall except for strlen symbol because when glibc is build with optimization it just yields out any strlen calls and we end up without symbols for it. This patch https://www.openembedded.org/pipermail/openembedded-core/2016-December/248444.html implies
Code: [Select]
-fno-builtin-strlen
build flag in glibc will fix the valgrind error. I hope anyone here can put this flag to glibc debug package? Thanks

Re: [SOLVED] valgrind doesn't work

Reply #21
The glibc-debug works just fine for me. However, I do get that error if I don't install glibc-debug. Is that supposed to happen? I'm pretty sure I've used valgrind in the past plenty of times without necessarily needing glibc debug symbols.

Re: [SOLVED] valgrind doesn't work

Reply #22
The glibc-debug works just fine for me. However, I do get that error if I don't install glibc-debug. Is that supposed to happen? I'm pretty sure I've used valgrind in the past plenty of times without necessarily needing glibc debug symbols.

I had it working for a couple of hours recently so I thought someone did put this -fno-builtin-strlen flag into glibc debug package and was about to go to the forum to thank whoever did it for very much prompt fix, but I just tested valgrind and it doesn't work again :(

Btw how do you get to install glibc-debug? I don't have this package in my repositories. I thought it is fetched from Artix's debuginfod server every time I launch valgrind...

Re: [SOLVED] valgrind doesn't work

Reply #23
Just enable the debug repos in your pacman.conf ($repo-debug). Basically the same as how it works in Arch.

Re: [SOLVED] valgrind doesn't work

Reply #24
You mean like this?

Code: [Select]
[system-debug]
Include = /etc/pacman.d/mirrorlist

[world-debug]
Include = /etc/pacman.d/mirrorlist

[galaxy-debug]
Include = /etc/pacman.d/mirrorlist

That didn't do the trick, but valgrind seems to be working again.
Looks like it requires some rest from time to time C:

 

Re: [SOLVED] valgrind doesn't work

Reply #25
Yeah that's what I meant. The mirrors that carry the debug packages might be different, and unfortunately I don't remember if it was noted down anywhere (I'm using a dev one not a public one).

Re: [SOLVED] valgrind doesn't work

Reply #26
Can I somehow also get to these repositories? What is in your pacman.conf and mirrorlist exactly? I'm asking because valgrind is broken again... I wonder why it does work in periods like that, damn

Re: [SOLVED] valgrind doesn't work

Reply #27
Yeah that's what I meant. The mirrors that carry the debug packages might be different, and unfortunately I don't remember if it was noted down anywhere (I'm using a dev one not a public one).

I've tried pinging debuginfod.artixlinux.org and found out that it redirects to one of several servers and I thought that some servers have bad debug package (without -fno-builtin-strlen flag) and because after I connect to a single server it caches these invalid symbols which I continue to use for some period of time and get error regardless of valgrind restart.

To try all possible servers debuginfod.artixlinux.org redirects me to I did this:

Code: [Select]
while sleep 1
do
rm -rf ~/.cache/debuginfod_client
rm -rf ~/.debuginfod.sqlite
valgrind ls
done

And after a couple of minutes I didn't get even one success :(
Can you tell if there were attempts at adding -fno-builtin-strlen flag? Why sometimes it works and sometimes it doesn't? I just don't get it

Re: [SOLVED] valgrind doesn't work

Reply #28
I have no debug repos in my pacman.conf, just system, world, galaxy, lib32, universe, omniverse, extra, community and multilib, but valgrind always worked fine for me. However if it's mirror related, it has been my experience that often some Artix mirrors are better synced / updated than others, indeed I was updating a fresh install just recently and got a package not found error, looked at the mirrorlist, commented out the top one, it worked then. So possibly check /etc/pacman.d/mirrorlist. Failing that, perhaps try configuring an alternative dns nameserver as another possibility? Occasionally it can help with odd connection issues.

Re: [SOLVED] valgrind doesn't work

Reply #29
I have no debug repos in my pacman.conf, just system, world, galaxy, lib32, universe, omniverse, extra, community and multilib, but valgrind always worked fine for me. However if it's mirror related, it has been my experience that often some Artix mirrors are better synced / updated than others, indeed I was updating a fresh install just recently and got a package not found error, looked at the mirrorlist, commented out the top one, it worked then. So possibly check /etc/pacman.d/mirrorlist. Failing that, perhaps try configuring an alternative dns nameserver as another possibility? Occasionally it can help with odd connection issues.

I tried plenty of mirrors - all of them hold the same set of packages I have installed (except for a few which return 404 but they were on the bottom of my mirrorlist anyway). Are you saying you have working valgrind right now? Can you test simple C program?

Code: [Select]
int main(void) {
int a = 5 - 6;
return 0;
}

I compile it with gcc -g and run valgrind ./a.out and it fails, I can't believe it's just my local thing since I installed Artix just a couple of days ago it couldn't deviate so much... Where I can report that I want -fno-builtin-strlen flag in the glibc debug package which is on debuginfod server?