Add fatal warning in case unsupport gcc version has been used
ClosedPublic

Authored by habacker on Jul 2 2018, 8:20 AM.

Details

Diff Detail

Repository
R261 KMyMoney
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
habacker requested review of this revision.Jul 2 2018, 8:20 AM
habacker created this revision.
wojnilowicz added inline comments.
CMakeLists.txt
34

Why does KMM need at least gcc 7? I believe Thomas compiles it on something below this and suceeds anyway.

habacker added inline comments.Jul 3 2018, 1:47 PM
CMakeLists.txt
34

On an opensuse 42.3 system gcc 4.8 failed and I got an intermediate error with gcc6. Retesting with gcc 6.2.1 gave no errors, so I can lower the supported compiler to >= 6.0.0

habacker updated this revision to Diff 37104.Jul 3 2018, 1:49 PM
habacker edited the test plan for this revision. (Show Details)
  • lower supported version to >= 6.0.0
habacker marked 2 inline comments as done.Jul 3 2018, 1:54 PM

You can see at https://build.opensuse.org/package/live_build_log/home:NicoK:branches:KDE:Extra/kmymoney/openSUSE_Leap_42.3/x86_64, that on openSUSE Leap_42.3 the default compiler is still 4.8. and the build breaks without further notice.. This patch gives the user a clear indication about the root case. Any more issues, which would prevent accepting ?

wojnilowicz added inline comments.Jul 5 2018, 1:17 PM
CMakeLists.txt
34

AFAIK gcc 4.8 is not C++14 compatible and we require it, so no wonder it gives an error during compilation.

I'm not in favour of this patch because:

  1. you don't know the exact version that works thus probably excluding many users from building
  2. I would rely on reporting deficiencies by standard tools instead of custom error message. We explicitly require c++14 so CMake should report it somehow if it's not available.

I wonder what Thomas thinks about it.

from https://gcc.gnu.org/projects/cxx-status.html#cxx14 it looks that gcc 5 should have complete c++14 support. On that page there is also a detailed list, what is supported in what version.

From searching the web I got the impression that CMAKE_CXX_STANDARD may work. But for example with gcc 4.8.5 this results into using -std=c++1y.

Another option would be to check if a compiler flag is supported with

include(CheckCXXCompilerFlag)

# Check for standard to use
check_cxx_compiler_flag(-std=c++14 HAVE_FLAG1)
message("c++14 ${HAVE_FLAG1}")
check_cxx_compiler_flag(-std=c++1z HAVE_FLAG2)
message("c++1z ${HAVE_FLAG2}")
check_cxx_compiler_flag(-std=c++1y HAVE_FLAG3)
message("c++1y ${HAVE_FLAG3}")

but this also depends on which level is really required.

habacker added a comment.EditedJul 12 2018, 2:50 PM

gcc 5.3.1 does not work

~/src/kmymoney-build> g++-5 --version
g++-5 (SUSE Linux) 5.3.1 20160301 [gcc-5-branch revision 233849]

[  0%] Automatic MOC for target kmm_payeeidentifier
[  0%] Built target kmm_payeeidentifier_autogen
[  0%] Building CXX object kmymoney/mymoney/payeeidentifier/CMakeFiles  /kmm_payeeidentifier.dir/payeeidentifier.cpp.o

g++-5: error: unrecognized command line option ‘-Wnull-dereference’
g++-5: error: unrecognized command line option ‘-Wunused-const-variable’
g++-5: error: unrecognized command line option ‘-Wmisleading-indentation’
kmymoney/mymoney/payeeidentifier/CMakeFiles/kmm_payeeidentifier.dir/build.make:62: r

We could change e.g.

-Wnull-dereference

to

-Wno-null-dereference
habacker added a comment.EditedJul 14 2018, 10:25 AM

The warnings may be fixed, but this one probably not:

/home/ralf/src/kmymoney/kmymoney/models/accountsmodel.cpp: In instantiation of ‘AccountsModel::setColumnVisibility(eAccountsModel::Column, bool)::<lambda(auto:3&&, QStandardItem*)> [with auto:3 = AccountsModel::setColumnVisibility(eAccountsModel::Column, bool)::<lambda(auto:3&&, QStandardItem*)>&]’:
/home/ralf/src/kmymoney/kmymoney/models/accountsmodel.cpp:732:53:   required from here
/home/ralf/src/kmymoney/kmymoney/models/accountsmodel.cpp:725:34: internal compiler error: Speicherzugriffsfehler
           childItem->removeColumn(ixCol);
                                  ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugs.opensuse.org/> for instructions.

I think that this patch is required to give gcc users an early indication that they need a newer compiler

The warnings may be fixed, but this one probably not:

/home/ralf/src/kmymoney/kmymoney/models/accountsmodel.cpp: In instantiation of ‘AccountsModel::setColumnVisibility(eAccountsModel::Column, bool)::<lambda(auto:3&&, QStandardItem*)> [with auto:3 = AccountsModel::setColumnVisibility(eAccountsModel::Column, bool)::<lambda(auto:3&&, QStandardItem*)>&]’:
 /home/ralf/src/kmymoney/kmymoney/models/accountsmodel.cpp:732:53:   required from here
 /home/ralf/src/kmymoney/kmymoney/models/accountsmodel.cpp:725:34: internal compiler error: Speicherzugriffsfehler
            childItem->removeColumn(ixCol);
                                   ^
 Please submit a full bug report,
 with preprocessed source if appropriate.
 See <http://bugs.opensuse.org/> for instructions.

I think that this patch is required to give gcc users an early indication that they need a newer compiler

I think it's clearly seen from the returned error. In my opinion there is no need to additionally warn or inform user to which compiler he should switch or upgrade. It could be that gcc 5 on ArchLinux will work. As you can see the returned error says that bug should be reported against OpenSuse.

I got this answer:

Ok, so it's a known GCC issue. Fix for the issue was also backported to GCC-5
branch, but probably not fully. Anyway, please update to a newer version of
GCC, GCC-5 branch is out of support.
tbaumgart accepted this revision.Aug 26 2018, 8:05 AM

After running into a very similar scenario in another project I would highly recommend if I get warned by the build system that my compiler is a bit too old and might have trouble compiling the program. As developer, I can always take out the check and use whatever compiler I want to, but then I am on my own and certainly know what I am doing. On the other hand, as a regular user compiling the software and maybe being in touch with an application developer I want to have a clear warning that I am not using a supported compiler. Maybe, we can improve the error message a bit to something like

This version of KMyMoney requires at least gcc 6.0.0 to be built successfully

This revision is now accepted and ready to land.Aug 26 2018, 8:05 AM
wojnilowicz added a comment.EditedAug 26 2018, 8:07 AM

I got this answer:

Ok, so it's a known GCC issue. Fix for the issue was also backported to GCC-5
branch, but probably not fully. Anyway, please update to a newer version of
GCC, GCC-5 branch is out of support.

That's very convenient on their side. They use gcc 5.3.1 while the latest from this branch is 5.5. Those releases are two years apart. I'm not sure if 5.5 or even 5.4 could compile KMyMoney. Nevertheless it's better to update gcc to a supported version.

wojnilowicz requested changes to this revision.Aug 26 2018, 8:08 AM
This revision now requires changes to proceed.Aug 26 2018, 8:08 AM
This comment was removed by wojnilowicz.
habacker updated this revision to Diff 40519.Aug 27 2018, 5:56 PM
habacker marked an inline comment as done.
  • updated displayed message
tbaumgart accepted this revision.Aug 27 2018, 6:01 PM

Could you change required version from 6.0 to 5.4?

This revision was not accepted when it landed; it landed in state Needs Review.Aug 27 2018, 6:03 PM
This revision was automatically updated to reflect the committed changes.