ttalvitie / browservice

Browservice: Browse the modern web on historical browsers
MIT License
1.13k stars 32 forks source link

Build Fails on Fedora 34 with gcc-11.2.1-1.fc34.x86_64 #52

Open ajacocks opened 3 years ago

ajacocks commented 3 years ago

When I try to build either -head or the current release, I first get this warning-forced-to-error:

src/download_manager.cpp:131:80: error: loop variable ‘p’ of type ‘const std::pair<unsigned int, browservice::DownloadManager::DownloadInfo>&’ binds to a temporary constructed from type ‘std::pair<const unsigned int, browservice::DownloadManager::DownloadInfo>’ [-Werror=range-loop-construct]
  131 | pair<uint32_t, browservice::DownloadManager::DownloadInfo>& p : infos_) {
      |                                                             ^

src/download_manager.cpp:131:80: note: use non-reference type ‘const std::pair<unsigned int, browservice::DownloadManager::DownloadInfo>’ to make the copy explicit or ‘const std::pair<const unsigned int, browservice::DownloadManager::DownloadInfo>&’ to prevent copying
src/download_manager.cpp: In member function ‘void browservice::DownloadManager::downloadProgressChanged_()’:
src/download_manager.cpp:201:80: error: loop variable ‘elem’ of type ‘const std::pair<unsigned int, browservice::DownloadManager::DownloadInfo>&’ binds to a temporary constructed from type ‘std::pair<const unsigned int, browservice::DownloadManager::DownloadInfo>’ [-Werror=range-loop-construct]
  201 | pair<uint32_t, browservice::DownloadManager::DownloadInfo>& elem : infos_) {
      |                                                             ^~~~

I can work around this by adding "-Wno-error=range-loop-construct" to CFLAGS_COMMON. However, this just gets me to a different set of errors:

In file included from /usr/include/c++/11/bits/move.h:57,
                 from /usr/include/c++/11/bits/stl_pair.h:59,
                 from /usr/include/c++/11/bits/stl_algobase.h:64,
                 from /usr/include/c++/11/memory:63,
                 from src/png.hpp:28,
                 from src/png.cpp:25:
/usr/include/c++/11/type_traits: In instantiation of ‘struct std::is_destructible<{anonymous}::Result>’:
/usr/include/c++/11/future:1065:21:   required from ‘class std::promise<{anonymous}::Result>’
src/png.cpp:133:26:   required from here
/usr/include/c++/11/type_traits:849:52: error: static assertion failed: template argument must be a complete class or an unbounded array
  849 |       static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~

There are a bunch of other "error: static assertion failed: template argument must be a complete class or an unbounded array" errors in png.cpp.

ttalvitie commented 3 years ago

Thank you for reporting. I was able to reproduce the issue on Fedora 35 and fixed the errors in master (commit 7bdc452d9a04a883ef2d4c688d73614fe13c6947). Could you verify that this fixes the issue in your Fedora 34 setup as well?