magma
magma copied to clipboard
PHP build failure in aflplusplus-lto
We cannot build PHP targets by the setting of aflplusplus_lto.
ld.lld: error: undefined symbol: std::__throw_length_error(char const*)
>>> referenced by stl_vector.h:1505 (/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/stl_vector.h:1505)
>>> lto.tmp:(std::vector<icu_60::UnicodeString, std::allocator<icu_60::UnicodeString> >::_M_check_len(unsigned long, char const*) const)
>>> referenced by stl_vector.h:1505 (/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/stl_vector.h:1505)
>>> lto.tmp:(std::vector<icu_60::Formattable, std::allocator<icu_60::Formattable> >::_M_check_len(unsigned long, char const*) const)
It seems to be related to this issue. And in fact, as indicated in that issue, when we disable `intl', the build succeeds.
Though I'm not sure what is the root cause of this, we confirmed that we can successfully build it without LTO (aflplusplus). Therefore, LTO is doing something bad.
Hmmm I'm not sure what the relation is with that issue. I have seen a similar C++ error before, and from memory it seemed to relate to a mix of standard libraries (libc++ vs libstdc++).
If I have some time, I'll have a dig and see what I can find.
Thanks for raising the issue!
@moratorium08 I think the problem is with older versions of LLD which do not support IFUNC.
PHP compiles fine with LTO and LLVM 16. Just be aware that it's memory hungry and can go OOM with -j$(nproc).