Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Debugging - Valgrind - glibc -> issue
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1173
Location: /run/user/1000

PostPosted: Wed Sep 13, 2017 1:12 pm    Post subject: [SOLVED] Debugging - Valgrind - glibc -> issue Reply with quote

Valgrind gives me this error :

Code:
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.


... was reading Gentoo Wiki (https://wiki.gentoo.org/wiki/Debugging#Valgrind) and it deals with that problem, however I can't try it because I can't find common.eblit file in glibc ebuild directory. This :
Quote:
Create a copy of the glibc ebuild in a custom repository, then edit the file sys-libs/glibc/files/eblits/common.eblit, line 226 :


Any other way to solve this ?


Last edited by The Main Man on Thu Sep 14, 2017 1:42 pm; edited 2 times in total
Back to top
View user's profile Send private message
saboya
Guru
Guru


Joined: 28 Nov 2006
Posts: 552
Location: Brazil

PostPosted: Wed Sep 13, 2017 2:12 pm    Post subject: Reply with quote

That wiki entry is out of date. If I'm not mistaken, eblits have been deprecated in favor of eclasses. So you would need to edit /usr/portage/eclasses/toolchain-glibc.eclass.

*edit* - Searching a little, I think that's unnecessary. You just need FEATURES="nostrip".
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1173
Location: /run/user/1000

PostPosted: Wed Sep 13, 2017 2:26 pm    Post subject: Reply with quote

Thought so, I didn't do that part from Wiki thinking what else from it might be outdated, but I guess I'll try to re-emerge glibc with new features and see what happens.
Back to top
View user's profile Send private message
kharitonow
n00b
n00b


Joined: 10 Dec 2015
Posts: 38

PostPosted: Wed Sep 13, 2017 6:21 pm    Post subject: Reply with quote

kajzer wrote:
Thought so, I didn't do that part from Wiki thinking what else from it might be outdated, but I guess I'll try to re-emerge glibc with new features and see what happens.


You could use package.env
E.g something like this:

Code:
sudo echo sys-libs/glibc no-builtin-strlen.conf >> /etc/portage/package.env/glibc
sudo echo CFLAGS="${CFLAGS} -fno-builtin-strlen" >> /etc/portage/env/no-builtin-strlen.conf
sudo emerge -1 glibc
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1173
Location: /run/user/1000

PostPosted: Wed Sep 13, 2017 8:39 pm    Post subject: Reply with quote

kharitonow wrote:

You could use package.env
E.g something like this:

Code:
sudo echo sys-libs/glibc no-builtin-strlen.conf >> /etc/portage/package.env/glibc
sudo echo CFLAGS="${CFLAGS} -fno-builtin-strlen" >> /etc/portage/env/no-builtin-strlen.conf
sudo emerge -1 glibc


There's no need for "nostrip" in make.conf and to install debugging information (I don't need gdb btw) ?
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23283

PostPosted: Thu Sep 14, 2017 12:31 am    Post subject: Reply with quote

I think kharitonow was showing an abstract example of how to customize a single package, rather than giving you steps to be followed literally. You still need debugging information for Valgrind, and FEATURES=nostrip on the relevant package is the easiest way to get it.
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1173
Location: /run/user/1000

PostPosted: Thu Sep 14, 2017 11:14 am    Post subject: Reply with quote

I know, but I'm confused with installing debugging info, wiki says :
Quote:
If nostrip is in your default FEATURES, splitdebug won't do anything, so we disable it for debug-packages!
FEATURES="${FEATURES} splitdebug compressdebug -nostrip"


So I don't know how I should use "FEATURES=nostrip" in that case.

To be clear, I just need Valgrind to run, nothing more, I understand how to do those steps per package, but Wiki is clearly outdated and I'm just not sure about the right steps.
Back to top
View user's profile Send private message
saboya
Guru
Guru


Joined: 28 Nov 2006
Posts: 552
Location: Brazil

PostPosted: Thu Sep 14, 2017 11:26 am    Post subject: Reply with quote

kajzer wrote:
I know, but I'm confused with installing debugging info, wiki says :
Quote:
If nostrip is in your default FEATURES, splitdebug won't do anything, so we disable it for debug-packages!
FEATURES="${FEATURES} splitdebug compressdebug -nostrip"


So I don't know how I should use "FEATURES=nostrip" in that case.

To be clear, I just need Valgrind to run, nothing more, I understand how to do those steps per package, but Wiki is clearly outdated and I'm just not sure about the right steps.


You either don't strip symbols out with nostrip or split them into separate files fomr the binary with splitdebug. That's my understanding.
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1173
Location: /run/user/1000

PostPosted: Thu Sep 14, 2017 12:56 pm    Post subject: Reply with quote

I'll recompile glibc with splitdebug feature and -fno-builtin-strlen, hopefully that should be enough.

edit: Yeah that did it, thanks everyone!
Back to top
View user's profile Send private message
icyhearts
n00b
n00b


Joined: 24 Sep 2017
Posts: 31

PostPosted: Sat Apr 20, 2019 4:48 am    Post subject: Reply with quote

kajzer wrote:
I'll recompile glibc with splitdebug feature and -fno-builtin-strlen, hopefully that should be enough.

edit: Yeah that did it, thanks everyone!

How did you do that in detail? like this?
Code:

"FEATURES=nostrip"  emerge -a sys-libs/glibc

I am not so experienced gentoo user.
Back to top
View user's profile Send private message
The Main Man
Veteran
Veteran


Joined: 27 Nov 2014
Posts: 1173
Location: /run/user/1000

PostPosted: Sat Apr 20, 2019 8:40 am    Post subject: Reply with quote

icyhearts wrote:
How did you do that in detail? like this?


You just edit /etc/portage/make.conf and add this line :
Code:
FEATURES="splitdebug"


then emerge glibc

btw in case you're wondering it's like that now, it wasn't that simple when I posted that issue, it required more magic.
Back to top
View user's profile Send private message
cynapse
n00b
n00b


Joined: 05 Jan 2022
Posts: 4

PostPosted: Mon Jan 10, 2022 2:12 am    Post subject: Reply with quote

I faced the same error but didn't want to make global changes to my make.conf.

I created the file /etc/portage/env/glibc.conf
Code:

CFLAGS="-O2 -gdwarf-4 -pipe -fno-builtin-strlen"
FEATURES="${FEATURES} nostrip"

Note: I am using -gdwarf-4 instead of -ggdb which wasnt working. see this thread

Then in /etc/portage/package.env/my.env
Code:

sys-libs/glibc glibc.conf


Version info:
sys-libs/glibc-2.33-r7
dev-util/valgrind-3.17.0
Linux 5.15.11-gentoo

Hopefully this helps someone else (Or my future self).

Dont forget to emerge glibc after these config changes.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum