Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 783777 - sys-devel/binutils-2.36.1 links to system binutils-libs, breaks on uninstall of binutils-libs-2.35.2
Summary: sys-devel/binutils-2.36.1 links to system binutils-libs, breaks on uninstall ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-18 13:04 UTC by Andreas K. Hüttel
Modified: 2021-04-22 07:38 UTC (History)
8 users (show)

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


Attachments
build log of binutils 2.36.1 (binutils-2.36.1:20210418-095243.log.gz,80.31 KB, application/gzip)
2021-04-18 13:08 UTC, Magnus Granberg
Details
world upgrade leading to broken binutils.txt (upgrade.txt,12.10 KB, text/plain)
2021-04-18 17:34 UTC, Ionen Wolkens
Details
emerge info (emerge_info.txt,5.29 KB, text/plain)
2021-04-19 23:44 UTC, Magnus Granberg
Details
build log of binutils 2.36.1 (binutils-2.36.1:20210420-011750.log.gz,88.35 KB, application/gzip)
2021-04-20 01:58 UTC, Magnus Granberg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas K. Hüttel archtester gentoo-dev 2021-04-18 13:04:12 UTC
sys-devel/binutils-2.36.1 links to system binutils-libs, breaks on uninstall of binutils-libs-2.35.2

placeholder bug pending further investigation
Comment 1 Magnus Granberg gentoo-dev 2021-04-18 13:08:47 UTC
Created attachment 700542 [details]
build log of binutils 2.36.1

log from the buildbot tinderbox first build.
Comment 2 Andreas K. Hüttel archtester gentoo-dev 2021-04-18 16:19:03 UTC
if you have this problem, please add the output of "scanelf -n /usr/bin/ld"
Comment 3 Andreas K. Hüttel archtester gentoo-dev 2021-04-18 16:44:42 UTC
(In reply to Andreas K. Hüttel from comment #2)
> if you have this problem, please add the output of "scanelf -n /usr/bin/ld"

also, what would be interesting is the recent emerge history (which packages were installed / updated in which order), see /var/log/emerge.log or the output of genlop
Comment 4 Magnus Granberg gentoo-dev 2021-04-18 16:49:53 UTC
xps_gentoo /var/tmp/portage/sys-devel/binutils-2.36.1/image/usr/x86_64-pc-linux-gnu/binutils-bin/2.36.1 # scanelf -n ld
 TYPE   NEEDED FILE 
ET_DYN libbfd-2.36.1.gentoo-sys-devel-binutils-st.so,libctf.so.0,libdl.so.2,libc.so.6 ld
Comment 5 Andreas K. Hüttel archtester gentoo-dev 2021-04-18 17:27:00 UTC
(In reply to Andreas K. Hüttel from comment #3)
> (In reply to Andreas K. Hüttel from comment #2)
> > if you have this problem, please add the output of "scanelf -n /usr/bin/ld"
> 
> also, what would be interesting is the recent emerge history (which packages
> were installed / updated in which order), see /var/log/emerge.log or the
> output of genlop

and, do you have binutils-libs installed?
Comment 6 Ionen Wolkens gentoo-dev 2021-04-18 17:34:55 UTC
Created attachment 700584 [details]
world upgrade leading to broken binutils.txt

Hm, I tried to upgrade binutils normally again and it was fine.

So I tried to revert to the state the system was before the last world upgrade, and this time it broke again (see attached file for roughly how that went).

I've also had this break on a headless server where binutils-libs wasn't installed (no cross-* either) but that's not my usual test env so I haven't tried again there.
Comment 7 Andreas K. Hüttel archtester gentoo-dev 2021-04-18 17:36:08 UTC
Confirmed as follows:

1. have uptodate ~amd64 with no binutils-libs
2 emerge 2.36.1
3. depclean (= remove 2.35.2)

And it's libctf that makes the trouble:

(gentoo libreoffice-amd64) ec2-xxx ~ # ld --version
ld: error while loading shared libraries: libbfd-2.35.2.gentoo-sys-devel-binutils-st.so: cannot open shared object file: No such file or directory
(gentoo libreoffice-amd64) ec2-xxx ~ # scanelf -n /usr/bin/ld
 TYPE   NEEDED FILE
ET_DYN libbfd-2.36.1.gentoo-sys-devel-binutils-st.so,libctf.so.0,libdl.so.2,libc.so.6 /usr/bin/ld
(gentoo libreoffice-amd64) ec2-xxx ~ # scanelf -n /usr/lib64/binutils/x86_64-pc-linux-gnu/2.36.1/libctf.so
 TYPE   NEEDED FILE
ET_DYN libbfd-2.35.2.gentoo-sys-devel-binutils-st.so,libz.so.1,libc.so.6 /usr/lib64/binutils/x86_64-pc-linux-gnu/2.36.1/libctf.so
Comment 8 Sergei Trofimovich (RETIRED) gentoo-dev 2021-04-19 07:29:20 UTC
I can't reproduce it on ~amd64. 2.35.2->2.36.1 and back works without problems with or without binutils-libs present. Do you have `emerge --info` output from affected system?

Looking at the build.log binutils should always bind to loca libctf and it's SONAME.
Comment 9 Sergei Trofimovich (RETIRED) gentoo-dev 2021-04-19 07:41:49 UTC
Also, where does the original " build log of binutils 2.36.1" come from? Why does it lack actual annotations of emerge phases and commands ran to build the ebuild? 

Mine has:

>>> Source configured.
>>> Compiling source in /tmp/portage-tmpdir/portage/sys-devel/binutils-2.36.1/work/binutils-2.36.1 ...
make --jobs=4 tooldir=/usr/x86_64-pc-linux-gnu all

But the log has nothing like that.
Comment 10 Magnus Granberg gentoo-dev 2021-04-19 23:44:41 UTC
Created attachment 700941 [details]
emerge info

Emerge info from the buildbot tinderbox
Comment 11 Magnus Granberg gentoo-dev 2021-04-20 01:54:21 UTC
xps_gentoo /var/lib/buildbot_worker # echo "=sys-devel/binutils-2.36.1" > /etc/portage/package.unmask/test
xps_gentoo /var/lib/buildbot_worker # emerge -av =binutils-2.36.1 --usepkg-exclude binutils               

These are the packages that would be merged, in order:

Calculating dependencies  ... done!
[ebuild  NS   #] sys-devel/binutils-2.36.1:2.36::gentoo [2.35.2:2.35::gentoo] USE="gold nls plugins (-cet) -default-gold -doc -multitarget -static-libs -test -vanilla" 0 KiB
[ebuild  rR    ] sys-devel/gcc-10.3.0:10::gentoo  USE="(cxx) fortran nls nptl openmp pch (pie) sanitize ssp (-ada) -d -debug -doc (-fixed-point) -go -graphite (-hardened) -jit (-libssp) -lto (-multilib) -objc -objc++ -objc-gc -pgo -systemtap -test -vanilla -vtv -zstd" 0 KiB
[ebuild  rR    ] sys-libs/glibc-2.33:2.2::gentoo  USE="caps (crypt) multiarch ssp (static-libs) -audit (-cet) -compile-locales -custom-cflags -doc -gd -headers-only (-multilib) -multilib-bootstrap -nscd -profile (-selinux) -static-pie -suid -systemtap -test (-vanilla)" 0 KiB

Total: 3 packages (1 in new slot, 2 reinstalls), Size of downloads: 0 KiB

Would you like to merge these packages? [Yes/No] y
>>> Verifying ebuild manifests
>>> Running pre-merge checks for sys-devel/gcc-10.3.0
>>> Running pre-merge checks for sys-libs/glibc-2.33
 * Checking general environment sanity.
make -j16 glibc-test CC=x86_64-pc-linux-gnu-gcc 
x86_64-pc-linux-gnu-gcc -O2 -pipe -march=native -fno-diagnostics-color   -Wl,-O1 -Wl,--as-needed  glibc-test.c   -o glibc-test
 * Checking gcc for __thread support ...
 [ ok ]
 * Checking running kernel version (5.3.7-gentoo >= 3.2.0) ...
 [ ok ]
 * Checking linux-headers version (5.11.0 >= 3.2.0) ...
 [ ok ]
>>> Emerging (1 of 3) sys-devel/binutils-2.36.1::gentoo
>>> Installing (1 of 3) sys-devel/binutils-2.36.1::gentoo
>>> Recording sys-devel/binutils:2.36 in "world" favorites file...
>>> Emerging (2 of 3) sys-devel/gcc-10.3.0::gentoo
>>> Installing (2 of 3) sys-devel/gcc-10.3.0::gentoo
>>> Emerging (3 of 3) sys-libs/glibc-2.33::gentoo
>>> Installing (3 of 3) sys-libs/glibc-2.33::gentoo
>>> Jobs: 3 of 3 complete                           Load avg: 8.65, 8.65, 8.13
>>> Auto-cleaning packages...

>>> No outdated packages were found on your system.

 * Regenerating GNU info directory index...
 * Processed 8 info files.
xps_gentoo /var/lib/buildbot_worker # ld --version
GNU ld (Gentoo 2.35.2 p1) 2.35.2
Copyright (C) 2020 Free Software Foundation, Inc.
Detta program är fri programvara; du kan sprida det vidare under villkoren
i GNU General Public License version 3 eller (om du så vill) senare version.
Detta program har inga som helst garantier.
xps_gentoo /var/lib/buildbot_worker # emerge -av --depclean
>>> Calculating removal order...

>>> These are the packages that would be unmerged:

 sys-devel/binutils
    selected: 2.35.2 
   protected: none 
     omitted: 2.36.1 

All selected packages: =sys-devel/binutils-2.35.2

>>> 'Selected' packages are slated for removal.
>>> 'Protected' and 'omitted' packages will not be removed.

Would you like to unmerge these packages? [Yes/No] y
>>> Unmerging (1 of 1) sys-devel/binutils-2.35.2...
Packages installed:   336
Packages in world:    8
Packages in system:   43
Required packages:    336
Number removed:       1

 * Regenerating GNU info directory index...
 * Processed 5 info files.
xps_gentoo /var/lib/buildbot_worker # ld --version
ld: error while loading shared libraries: libbfd-2.35.2.gentoo-sys-devel-binutils-st.so: cannot open shared object file: No such file or directory
xps_gentoo /var/lib/buildbot_worker #
Comment 12 Magnus Granberg gentoo-dev 2021-04-20 01:58:50 UTC
Created attachment 700947 [details]
build log of binutils 2.36.1

New build log of it
Comment 13 Sergei Trofimovich (RETIRED) gentoo-dev 2021-04-20 07:25:17 UTC
Aha, it depends on the ordering of linking and re-linking of libbfd and libctf.

Sometimes libctf gets relinked before libbfd is installed and pull in system's depend by accident.

Like in binutils-2.36.1:20210420-011750.log.gz:

bad order (ctf, then bfd):

 /bin/sh ./libtool   --mode=install /usr/lib/portage/python3.8/ebuild-helpers/xattr/install -c   libctf.la libctf-nobfd.la '/var/tmp/portage/sys-devel/binutils-2.36.1/image/usr/lib64/binutils/x86_64-pc-linux-gnu/2.36.1'
libtool: install: /usr/lib/portage/python3.8/ebuild-helpers/xattr/install -c .libs/libctf.lai /var/tmp/portage/sys-devel/binutils-2.36.1/image/usr/lib64/binutils/x86_64-pc-linux-gnu/2.36.1/libctf.la
 /bin/sh ./libtool   --mode=install /usr/lib/portage/python3.8/ebuild-helpers/xattr/install -c   libbfd.la '/var/tmp/portage/sys-devel/binutils-2.36.1/image/usr/lib64/binutils/x86_64-pc-linux-gnu/2.36.1'
libtool: install: /usr/lib/portage/python3.8/ebuild-helpers/xattr/install -c .libs/libbfd.lai /var/tmp/portage/sys-devel/binutils-2.36.1/image/usr/lib64/binutils/x86_64-pc-linux-gnu/2.36.1/libbfd.la

good order (bfd, then ctf):

 /bin/sh ./libtool   --mode=install /usr/lib/portage/python3.8/ebuild-helpers/xattr/install -c   libbfd.la '/var/tmp/portage/sys-devel/binutils-2.36.1/image/usr/lib64/binutils/x86_64-pc-linux-gnu/2.36.1'
libtool: install: /usr/lib/portage/python3.8/ebuild-helpers/xattr/install -c .libs/libbfd.lai /var/tmp/portage/sys-devel/binutils-2.36.1/image/usr/lib64/binutils/x86_64-pc-linux-gnu/2.36.1/libbfd.la
 /bin/sh ./libtool   --mode=install /usr/lib/portage/python3.8/ebuild-helpers/xattr/install -c   libctf.la libctf-nobfd.la '/var/tmp/portage/sys-devel/binutils-2.36.1/image/usr/lib64/binutils/x86_64-pc-linux-gnu/2.36.1'
libtool: install: /usr/lib/portage/python3.8/ebuild-helpers/xattr/install -c .libs/libctf.lai /var/tmp/portage/sys-devel/binutils-2.36.1/image/usr/lib64/binutils/x86_64-pc-linux-gnu/2.36.1/libctf.la

binutils has at least 2 relevant fixes since 2.36:

- https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=f04ce15e831b691d7610dba284e266919e757b10
- https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=755ba58ebef02e1be9fc6770d00243ba6ed0223c

2.36.1 release does not have those fixes.

As a workaround can you check if MAKEOPTS=-j1 builds valid result?
Comment 14 Larry the Git Cow gentoo-dev 2021-04-20 08:08:47 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3f6242408c1dc87441a96fcac14302ae14e02bef

commit 3f6242408c1dc87441a96fcac14302ae14e02bef
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2021-04-20 08:07:43 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2021-04-20 08:08:44 +0000

    sys-libs/binutils-libs: fix ctf/bfd relinking order
    
    Before the change libctf could install before libbfd
    into target location. That triggers libtool to link
    against system's libbfd.
    
    The change pulls in makefile depends to make sure
    libbfd gets installed first for libtool to always
    find a local copy.
    
    Reported-by: Andreas K. Hüttel
    Reported-by: Magnus Granberg
    Bug: https://bugs.gentoo.org/783777
    Package-Manager: Portage-3.0.18, Repoman-3.0.3
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 .../binutils-libs/binutils-libs-2.36.1-r1.ebuild   | 140 +++++++++++++++++++++
 .../files/binutils-libs-2.36.1-bfd-ctf.patch       |  68 ++++++++++
 .../files/binutils-libs-2.36.1-ld-ctf.patch        |  48 +++++++
 3 files changed, 256 insertions(+)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d9d78591e7d9774cc91e5ea7d4bdd5a8d6a59f90

commit d9d78591e7d9774cc91e5ea7d4bdd5a8d6a59f90
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2021-04-20 08:04:04 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2021-04-20 08:08:44 +0000

    sys-devel/binutils-hppa64: fix ctf/bfd relinking order
    
    Before the change libctf could install before libbfd
    into target location. That triggers libtool to link
    against system's libbfd.
    
    The change pulls in makefile depends to make sure
    libbfd gets installed first for libtool to always
    find a local copy.
    
    Reported-by: Andreas K. Hüttel
    Reported-by: Magnus Granberg
    Bug: https://bugs.gentoo.org/783777
    Package-Manager: Portage-3.0.18, Repoman-3.0.3
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 .../binutils-hppa64-2.36.1-r1.ebuild               | 445 +++++++++++++++++++++
 .../files/binutils-hppa64-2.35.1-cet.patch         | 103 +++++
 .../files/binutils-hppa64-2.36.1-bfd-ctf.patch     |  68 ++++
 .../files/binutils-hppa64-2.36.1-ld-ctf.patch      |  48 +++
 4 files changed, 664 insertions(+)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7dac8045b21d0f0539d929ef70c6905e0be6c16f

commit 7dac8045b21d0f0539d929ef70c6905e0be6c16f
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2021-04-20 08:00:45 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2021-04-20 08:08:44 +0000

    sys-devel/binutils: fix ctf/bfd relinking order
    
    Before the change libctf could install before libbfd
    into target location. That triggers libtool to link
    against system's libbfd.
    
    The change pulls in makefile depends to make sure
    libbfd gets installed first for libtool to always
    find a local copy.
    
    Reported-by: Andreas K. Hüttel
    Reported-by: Magnus Granberg
    Bug: https://bugs.gentoo.org/783777
    Package-Manager: Portage-3.0.18, Repoman-3.0.3
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 sys-devel/binutils/binutils-2.36.1-r1.ebuild       | 454 +++++++++++++++++++++
 .../binutils/files/binutils-2.36.1-bfd-ctf.patch   |  68 +++
 .../binutils/files/binutils-2.36.1-ld-ctf.patch    |  48 +++
 3 files changed, 570 insertions(+)
Comment 15 Sergei Trofimovich (RETIRED) gentoo-dev 2021-04-20 08:10:51 UTC
Please give =binutils-2.36.1-r1 a try. If it works I'll drop -r0 and unmack this version.

The caveat is that it's probably a parallel build issue. To test multiple times you might need to roll back to older binutils version and wipe out all the traces of new binutils.
Comment 16 Ionen Wolkens gentoo-dev 2021-04-20 13:15:36 UTC
Hm, there may still be something with binutils-libs?

The library is linked fine but wrt bug #784029 I still get (with binutils{,libs}-2.35.1 installed, but :2.36 selected):

ld: /usr/lib64/libctf.so.0: version `LIBCTF_1.1' not found (required by /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/../../../../x86_64-pc-linux-gnu/bin/ld)
collect2: error: ld returned 1 exit status

rebuilding binutils:2.36 while 2.36 is present doesn't seem to help

upgrading binutils-libs-2.35.1 to 2.36.1 fixes it, but why is ld using it? This looks normal:
libctf.so.0 => /usr/lib64/binutils/x86_64-pc-linux-gnu/2.36.1/libctf.so.0 (0x00007ffff7ce7000)
Comment 17 Larry the Git Cow gentoo-dev 2021-04-20 18:39:47 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b8d0e925d1c4f96079b2258668357a2765c63413

commit b8d0e925d1c4f96079b2258668357a2765c63413
Author:     Andreas K. Hüttel <dilfridge@gentoo.org>
AuthorDate: 2021-04-20 18:35:08 +0000
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: 2021-04-20 18:39:36 +0000

    package.mask: Drop binutils-2.36.1 mask, should be fixed in -r1
    
    Closes: https://bugs.gentoo.org/783777
    Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>

 profiles/package.mask | 7 -------
 1 file changed, 7 deletions(-)
Comment 18 Sergei Trofimovich (RETIRED) gentoo-dev 2021-04-22 07:38:09 UTC
(In reply to Ionen Wolkens from comment #16)
> Hm, there may still be something with binutils-libs?
> 
> The library is linked fine but wrt bug #784029 I still get (with
> binutils{,libs}-2.35.1 installed, but :2.36 selected):
> 
> ld: /usr/lib64/libctf.so.0: version `LIBCTF_1.1' not found (required by
> /usr/lib/gcc/x86_64-pc-linux-gnu/10.3.0/../../../../x86_64-pc-linux-gnu/bin/
> ld)
> collect2: error: ld returned 1 exit status
> 
> rebuilding binutils:2.36 while 2.36 is present doesn't seem to help
> 
> upgrading binutils-libs-2.35.1 to 2.36.1 fixes it, but why is ld using it?
> This looks normal:
> libctf.so.0 => /usr/lib64/binutils/x86_64-pc-linux-gnu/2.36.1/libctf.so.0
> (0x00007ffff7ce7000)

I suggest filing a separate bug. We install multiple versions of libctf.so.0 with te same SONAME. via binautils and via binutils-libs. If library versions don't match there always is a chance of wrong library to be loaded.

We need an equivalent of bug #666100 for libctf.so