Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 799017 - sys-libs/glibc-2.33: missing source files in debugsyms installsources environment
Summary: sys-libs/glibc-2.33: missing source files in debugsyms installsources environ...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
Depends on: 799260
  Show dependency tree
Reported: 2021-06-28 11:48 UTC by Michael Hofmann
Modified: 2021-07-14 20:53 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---

emerge --info (emerge-info.txt,6.10 KB, text/plain)
2021-06-28 19:09 UTC, Michael Hofmann
build.log.gz (build.log.gz,25.73 KB, application/gzip)
2021-06-28 19:21 UTC, Michael Hofmann
List of files in /usr/src/debug/sys-libs/glibc-2.33/glibc-2.33/nptl (list_of_files_in_usr_src_debug_sys-libs_glibc-2.33_glibc-2.33_nptl.txt,3.08 KB, text/plain)
2021-06-28 19:37 UTC, Michael Hofmann
Build log (build2.log.gz,372.14 KB, application/gzip)
2021-06-28 22:50 UTC, Michael Hofmann

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Hofmann 2021-06-28 11:48:56 UTC
I installed sys-libs/glibc-2.33 using the "debugsyms installsources" environment. It works, but some source files are not installed in /usr/src/debug. An example is "pthread_create.c".

A user reported the issue in the Gentoo forums:

It happens on my machine, too. 

I'm not a debugging expert, so I don't fully understand what's going on. It seems to me that "pthread_create.c" (and more files) should be installed, but I can be wrong.

Reproducible: Always
Comment 1 Sergei Trofimovich (RETIRED) gentoo-dev 2021-06-28 18:06:39 UTC
I think it's a limitation of debugedit: bug #768444. gcc-11 generates dwarf-5 that debugedit does not parse. As a wourkaround you can try to add -gdwarf-4 into CFLAGS.
Comment 2 Michael Hofmann 2021-06-28 18:40:12 UTC
I'm on stable and I use GCC 10. debugedit is NOT installed on my machine. 

Some source file like "pthread_self.c" get installed in /usr/src/debug, others like "pthread_create.c" do NOT get installed.
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2021-06-28 19:02:55 UTC
Ah, thanks for the details.

The fact that pthread_self.c is being installed for you is surprising to me. FEATURES=installsources requires debugedit:

In you share `emerge --info` and glibc's build.log maybe it will shed sole light.
Comment 4 Michael Hofmann 2021-06-28 19:09:33 UTC
Created attachment 719874 [details]
emerge --info
Comment 5 Michael Hofmann 2021-06-28 19:21:33 UTC
Created attachment 719877 [details]
Comment 6 Michael Hofmann 2021-06-28 19:25:28 UTC
Thanks for looking into this! 

I installed "dev-util/debugedit" on my machine, ran 

   FEATURES="keepwork" emerge --oneshot glibc 

and uploaded the build log as well as the output of "emerge --info". 

I'll also upload a list of the files that are installed in "/usr/src/debug/sys-libs/glibc-2.33/glibc-2.33/nptl"
Comment 7 Michael Hofmann 2021-06-28 19:37:21 UTC
Created attachment 719880 [details]
List of files in /usr/src/debug/sys-libs/glibc-2.33/glibc-2.33/nptl
Comment 8 Sergei Trofimovich (RETIRED) gentoo-dev 2021-06-28 21:45:40 UTC
(In reply to Michael Hofmann from comment #5)
> Created attachment 719877 [details]
> build.log.gz

Due to FEATURES=keepwork it's not cleat how (and if at all) pthread_create.c was compiled on your system.

My guess is that a debugging flag was missing from CFLAGS on your system. 

Usually you want at least -g1 in CFLAGS to get some debugging references to source code.
Comment 9 Michael Hofmann 2021-06-28 22:50:01 UTC
Created attachment 719940 [details]
Build log

This is the full build log
Comment 10 Michael Hofmann 2021-06-28 23:01:56 UTC
Sergei, I'm sorry! I uploaded the wrong build log file. The compile phase was missing. Please accept my apologies.

I just uploaded the correct build log.

Line 1880 shows that "pthread_create.c" was compiled and that option "-ggdb" was used.
Comment 11 Sergei Trofimovich (RETIRED) gentoo-dev 2021-06-29 09:58:42 UTC
(In reply to Michael Hofmann from comment #9)
> Created attachment 719940 [details]
> Build log
> This is the full build log

I think I reproduced the effect you are seeing. Here is my attempt (with debugedit installed):

1. FEATURES=installsources LANG="en_US.utf8" LINGUAS="de en" CFLAGS="-march=native -O2 -pipe" CXXFLAGS="-march=native -O2 -pipe"  emerge -v1 glibc

  result: no sources installed

2. FEATURES=installsources LANG="en_US.utf8" LINGUAS="de en" CFLAGS="-march=native -O2 -pipe -ggdb" CXXFLAGS="-march=native -O2 -pipe -ggdb"  emerge -v1 glibc

  result: has sources installed, but not the pthread_create.c

It's an unintended side-effect of 'dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so' in glibc's ebuild. It tries to prevent debugging stripping but might have a side-effect of skipping installsources.

Verified with:

--- a/sys-libs/glibc/glibc-2.33.ebuild
+++ b/sys-libs/glibc/glibc-2.33.ebuild
@@ -1216,7 +1216,7 @@ glibc_do_src_install() {
        is_crosscompile && dostrip -x /
        # gdb thread introspection relies on local libpthreas symbols. stripping breaks it
        # See Note [Disable automatic stripping]
-       dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so
+       #dostrip -x $(alt_libdir)/libpthread-${upstream_pv}.so

        if [[ -e ${ED}/$(alt_usrlibdir)/libm-${upstream_pv}.a ]] ; then
                # Move versioned .a file out of libdir to evade portage QA checks

I think it's a portage's bin/estrip bug. I'll craft a shorter reproducer this evening and file a bug against portage.

Looks like there is no nice workaround to make it work today.
Comment 12 Sergei Trofimovich (RETIRED) gentoo-dev 2021-06-29 17:15:38 UTC
Filed bug #799260
Comment 13 Michael Hofmann 2021-06-29 19:52:57 UTC
Sergei, thanks for looking into this and for creating bug #799260 with a test case!