configured with gcc < 6 and gcc >= 6
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.
CMakeLists.txt | ||
---|---|---|
34 | Why does KMM need at least gcc 7? I believe Thomas compiles it on something below this and suceeds anyway. |
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 |
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 ?
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:
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.
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
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.
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
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.