FS#69619 - bmake default lib${LIB}.${LD_so} target causes broken ld options

Attached to Project: Community Packages
Opened by Joel Shapiro (jshap70) - Thursday, 11 February 2021, 17:11 GMT
Last edited by Ivy Foster (escondida) - Thursday, 03 March 2022, 00:24 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Ivy Foster (escondida)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
I maintain `aur/libnvidia-container`, which through a weird series of turns ends up building libelf as a shared lib from source 🙄.

In libelf's makefile (which is bmake only), `mk/elftoolchain.lib.mk` has a call to set `LIB = elf` and then calls `.include <bsd.lib.mk>`, which is located at `/usr/share/mk/bsd.lib.mk`.

Because of the build environment this leads to the file on 173 setting `LD_shared=-shared -Wl,"-soname lib${LIB}.so.${SHLIB_MAJOR}"`, which then is used by the generic `lib${LIB}.${LD_so}` target on line 448 to set the actual command to execute to `${SHLIB_LD} -o ${.TARGET} ${LD_shared} ${LD_solib} ${DLLIB} ${SHLIB_LDADD}`, which in this case is equal to `cc -pipe -o libelf.so.1 -shared '-Wl,-soname libelf.so.1' -Wl,--whole-archive libelf_pic.a -Wl,--no-whole-archive`.

Which exits with `/usr/bin/ld: Error: unable to disambiguate: -soname libelf.so.1 (did you mean --soname libelf.so.1 ?)`

This command fails due to the '-Wl,-soname libelf.so.1' linker option because for some reason recently ld has stopped taking the `-soname` flag when it has a space following it.

Additional info:
* package version(s)
```
> pacman -Qo bmake ld
/usr/bin/bmake is owned by bmake 20200902-1
/usr/bin/ld is owned by binutils 2.36-3
```

* config and/or log files etc.
* link to upstream bug report, if any

Steps to reproduce:
build libelf from source
1. download https://sourceforge.net/projects/elftoolchain/files/Sources/elftoolchain-0.7.1/elftoolchain-0.7.1.tar.bz2
2. enter and use `bmake`
This task depends upon

Closed by  Ivy Foster (escondida)
Thursday, 03 March 2022, 00:24 GMT
Reason for closing:  Upstream
Additional comments about closing:  If this problem still exists in the current version, it ought to be reported upstream.
Comment by Joel Shapiro (jshap70) - Thursday, 11 February 2021, 17:50 GMT
"ld has stopped taking the `-soname` flag when it has a space following it"

meaning the option needs to be given with an equals sign like `-soname=libelf.so.1`

Loading...