litecoin-project / litecoin

Litecoin source tree
http://www.litecoin.org
MIT License
4.38k stars 3.03k forks source link

fix build dependencies (boost, qt) with gcc-11 #990

Open DeckerSU opened 2 weeks ago

DeckerSU commented 2 weeks ago

This PR fixes the build of dependencies (Boost, Qt) on modern Linux distributions (such as Ubuntu 22.04.5 LTS) with GCC 11.x installed. Without these fixes, attempting to build dependencies with GCC 11 using:

make -C ${PWD}/depends V=1 HOST=$(depends/config.guess) -j$(nproc --all)

will result in various errors. This PR introduces patches that are present in newer versions of Boost and Qt, resolving the issues with the GCC 11.x build.

Build errors and warnings:

  1. Error. Solved in ignore_wnonnull_gcc_11.patch:
    ./boost/concept/usage.hpp:16:48: warning: ‘this’ pointer is null [-Wnonnull]
    16 |     ~usage_requirements() { ((Model*)0)->~Model(); }
      |                             ~~~~~~~~~~~~~~~~~~~^~
    ./boost/concept/usage.hpp:30:7: note: in a call to non-static member function ‘boost::SinglePassRangeConcept<T>::~SinglePassRangeConcept() [with T = const boost::iterator_range<__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> > >]’
    30 |       ~model()
      |       ^
    ./boost/range/concepts.hpp:284:9: note: in expansion of macro ‘BOOST_CONCEPT_USAGE’
    284 |         BOOST_CONCEPT_USAGE(SinglePassRangeConcept)
      |         ^~~~~~~~~~~~~~~~~~~
    ...failed gcc.compile.c++ bin.v2/libs/thread/build/gcc-11.4.0/release/link-static/threadapi-pthread/threading-multi/visibility-hidden/pthread/thread.o...
  2. Error. Solved in commit-74fb0a2.patch:
    ./boost/thread/pthread/thread_data.hpp:60:5: error: missing binary operator before token "("
    60 | #if PTHREAD_STACK_MIN > 0
      |     ^~~~~~~~~~~~~~~~~
    ...failed gcc.compile.c++ bin.v2/libs/thread/build/gcc-11.4.0/release/link-static/threadapi-pthread/threading-multi/visibility-hidden/pthread/thread.o...
  3. Warning. Solved in commit-f9d0e59.patch:
    ./boost/thread/pthread/thread_data.hpp: In member function ‘void boost::thread_attributes::set_stack_size(std::size_t)’:
    ./boost/thread/pthread/thread_data.hpp:61:19: warning: comparison of integer expressions of different signedness: ‘std::size_t’ {aka ‘long unsigned int’} and ‘long int’ [-Wsign-compare]
    61 |           if (size<PTHREAD_STACK_MIN) size=PTHREAD_STACK_MIN;
      |                   ^
    RmTemps bin.v2/libs/thread/build/gcc-11.4.0/release/link-static/threadapi-pthread/threading-multi/visibility-hidden/libboost_thread-mt-x64.a(clean)
  4. Qt. Missed limits header - https://bugreports.qt.io/browse/QTBUG-90395 . Solved in fix_limits_header.patch.