FS#74092 - [libnsbmp] 0.1.6-3 cannot be linked against

Attached to Project: Community Packages
Opened by Peter F (peterfab9845) - Friday, 11 March 2022, 06:24 GMT
Last edited by Alexander F. Rødseth (xyproto) - Monday, 14 March 2022, 10:03 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Alexander F. Rødseth (xyproto)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
As of libnsbmp-0.1.6-3, the library archive /usr/lib/libnsbmp.a does not contain any of the library code, causing linking to fail when attempting to use the library.
Using objdump on src_libnsbmp.o, contained in this archive, the symbol table only contains one item (__gnu_lto_slim), and the .text section is zero bytes.

Additional info:
* package version(s):
libnsbmp 0.1.6-3

* config and/or log files etc.
Symbol table of src_libnsbmp.o in version 0.1.6-3:

src_libnsbmp-3.o: file format elf64-x86-64

SYMBOL TABLE:
0000000000000001 O *COM* 0000000000000001 __gnu_lto_slim

There should be several symbols such as bmp_create, bmp_analyse, and bmp_decode.

* link to upstream bug report, if any
N/A

Forum post showing an example of trying to link against the library:
https://bbs.archlinux.org/viewtopic.php?id=274155

Steps to reproduce:
$ ar x /usr/lib/libnsbmp.a
$ objdump -t src_libnsbmp.o
This task depends upon

Closed by  Alexander F. Rødseth (xyproto)
Monday, 14 March 2022, 10:03 GMT
Reason for closing:  Fixed
Comment by Allan McRae (Allan) - Friday, 11 March 2022, 08:28 GMT
Needs -ffat-lto-objects
Comment by loqs (loqs) - Friday, 11 March 2022, 23:09 GMT
CFLAGS+=' -ffat-lto-objects' is set in build but COMPONENT_TYPE=lib-shared is not passed to make in package so a static lib is built in package without -ffat-lto-objects as the variable was reset on changing functions.
The static library is installed instead of the shared library. Add COMPONENT_TYPE=lib-shared to the make call in package and the shared library is installed and a static library will not be built or packaged.
Comment by Alexander F. Rødseth (xyproto) - Monday, 14 March 2022, 00:23 GMT
Thanks for the suggestion, loqs.

Even with both -ffat-lto-objects and COMPONENT_TYPE=lib-shared, no .a file is packaged here.

Here's the WIP PKGBUILD: http://ix.io/3Sab
Comment by Alexander F. Rødseth (xyproto) - Monday, 14 March 2022, 00:33 GMT
Removing COMPONENT_TYPE=lib-shared + adding options=(staticlibs) make the .a file contain symbols again. -ffat-lto-objects is set. Please confirm that it's now working as expected.
Comment by loqs (loqs) - Monday, 14 March 2022, 00:44 GMT
Removing COMPONENT_TYPE=lib ? It is still used in build() its location was just moved. Why add options=(staticlibs)? When a shared lib is not shipped it has no effect.
Is there a reason this package can not supply a shared library?
Edit:
See shared.diff and static.diff
Comment by Alexander F. Rødseth (xyproto) - Monday, 14 March 2022, 09:57 GMT
Thank you loqs.

Without options=(staticlibs), the .a file is not included. I thought netsurf might need the static library when building, but I'll double check.
Comment by Alexander F. Rødseth (xyproto) - Monday, 14 March 2022, 10:03 GMT
The libnsbmp package now only includes the .so file, and the steps to reproduce from the forum post now works (#include <libnsbmp.h>, then bmp_decode(NULL)).

Loading...