gui: Building with gcc 9 prints a trillion warnings (-Wdeprecated-copy) #15822

issue MarcoFalke opened this issue on April 15, 2019
  1. MarcoFalke commented at 7:03 PM on April 15, 2019: member

    Some of them are legitimate, but others are in upstream library headers from qt (5.12.1-1.fc30)

    The version of gcc I was using:

    $ gcc --version
    gcc (GCC) 9.0.1 20190312 (Red Hat 9.0.1-0.10)
    Copyright (C) 2019 Free Software Foundation, Inc.
    

    There has been a recent fixup (https://github.com/gcc-mirror/gcc/commit/482bd38ed8984aad9b1560405e7b3d775c194ccd). The date suggests that this was fixed in the version of gcc I was using, but the warnings are still printed.

    Some example warnings:

    /usr/include/qt5/QtWidgets/qstyleoption.h: In member function ‘QStyleOptionGroupBox& QStyleOptionGroupBox::operator=(const QStyleOptionGroupBox&)’:
    /usr/include/qt5/QtWidgets/qstyleoption.h:626:24: warning: implicitly-declared ‘QStyleOptionComplex& QStyleOptionComplex::operator=(const QStyleOptionComplex&)’ is deprecated [-Wdeprecated-copy]
      626 | class Q_WIDGETS_EXPORT QStyleOptionGroupBox : public QStyleOptionComplex
          |                        ^~~~~~~~~~~~~~~~~~~~
    /usr/include/qt5/QtWidgets/qstyleoption.h:510:5: note: because ‘QStyleOptionComplex’ has user-provided ‘QStyleOptionComplex::QStyleOptionComplex(const QStyleOptionComplex&)’
      510 |     QStyleOptionComplex(const QStyleOptionComplex &other) : QStyleOption(Version, Type) { *this = other; }
          |     ^~~~~~~~~~~~~~~~~~~
    /usr/include/qt5/QtWidgets/qstyleoption.h: In copy constructor ‘QStyleOptionGroupBox::QStyleOptionGroupBox(const QStyleOptionGroupBox&)’:
    /usr/include/qt5/QtWidgets/qstyleoption.h:640:108: note: synthesized method ‘QStyleOptionGroupBox& QStyleOptionGroupBox::operator=(const QStyleOptionGroupBox&)’ first required here
      640 |     QStyleOptionGroupBox(const QStyleOptionGroupBox &other) : QStyleOptionComplex(Version, Type) { *this = other; }
          |                                                                                                            ^~~~~
    /usr/include/qt5/QtWidgets/qstyleoption.h: In copy constructor ‘QStyleOptionSizeGrip::QStyleOptionSizeGrip(const QStyleOptionSizeGrip&)’:
    /usr/include/qt5/QtWidgets/qstyleoption.h:654:108: warning: implicitly-declared ‘QStyleOptionSizeGrip& QStyleOptionSizeGrip::operator=(const QStyleOptionSizeGrip&)’ is deprecated [-Wdeprecated-copy]
      654 |     QStyleOptionSizeGrip(const QStyleOptionSizeGrip &other) : QStyleOptionComplex(Version, Type) { *this = other; }
          |                                                                                                            ^~~~~
    /usr/include/qt5/QtWidgets/qstyleoption.h:654:5: note: because ‘QStyleOptionSizeGrip’ has user-provided ‘QStyleOptionSizeGrip::QStyleOptionSizeGrip(const QStyleOptionSizeGrip&)’
      654 |     QStyleOptionSizeGrip(const QStyleOptionSizeGrip &other) : QStyleOptionComplex(Version, Type) { *this = other; }
          |     ^~~~~~~~~~~~~~~~~~~~
    /usr/include/qt5/QtWidgets/qstyleoption.h: In member function ‘QStyleOptionSizeGrip& QStyleOptionSizeGrip::operator=(const QStyleOptionSizeGrip&)’:
    /usr/include/qt5/QtWidgets/qstyleoption.h:645:24: warning: implicitly-declared ‘QStyleOptionComplex& QStyleOptionComplex::operator=(const QStyleOptionComplex&)’ is deprecated [-Wdeprecated-copy]
      645 | class Q_WIDGETS_EXPORT QStyleOptionSizeGrip : public QStyleOptionComplex
          |                        ^~~~~~~~~~~~~~~~~~~~
    ...
    
  2. MarcoFalke added the label Build system on Apr 15, 2019
  3. MarcoFalke added the label good first issue on Apr 15, 2019
  4. practicalswift commented at 2:01 PM on April 17, 2019: contributor

    FWIW: Warnings from gcc compiled from trunk --

    $ gcc (GCC) 9.0.1 20190417 (experimental)
    Copyright (C) 2019 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    $ make 2>&1 | grep "warning: " | grep -vE '(^/usr|leveldb)'
    interfaces/chain.cpp:263:25: warning: redundant move in return statement [-Wredundant-move]
    interfaces/wallet.cpp:251:25: warning: redundant move in return statement [-Wredundant-move]
    psbt.cpp:319:19: warning: implicitly-declared ‘PartiallySignedTransaction& PartiallySignedTransaction::operator=(const PartiallySignedTransaction&)’ is deprecated [-Wdeprecated-copy]
    psbt.cpp:341:1: warning: control reaches end of non-void function [-Wreturn-type]
    wallet/wallettool.cpp:62:25: warning: catching polymorphic type ‘const class std::runtime_error’ by value [-Wcatch-value=]
    
  5. MarcoFalke commented at 2:02 PM on April 17, 2019: member

    @practicalswift So, fedora has an old gcc-9, it seems. Albeit the version claims otherwise.

  6. MarcoFalke commented at 2:09 PM on April 17, 2019: member

    No, this can be reproduced on fedora:30 and debian:experimental

    Debian gcc version:

    # g++-9 --version
    g++-9 (Debian 9-20190402-1) 9.0.1 20190402 (experimental) [trunk revision 270074]
    Copyright (C) 2019 Free Software Foundation, Inc.
    

    <details><summary>Example build log</summary>

    # make -j 9 src/qt/bitcoin-qt
    make -C src qt/bitcoin-qt
    make[1]: Entering directory '/root/bitcoin/src'
    make[2]: Entering directory '/root/bitcoin'
    make[2]: Leaving directory '/root/bitcoin'
      CXX      qt/libbitcoinqt_a-moc_walletmodel.o
    In file included from /usr/include/x86_64-linux-gnu/qt5/QtGui/qevent.h:50,
                     from /usr/include/x86_64-linux-gnu/qt5/QtGui/QList:1,
                     from ./qt/paymentrequestplus.h:19,
                     from ./qt/walletmodel.h:18,
                     from qt/moc_walletmodel.cpp:8:
    /usr/include/x86_64-linux-gnu/qt5/QtCore/qvariant.h: In constructor 'QVariant::QVariant(QVariant&&)':
    /usr/include/x86_64-linux-gnu/qt5/QtCore/qvariant.h:273:25: warning: implicitly-declared 'QVariant::Private& QVariant::Private::operator=(const QVariant::Private&)' is deprecated [-Wdeprecated-copy]
      273 |     { other.d = Private(); }
          |                         ^
    /usr/include/x86_64-linux-gnu/qt5/QtCore/qvariant.h:399:16: note: because 'QVariant::Private' has user-provided 'QVariant::Private::Private(const QVariant::Private&)'
      399 |         inline Private(const Private &other) Q_DECL_NOTHROW
          |                ^~~~~~~
      AR       qt/libbitcoinqt.a
      CXXLD    qt/bitcoin-qt
    make[1]: Leaving directory '/root/bitcoin/src'
    

    </details>

  7. MarcoFalke commented at 2:15 PM on April 17, 2019: member

    @practicalswift Are you sure you are compiling the gui?

  8. MarcoFalke removed the label good first issue on Apr 17, 2019
  9. MarcoFalke added the label Upstream on Apr 17, 2019
  10. practicalswift commented at 3:07 PM on April 17, 2019: contributor

    @MarcoFalke Please note that I excluded warnings for /usr and leveldb to show only the project local warnings of which one is -Wdeprecated-copy:

    $ make 2>&1 | grep "warning: " | grep -vE '(^/usr|leveldb)'
    interfaces/chain.cpp:263:25: warning: redundant move in return statement [-Wredundant-move]
    interfaces/wallet.cpp:251:25: warning: redundant move in return statement [-Wredundant-move]
    psbt.cpp:319:19: warning: implicitly-declared ‘PartiallySignedTransaction& PartiallySignedTransaction::operator=(const PartiallySignedTransaction&)’ is deprecated [-Wdeprecated-copy]
    psbt.cpp:341:1: warning: control reaches end of non-void function [-Wreturn-type]
    wallet/wallettool.cpp:62:25: warning: catching polymorphic type ‘const class std::runtime_error’ by value [-Wcatch-value=]
    

    This is the result without the exclusion:

    $ make 2>&1 | grep "warning: " | head
    /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:34: warning: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ specified bound 12 equals destination size [-Wstringop-truncation]
    leveldb/util/logging.cc:58:40: warning: comparison of integer expressions of different signedness: ‘const int’ and ‘long unsigned int’ [-Wsign-compare]
    leveldb/port/port_posix.cc:60:15: warning: ‘ecx’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    /usr/include/x86_64-linux-gnu/qt5/QtCore/qvariant.h:265:25: warning: implicitly-declared ‘QVariant::Private& QVariant::Private::operator=(const QVariant::Private&)’ is deprecated [-Wdeprecated-copy]
    /usr/include/x86_64-linux-gnu/qt5/QtCore/qvariant.h:265:25: warning: implicitly-declared ‘QVariant::Private& QVariant::Private::operator=(const QVariant::Private&)’ is deprecated [-Wdeprecated-copy]
    /usr/include/x86_64-linux-gnu/qt5/QtCore/qvariant.h:265:25: warning: implicitly-declared ‘QVariant::Private& QVariant::Private::operator=(const QVariant::Private&)’ is deprecated [-Wdeprecated-copy]
    /usr/include/x86_64-linux-gnu/qt5/QtCore/qvariant.h:265:25: warning: implicitly-declared ‘QVariant::Private& QVariant::Private::operator=(const QVariant::Private&)’ is deprecated [-Wdeprecated-copy]
    /usr/include/x86_64-linux-gnu/qt5/QtWidgets/qstyleoption.h:120:103: warning: implicitly-declared ‘QStyleOptionFocusRect& QStyleOptionFocusRect::operator=(const QStyleOptionFocusRect&)’ is deprecated [-Wdeprecated-copy]
    /usr/include/x86_64-linux-gnu/qt5/QtWidgets/qstyleoption.h:144:95: warning: implicitly-declared ‘QStyleOptionFrame& QStyleOptionFrame::operator=(const QStyleOptionFrame&)’ is deprecated [-Wdeprecated-copy]
    /usr/include/x86_64-linux-gnu/qt5/QtWidgets/qstyleoption.h:173:49: warning: implicitly-declared ‘QStyleOptionTabWidgetFrame& QStyleOptionTabWidgetFrame::operator=(const QStyleOptionTabWidgetFrame&)’ is deprecated [-Wdeprecated-copy]
    
  11. MarcoFalke commented at 9:37 PM on May 10, 2019: member

    This will probably be fixed in qt 5.13

  12. MarcoFalke added the label GUI on May 14, 2019
  13. MarcoFalke commented at 1:28 PM on May 14, 2019: member
  14. MarcoFalke referenced this in commit 76e2cded47 on May 27, 2019
  15. MarcoFalke commented at 8:15 PM on May 28, 2019: member

    :clock1130: Target for Qt 5.13.0 Final is 13th June. Source: https://lists.qt-project.org/pipermail/releasing/2019-May/002649.html

  16. fanquake commented at 1:38 PM on June 3, 2019: member

    @MarcoFalke Do you want to move to a newer Qt in depends, or is this issue just to keep track of the warnings until 5.13 is released?

  17. MarcoFalke commented at 8:54 AM on June 5, 2019: member

    I think developers don't build from depends, usually, so there is no pressing need to bump it in depends.

  18. Sjors commented at 1:21 PM on July 11, 2019: member

    I get flooded by warnings along the lines of:

    ld: warning: direct access in function 'boost::system::detail::system_error_category::default_error_condition(int) const' from file '[...]/bitcoin/depends/x86_64-apple-darwin18.6.0/lib/libboost_filesystem-mt-x64.a(operations.o)' to global weak symbol 'guard variable for boost::system::generic_category()::generic_category_instance' from file 'libbitcoin_util.a(libbitcoin_util_a-time.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
    

    That's not just QT though, so maybe a different issue?

  19. MarcoFalke commented at 1:32 PM on September 30, 2019: member

    Apparently this is planned to be backported to 5.12: https://codereview.qt-project.org/c/qt/qtbase/+/272258

  20. hebasto commented at 1:43 PM on November 20, 2019: member

    Fedora 31, Qt 5.12.5 - the same...

  21. MarcoFalke commented at 7:43 PM on March 2, 2020: member

    This is an upstream issue. There is not much we can do here.

  22. MarcoFalke closed this on Mar 2, 2020

  23. fanquake referenced this in commit 6c647c89db on May 13, 2020
  24. sidhujag referenced this in commit 700181dce0 on May 14, 2020
  25. ComputerCraftr referenced this in commit f89a3d5ca9 on Jun 10, 2020
  26. furszy referenced this in commit f6b14ca9ef on Jan 21, 2021
  27. PastaPastaPasta referenced this in commit cf15c83b5e on Jun 27, 2021
  28. PastaPastaPasta referenced this in commit 1e0ea2bb58 on Jun 28, 2021
  29. PastaPastaPasta referenced this in commit 891a0f9099 on Jun 29, 2021
  30. PastaPastaPasta referenced this in commit 60ea1e2615 on Jul 1, 2021
  31. PastaPastaPasta referenced this in commit b29af0747b on Jul 1, 2021
  32. PastaPastaPasta referenced this in commit eae83b57e2 on Jul 14, 2021
  33. PastaPastaPasta referenced this in commit ceeea4c0fa on Jul 15, 2021
  34. Rolloke commented at 6:08 PM on September 25, 2021: none

    to suppress these warnings: warning: implicitly-declared ‘constexpr QVariant::Private& QVariant::Private::operator=(const QVariant::Private&)’ is deprecated [-Wdeprecated-copy] just define unix:QMAKE_CFLAGS_WARN_ON += -Wno-deprecated-copy unix:QMAKE_CXXFLAGS_WARN_ON += -Wno-deprecated-copy in your projects .pro file.

  35. MarcoFalke commented at 7:17 AM on September 26, 2021: member

    There is also --enable-suppress-external-warnings in our configure, which suppresses them.

  36. GoodTekken referenced this in commit a4a4b0f926 on Aug 19, 2022
  37. DrahtBot locked this on Oct 30, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-02 18:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me