FS#69861 - [avr-binutils] avr-ld depends on nonexistent libctf.so.0 shared library

Attached to Project: Community Packages
Opened by Sergey Vlasov (sigprof) - Tuesday, 02 March 2021, 21:21 GMT
Last edited by Anatol Pomozov (anatolik) - Tuesday, 09 March 2021, 05:58 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Jakob Gruber (schuay)
Anatol Pomozov (anatolik)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description: avr-binutils-2.36.1-1-x86_64 contains binaries linked with libctf.so.0, which does not actually exist

Additional info:
binutils 2.36.1-2
avr-binutils 2.36.1-1

Steps to reproduce:
$ avr-ld --version
avr-ld: error while loading shared libraries: libctf.so.0: cannot open shared object file: No such file or directory

Apparently libctf.so.0 is built during the avr-binutils package build, but in package() the library is removed and not included into the binary package, with the intent that the binutils package would provide that shared library instead. However, since version 2.36.1 the binutils package does not contain that shared library, therefore executables like avr-ld, avr-objdump, ..., which are linked with that library, cannot be run.

Looks like this problem can be fixed in the avr-binutils package by removing the --enable-shared option from the configure arguments, and then removing "rm -r "${pkgdir}"/usr/lib/libctf*" and "rm -r "${pkgdir}"/usr/include/{ctf.h,ctf-api.h}" commands from the end of package() (these files are not installed when --enable-shared is not used, and "rm -r" fails when asked to remove a file which does not actually exist).

This problem was initially reported as a bug in the binutils package (https://bugs.archlinux.org/task/69567), but apparently the decision to remove libctf.so.0 from that package has been made and will not be reversed, therefore the problem should be fixed in the avr-binutils package.
This task depends upon

Closed by  Anatol Pomozov (anatolik)
Tuesday, 09 March 2021, 05:58 GMT
Reason for closing:  Fixed
Additional comments about closing:  2.36.1-2
Comment by Anatol Pomozov (anatolik) - Tuesday, 02 March 2021, 23:05 GMT
The request sounds reasonable to me.

What is going to be consequence of removing `--enable-shared`? My understanding that bare-metal AVR cannot use shared ELF libs and there is point of having *.so but I might miss something.
Comment by Anatol Pomozov (anatolik) - Tuesday, 02 March 2021, 23:20 GMT
I am talking about these libs:

usr/x86_64-pc-linux-gnu/avr/lib/ <
usr/x86_64-pc-linux-gnu/avr/lib/libbfd-2.36.1.so <
usr/x86_64-pc-linux-gnu/avr/lib/libbfd.so <
usr/x86_64-pc-linux-gnu/avr/lib/libopcodes-2.36.1.so <
usr/x86_64-pc-linux-gnu/avr/lib/libopcodes.so
Comment by Sergey Vlasov (sigprof) - Wednesday, 03 March 2021, 07:38 GMT
Probably nothing else except the binaries in the avr-binutils package itself uses these shared libraries (they are not even in the standard shared library search path), so the only consequence is that the binary package will become several megabytes larger. The main binutils package is also built that way now (https://github.com/archlinux/svntogit-packages/commit/0a43b430d838431c2ac59b49a45202584171eb53), and https://bugs.archlinux.org/task/69567 also mentioned that building with shared libraries also conflicts with some security-related linker options, so it seems that the only correct solution is to avoid building and using those shared libraries.

And the old way to build avr-binutils (build libctf.so.0 from avr-binutils sources, then remove the built file and hope that a shared library with the same name provided by binutils would be ABI-compatible) does not even look reliable (well, it could work if the versions of binutils and avr-binutils are exactly the same, and the difference in configure options does not affect the ABI, but it does not really match the normal way to use shared libraries).
Comment by Anatol Pomozov (anatolik) - Wednesday, 03 March 2021, 17:28 GMT
@Sergey sounds reasonable to me. I just pushed an update for avr-binutils, PTAL and let me know if you see any issues with it.
Comment by Sergey Vlasov (sigprof) - Tuesday, 09 March 2021, 05:54 GMT
The latest release works for me now.

Loading...