novacoin-project / novacoin

Novacoin sources tree
MIT License
114 stars 517 forks source link

Can't compile (linking error "plugin needed to handle lto object" in ixwebsocket and leveldb) #393

Open Ur-Quan opened 2 years ago

Ur-Quan commented 2 years ago

Hi. As subject says. Did git clone --recursive. Ubuntu 18.10, g++ 9. Here's trimmed output:

[ 29%] Linking CXX static library libixwebsocket.a /usr/bin/ar: CMakeFiles/ixwebsocket.dir/ixwebsocket/IXBench.cpp.o: plugin needed to handle lto object ...... /usr/bin/ar: CMakeFiles/ixwebsocket.dir/ixwebsocket/IXWebSocketTransport.cpp.o: plugin needed to handle lto object /usr/bin/ranlib: libixwebsocket.a(IXBench.cpp.o): plugin needed to handle lto object ...... /usr/bin/ranlib: libixwebsocket.a(IXWebSocketTransport.cpp.o): plugin needed to handle lto object [ 29%] Built target ixwebsocket ...... [ 61%] Linking CXX static library libleveldb.a /usr/bin/ar: CMakeFiles/leveldb.dir/db/builder.cc.o: plugin needed to handle lto object ...... /usr/bin/ar: CMakeFiles/leveldb.dir/helpers/memenv/memenv.cc.o: plugin needed to handle lto object /usr/bin/ranlib: libleveldb.a(builder.cc.o): plugin needed to handle lto object ...... /usr/bin/ranlib: libleveldb.a(memenv.cc.o): plugin needed to handle lto object [ 61%] Built target leveldb ...... [ 99%] Linking CXX executable novacoind /tmp/novacoind.KiPcMa.ltrans0.ltrans.o: In functionstd::_Rb_tree_iterator<std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, std::cxx11::basic_string<char, std::char_traits, std::allocator > > > std::_Rb_tree<std::cxx11::basic_string<char, std::char_traits, std::allocator >, std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, std::_Select1st<std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, std::cxx11::basic_string<char, std::char_traits, std::allocator > > >, ix::CaseInsensitiveLess, std::allocator<std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, std::cxx11::basic_string<char, std::char_traits, std::allocator > > > >::_M_emplace_hint_unique<std::piecewise_construct_t const&, std::tuple<std::cxx11::basic_string<char, std::char_traits, std::allocator >&&>, std::tuple<> >(std::_Rb_tree_const_iterator<std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, std::cxx11::basic_string<char, std::char_traits, std::allocator > > >, std::piecewise_construct_t const&, std::tuple<std::cxx11::basic_string<char, std::char_traits, std::allocator >&&>&&, std::tuple<>&&) [clone .constprop.0]':

:(.text+0x522c): undefined reference to `ix::CaseInsensitiveLess::operator()(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&) const' :(.text+0x5254): undefined reference to `ix::CaseInsensitiveLess::operator()(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&) const' :(.text+0x52e6): undefined reference to `ix::CaseInsensitiveLess::operator()(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&) const' :(.text+0x531c): undefined reference to `ix::CaseInsensitiveLess::operator()(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&) const' :(.text+0x535c): undefined reference to `ix::CaseInsensitiveLess::operator()(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&) const' /tmp/novacoind.KiPcMa.ltrans0.ltrans.o::(.text+0x53cc): more undefined references to `ix::CaseInsensitiveLess::operator()(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&) const' follow /tmp/novacoind.KiPcMa.ltrans0.ltrans.o: In function `_sub_I_65535_0.261768': :(.text.startup+0x19e8): undefined reference to `DbEnv::DbEnv(unsigned int)' /tmp/novacoind.KiPcMa.ltrans1.ltrans.o: In function `CTxDB::WriteVersion(int) [clone .constprop.0]': :(.text+0x7681): undefined reference to `leveldb::WriteBatch::Put(leveldb::Slice const&, leveldb::Slice const&)' :(.text+0x7819): undefined reference to `leveldb::Status::ToString[abi:cxx11]() const' /tmp/novacoind.KiPcMa.ltrans1.ltrans.o: In function `bool CDB::Write, std::allocator >, CPubKey>, CKeyMetadata>(std::pair, std::allocator >, CPubKey> const&, CKeyMetadata const&, bool) [clone .constprop.0]': :(.text+0x79a0): undefined reference to `Dbt::Dbt(void*, unsigned int)' :(.text+0x7a21): undefined reference to `Dbt::Dbt(void*, unsigned int)' :(.text+0x7a71): undefined reference to `Dbt::~Dbt()' :(.text+0x7a9b): undefined reference to `Dbt::~Dbt()' /tmp/novacoind.KiPcMa.ltrans1.ltrans.o: In function `bool CDB::Write, std::allocator >, int>(std::__cxx11::basic_string, std::allocator > const&, int const&, bool) [clone .constprop.0]': :(.text+0x7be5): undefined reference to `Dbt::Dbt(void*, unsigned int)' :(.text+0x7c41): undefined reference to `Dbt::Dbt(void*, unsigned int)' :(.text+0x7c90): undefined reference to `Dbt::~Dbt()' :(.text+0x7cba): undefined reference to `Dbt::~Dbt()' /tmp/novacoind.KiPcMa.ltrans1.ltrans.o: In function `CDBEnv::Open(boost::filesystem::path) [clone .constprop.0]': :(.text+0x7f14): undefined reference to `DbEnv::set_lg_dir(char const*)' :(.text+0x7f4f): undefined reference to `DbEnv::set_cachesize(unsigned int, unsigned int, int)' :(.text+0x7f60): undefined reference to `DbEnv::set_lg_bsize(unsigned int)' :(.text+0x7f71): undefined reference to `DbEnv::set_lg_max(unsigned int)' :(.text+0x7f82): undefined reference to `DbEnv::set_lk_max_locks(unsigned int)' :(.text+0x7f93): undefined reference to `DbEnv::set_lk_max_objects(unsigned int)' :(.text+0x7fb3): undefined reference to `DbEnv::set_errfile(_IO_FILE*)' :(.text+0x7fc9): undefined reference to `DbEnv::set_flags(unsigned int, int)' :(.text+0x7fdf): undefined reference to `DbEnv::set_flags(unsigned int, int)' :(.text+0x7ff5): undefined reference to `DbEnv::log_set_config(unsigned int, int)' :(.text+0x8010): undefined reference to `DbEnv::open(char const*, unsigned int, int)' :(.text+0x8073): undefined reference to `DbEnv::strerror(int)'.. ...... :(.text+0x7230): undefined reference to `ix::HttpClient::~HttpClient()' /tmp/novacoind.KiPcMa.ltrans37.ltrans.o: In function `std::unique_ptr >::~unique_ptr()': :(.text+0x51e1): undefined reference to `ix::HttpServer::~HttpServer()' /tmp/novacoind.KiPcMa.ltrans37.ltrans.o: In function `CommandLineRPC(int, char**) [clone .cold]': :(.text.unlikely+0x1b31): undefined reference to `ix::HttpClient::~HttpClient()' collect2: error: ld returned 1 exit status CMakeFiles/novacoind.dir/build.make:900: recipe for target 'novacoind' failed make[2]: *** [novacoind] Error 1 CMakeFiles/Makefile2:120: recipe for target 'CMakeFiles/novacoind.dir/all' failed make[1]: *** [CMakeFiles/novacoind.dir/all] Error 2 Makefile:135: recipe for target 'all' failed make: *** [all] Error 2 `
CryptoManiac commented 1 year ago

Hi. It is probably caused by a change of compiler defaults in g++, looks like it is using slim objects instead of fat. I believe that addition of -ffat-lto-objects option to CXXFLAGS and CFLAGS will resolve this issue.