FS#73240 - [erlang] Empty erl-interface library on 24.2-1 build

Attached to Project: Community Packages
Opened by Jill (KokaKiwi) - Monday, 03 January 2022, 11:05 GMT
Last edited by Alexander F. Rødseth (xyproto) - Wednesday, 23 February 2022, 10:27 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Alexander F. Rødseth (xyproto)
Architecture x86_64
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No


For some reason the package for erlang 24.2 (both erlang-24.2-1 and erlang-nox-24.2-1) contains empty build of the erl-library archives:

$ ll */usr/lib/erlang/lib/erl_interface-5.1/lib
74k libei.a
74k libei_st.a

74k libei.a
74k libei_st.a

Which results in build failing for some native erlang/elixir dependencies.

I haven't tried many mirrors but it seems to be

Additional info:
* package versions: erlang{,-nox}-24.2-1

Steps to reproduce:
Just install either community/erlang-24.2-1 or community/erlang-nox-24.2-1
This task depends upon

Closed by  Alexander F. Rødseth (xyproto)
Wednesday, 23 February 2022, 10:27 GMT
Reason for closing:  Fixed
Comment by Jill (KokaKiwi) - Monday, 03 January 2022, 11:06 GMT
Okay i can't edit the task main text but submit happened while i was typing so:

I haven't tried many mirrors but it seems to be the case for most of them
Comment by Alexander Tumin (iamtakingiteasy) - Tuesday, 11 January 2022, 23:03 GMT
Can confirm, empty static libraries from latest erlang package break building lexbor dependency of fast_html erlang package, dependency of source pleroma servers.

for 24.2-1

$ du -sb $(pacman -Ql erlang | awk '/libei/{print $2}')
74254 /usr/lib/erlang/lib/erl_interface-5.1/lib/libei.a
74254 /usr/lib/erlang/lib/erl_interface-5.1/lib/libei_st.a
74254 /usr/lib/erlang/usr/lib/libei.a
74254 /usr/lib/erlang/usr/lib/libei_st.a

At least 24.0.4-1 is not having this issue.
282530 /usr/lib/erlang/lib/erl_interface-5.0/lib/libei.a
278736 /usr/lib/erlang/lib/erl_interface-5.0/lib/libei_st.a
282530 /usr/lib/erlang/usr/lib/libei.a
278736 /usr/lib/erlang/usr/lib/libei_st.a
Comment by Serge A (saleyn) - Monday, 17 January 2022, 15:55 GMT
I believe this same or a similar issue with the Arch's erlang-24.2-1 package is illustrated here:


The objects in libei.a are reported to have LTO optimization, and they are not being found by the linker.
Note that the same problem is not found in pre-24.2-1 builds, and when the erlang is built locally from the same sources the issue doesn't show up.
Comment by Serge A (saleyn) - Tuesday, 18 January 2022, 14:11 GMT
This issue seems to be related to this modification of makepkg (https://lists.archlinux.org/pipermail/pacman-dev/2021-March/024911.html), which added mandatory stripping to makepkg.

As the result of stripping the produced `libei.a` archive containing object compiled with LTO don't seem to be linkable any more.
I tried to build the package without applying the strip to libei.a, and all symbols resolve successfully, so `strip` is the culprit here.

As it doesn't seem like `makepkg` has any option to exclude stripping of libraries, but it looks like this issue is getting resolved if setting CFLAGS="-ffat-lto-objects" in the configure command when building the erlang package, e.g.:

./configure CFLAGS="-mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -flto -ffat-lto-objects" LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now" AR=gcc-ar RANLIB=gcc-ranlib

It needs to be addressed by the package maintainer.
Comment by Alexander F. Rødseth (xyproto) - Monday, 21 February 2022, 13:56 GMT
Thanks for reporting, I'll look into it.
Comment by Alexander F. Rødseth (xyproto) - Monday, 21 February 2022, 13:59 GMT
erlang 24.2.1-1 appears to be in order:

286642 /usr/lib/erlang/lib/erl_interface-5.1/lib/libei.a

Can someone please confirm that this is no longer a problem?
Comment by Serge A (saleyn) - Monday, 21 February 2022, 14:09 GMT
The issue appears to be fixed.
Comment by Jill (KokaKiwi) - Monday, 21 February 2022, 14:55 GMT
Same for me, latest package build seems to be okay.
Comment by Alexander F. Rødseth (xyproto) - Wednesday, 23 February 2022, 10:27 GMT
Thanks for testing and for creating this ticket.