<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">I am using Arch Linux and have the latest OTP 24.2 installed. When trying to build a project that depends on libei.a I am getting undefined references of "ei_*" functions. This doesn't happen when I download and build erlang OTP from sources. Investigating this issue shows that the 24.2 Erlang/OTP package included in Arch distribution has libei.a built with LTO</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><font size="1"><span style="font-family:monospace;color:rgb(24,178,24);background-color:rgb(255,255,255)">$</span><span style="font-family:monospace;color:rgb(0,0,0);background-color:rgb(255,255,255)"> nm /usr/lib/erlang/lib/erl_interface-5.1/lib/libei.a | head -10</span></font></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:monospace"><font size="1">/usr/bin/nm: ei_connect.o: plugin needed to handle lto object
</font></span></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:monospace"><font size="1"><br></font></span></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:monospace"><font size="1">ei_connect.o:
</font></span></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:monospace"><font size="1">0000000000000001 C __gnu_lto_slim
</font></span></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:monospace"><font size="1"><br></font></span></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:monospace"><font size="1">ei_resolve.o:
</font></span></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:monospace"><font size="1">0000000000000001 C __gnu_lto_slim
</font></span></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:monospace"><font size="1"><br></font></span></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:monospace"><font size="1">eirecv.o:
</font></span></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:monospace"><font size="1">0000000000000001 C __gnu_lto_slim
</font></span></div></blockquote><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:monospace"></span><span style="font-family:monospace">
</span><span style="font-family:monospace"><br></span><div class="gmail_default" style="font-size:small">whereas the manually built one doesn't seem to use LTO:</div><div class="gmail_default" style="font-size:small"><br></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:monospace"><font size="1"><span style="color:rgb(24,178,24);background-color:rgb(255,255,255)">$</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)"> nm /opt/sw/erlang/24.2/lib/erlang/lib/erl_interface-5.1/lib/libei.a | head -10 </span></font></span></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:monospace"><font size="1"><br></font></span></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:monospace"><font size="1">ei_connect.o:
</font></span></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:monospace"><font size="1"> U clock
</font></span></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:monospace"><font size="1"> U close
</font></span></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:monospace"><font size="1"> U __ctype_b_loc
</font></span></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:monospace"><font size="1">0000000000000140 t dyn_gethostbyname_r
</font></span></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:monospace"><font size="1">00000000000048f0 T ei_accept
</font></span></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:monospace"><font size="1"> U ei_accept_ctx_t__
</font></span></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:monospace"><font size="1">0000000000003560 T ei_accept_tmo
</font></span></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:monospace"><font size="1">0000000000003430 T ei_close_connection</font></span></div></blockquote><font face="monospace" size="1"><div><font face="monospace" size="1"><br></font></div>W<span class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">hat's the correct linking options when building projects using libei.a in OTP 24.2? Adding "</span></font><span class="gmail_default" style="color:rgb(255,246,223);font-family:arial,helvetica,sans-serif"></span><span style="color:rgb(255,246,223);font-family:monospace;font-size:x-small">-flto</span><font face="monospace" size="1"><span class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">" flag doesn't seem to help:</span></font><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:monospace"></span></div><div><font face="monospace" size="1"><span class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></span></font></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><span style="font-family:monospace"><font size="1"><span style="color:rgb(24,178,24);background-color:rgb(255,255,255)">$</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)"> g++ <span class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"></span></span></font></span><span style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:monospace">-flto<span class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"> </span></span><span style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-size:x-small;font-family:monospace">c_src/ei++.o c_src/exec.o c_src/exec_impl.o -lcap -L"/usr/lib/erlang/lib/erl_interface-5.1/l</span></div><div><span style="font-family:monospace"><font size="1">ib" -lei -o /home/serge/projects/erl-libs/erlexec/priv/x86_64-pc-linux-gnu/exec-port
</font></span></div><div><span style="font-family:monospace"><font size="1">/usr/bin/ld: /usr/bin/ld: DWARF error: could not find abbrev number 14880
</font></span></div><div><span style="font-family:monospace"><font size="1">/tmp/ccAxA3JA.ltrans0.ltrans.o: in function `ei::Serializer::decodeAtom(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<c</font></span></div><div><span style="font-family:monospace"><font size="1">har> >&) [clone .constprop.0]':
</font></span></div><div><span style="font-family:monospace"><font size="1"><artificial>:(.text+0x24c): undefined reference to `ei_decode_atom'
</font></span></div><div><span style="font-family:monospace"><font size="1">/usr/bin/ld: /tmp/ccAxA3JA.ltrans0.ltrans.o: in function `ei::Serializer::decodeString(std::__cxx11::basic_string<char, std::char_traits<char>, s</font></span></div><div><span style="font-family:monospace"><font size="1">td::allocator<char> >&) [clone .constprop.0]':
</font></span></div><div><span style="font-family:monospace"><font size="1"><artificial>:(.text+0x83f): undefined reference to `ei_get_type'
</font></span></div><div><span style="font-family:monospace"><font size="1">/usr/bin/ld: <artificial>:(.text+0x903): undefined reference to `ei_decode_string'
</font></span></div><div><span style="font-family:monospace"><font size="1">/usr/bin/ld: /tmp/ccAxA3JA.ltrans0.ltrans.o: in function `ei::Serializer::decodeStringOrBinary(std::__cxx11::basic_string<char, std::char_traits<</font></span></div><div><span style="font-family:monospace"><font size="1">char>, std::allocator<char> >&) [clone .constprop.0]':
</font></span></div><div><span style="font-family:monospace"><font size="1"><artificial>:(.text+0xa4e): undefined reference to `ei_get_type'
</font></span></div><div><span style="font-family:monospace"><font size="1">/usr/bin/ld: <artificial>:(.text+0xa84): undefined reference to `ei_decode_binary'
</font></span></div><div><span style="font-family:monospace"><font size="1">/usr/bin/ld: /tmp/ccAxA3JA.ltrans0.ltrans.o: in function `ei::CmdOptions::ei_decode(bool)':
</font></span></div><div><span style="font-family:monospace"><font size="1"><artificial>:(.text+0x3754): undefined reference to `ei_decode_list_header'
</font></span></div><div><span style="font-family:monospace"><font size="1">/usr/bin/ld: <artificial>:(.text+0x38fa): undefined reference to `ei_get_type'
</font></span></div><div><span style="font-family:monospace"><font size="1">/usr/bin/ld: <artificial>:(.text+0x3937): undefined reference to `ei_decode_tuple_header'
</font></span></div><div><span style="font-family:monospace"><font size="1">/usr/bin/ld: <artificial>:(.text+0x397f): undefined reference to `ei_decode_atom'
</font></span></div><div><span style="font-family:monospace"><font size="1">/usr/bin/ld: <artificial>:(.text+0x3b42): undefined reference to `ei_decode_atom'</font></span></div><div><span style="font-family:monospace"><font size="1"><span class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">...</span><br></font></span></div><div><span style="font-family:monospace"><font size="1"><br></font></span></div></blockquote><font face="monospace" size="1"><span class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Regards,</span></font><div><font face="monospace" size="1"><span class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></span></font></div><div><font face="monospace" size="1"><span class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Serge</span><br></font></div></div>