-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with LTO build of ei #5609
Comments
Hello! What versions have you tested? I see in the linked issue that you have tried 24.1 and that worked? From what git tells me, we have done zero changes in erl_interface between 24.1 and 24.2, so it seems odd that this is something that we have caused. Do you know what |
In the Arch package repository used to build the erlang distribution package we can find: The last link shows that Erlang was configured with:
but I don't see any special assignments to LDFLAGS and CXXFLAGS there aside from:
I cannot reproduce this when building locally in my environment from sources, and would think that it's a build issue that needs to be addressed by the maintainer of the Arch package. However, the user of my erlexec library reported the same issue with a macOS distribution, which makes me think that it could be something related to the version of the gcc compiler/linker which triggers the LTO issue. I tried downgrading the erlang package to 24.1.7 using:
and this doesn't exhibit the libei.a linking issue.
I also added a comment to the maintainer of the Arch's erlang package: https://bugs.archlinux.org/task/73240, which highlights a strange change in the size of the libei.a: Package version 24.2:
Package version 24.1.7:
|
I did some digging and found this announcement and line 52 in that looks very much as what is happening to the nm output. So I tried to do
and then I get an archive that looks just like the |
It doesn't look like
If I try to run
|
I forgot to add that you probably need to have the lto flags to configure as well. From what I could understand they are:
|
When building with these flags, and running |
Can you reproduce the problem if you do not strip? Either way this to me is a problem in arch Linux and not with our build system. |
If I don't strip, the problem is not reproducible, but it is, when the |
Since it appears to be an issue in both Arch and macOS repositories, maybe the configure needs to strip Now that the cause of the problem is better understood, is there a way to link with the stripped |
The package maintainers have asked for For reference, this is the patch that applies the Do you know what configure flags were passed to the macOS build? Would be interesting to see how it manifests there and if the same
I don't know. |
This bug on macOS was reported by @Skoda091, who used |
FWIW, added a bug report to Arch's makepkg. Also adding
|
Aha, that makes sense. I didn't know about that option. |
The maintainer of the erlang Arch Linux package made this change, so all should be good with |
Describe the bug
ei_*
functions are reported as undefined by the linker when linking withlibei.a
.This issue appears in some builds of the 24.2 release (presently reproduced in Arch Linux and macOS), where
libei.a
is getting built with LTO optimization that results in undefinedei_*
symbols when linking with that library.An illustration of this error can be found here.
Notably, when the OTP 24.2 is compiled locally from sources, this doesn't happen, but when the pre-built package is installed from the distribution of Arch/macOS, and the project containing a port program that depends on
libei.a
is built, undefined symbols are reported.I believe it boils down to
libei.a
getting compiled with LTO, which is not something that happened in the releases prior to 24.2.$ nm /usr/lib/erlang/lib/erl_interface-5.1/lib/libei.a | grep -B2 -A10 ei_connect nm: ei_connect.o: plugin needed to handle lto object ei_connect.o: 0000000000000001 C __gnu_lto_slim ei_resolve.o: 0000000000000001 C __gnu_lto_slim eirecv.o: 0000000000000001 C __gnu_lto_slim send.o: 0000000000000001 C __gnu_lto_slim
Whereas a locally compiled 24.2 has a different output:
$ nm /opt/sw/erlang/24.2/lib/erlang/lib/erl_interface-5.1/lib/libei.a | grep ei_connect ei_connect.o: 0000000000003050 T ei_connect U ei_connect_ctx_t__ 0000000000000a40 t ei_connect_helper 0000000000003110 T ei_connect_host_port 0000000000003080 T ei_connect_host_port_tmo 0000000000002e00 T ei_connect_init 0000000000000018 b ei_connect_initialized 0000000000002a50 T ei_connect_init_ussi 0000000000002ef0 T ei_connect_tmo 0000000000002a30 T ei_connect_xinit 0000000000002480 T ei_connect_xinit_ussi U ei_connect_t__ 0000000000000910 T ei_connect_ctx_t__ 0000000000001360 T ei_connect_t__
The text was updated successfully, but these errors were encountered: