Bug 379688 - kdenlive fails to build with gcc7
Summary: kdenlive fails to build with gcc7
Status: RESOLVED FIXED
Alias: None
Product: kdenlive
Classification: Applications
Component: Installation (show other bugs)
Version: 17.04.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Vincent PINON
URL:
Keywords:
: 375647 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-05-10 08:09 UTC by Heiko Becker
Modified: 2017-06-25 11:28 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
kdenlibe-17.04.1-gcct patch (1.96 KB, patch)
2017-06-09 21:26 UTC, Bruce Dubbs
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Heiko Becker 2017-05-10 08:09:13 UTC
One problem is the usage of abs() with an unsigned type and overloads:

/var/tmp/paludis/build/media-video-kdenlive-17.04.1/work/kdenlive-17.04.1/src/scopes/audioscopes/spectrogram.cpp:244:113: error: call
 of overloaded 'abs(unsigned int)' is ambiguous
                 hideText = m_aTrackMouse->isChecked() && m_mouseWithinWidget && abs(x - (leftDist + mouseX + 20)) < (int) minDistX +
 16
                                                                                                                 ^
In file included from /usr/x86_64-pc-linux-gnu/include/c++/7.1.0/cstdlib:75:0,
                 from /usr/x86_64-pc-linux-gnu/include/c++/7.1.0/bits/stl_algo.h:59,
                 from /usr/x86_64-pc-linux-gnu/include/c++/7.1.0/algorithm:62,
                 from /usr/include/qt5/QtCore/qglobal.h:108,
                 from /usr/include/qt5/QtGui/qtguiglobal.h:43,
                 from /usr/include/qt5/QtWidgets/qtwidgetsglobal.h:43,
                 from /usr/include/qt5/QtWidgets/qwidget.h:43,
                 from /usr/include/qt5/QtWidgets/QWidget:1,
                 from /var/tmp/paludis/build/media-video-kdenlive-17.04.1/work/kdenlive-17.04.1/src/scopes/audioscopes/abstractaudioscopewidget.h:14,
                 from /var/tmp/paludis/build/media-video-kdenlive-17.04.1/work/kdenlive-17.04.1/src/scopes/audioscopes/spectrogram.h:28,
                 from /var/tmp/paludis/build/media-video-kdenlive-17.04.1/work/kdenlive-17.04.1/src/scopes/audioscopes/spectrogram.cpp:11:
/usr/x86_64-pc-linux-gnu/include/stdlib.h:751:12: note: candidate: int abs(int)
 extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
            ^~~
In file included from /usr/x86_64-pc-linux-gnu/include/c++/7.1.0/cstdlib:77:0,
                 from /usr/x86_64-pc-linux-gnu/include/c++/7.1.0/bits/stl_algo.h:59,
                 from /usr/x86_64-pc-linux-gnu/include/c++/7.1.0/algorithm:62,
                 from /usr/include/qt5/QtCore/qglobal.h:108,
                 from /usr/include/qt5/QtGui/qtguiglobal.h:43,
                 from /usr/include/qt5/QtWidgets/qtwidgetsglobal.h:43,
                 from /usr/include/qt5/QtWidgets/qwidget.h:43,
                 from /usr/include/qt5/QtWidgets/QWidget:1,
                 from /var/tmp/paludis/build/media-video-kdenlive-17.04.1/work/kdenlive-17.04.1/src/scopes/audioscopes/abstractaudioscopewidget.h:14,
                 from /var/tmp/paludis/build/media-video-kdenlive-17.04.1/work/kdenlive-17.04.1/src/scopes/audioscopes/spectrogram.h:28,
                 from /var/tmp/paludis/build/media-video-kdenlive-17.04.1/work/kdenlive-17.04.1/src/scopes/audioscopes/spectrogram.cpp:11:
/usr/x86_64-pc-linux-gnu/include/c++/7.1.0/bits/std_abs.h:56:3: note: candidate: long int std::abs(long int)
   abs(long __i) { return __builtin_labs(__i); }
   ^~~
/usr/x86_64-pc-linux-gnu/include/c++/7.1.0/bits/std_abs.h:61:3: note: candidate: long long int std::abs(long long int)
   abs(long long __x) { return __builtin_llabs (__x); }
   ^~~
/usr/x86_64-pc-linux-gnu/include/c++/7.1.0/bits/std_abs.h:70:3: note: candidate: constexpr double std::abs(double)
   abs(double __x)
   ^~~
/usr/x86_64-pc-linux-gnu/include/c++/7.1.0/bits/std_abs.h:74:3: note: candidate: constexpr float std::abs(float)
   abs(float __x)
   ^~~
/usr/x86_64-pc-linux-gnu/include/c++/7.1.0/bits/std_abs.h:78:3: note: candidate: constexpr long double std::abs(long double)
   abs(long double __x)
   ^~~
/usr/x86_64-pc-linux-gnu/include/c++/7.1.0/bits/std_abs.h:84:3: note: candidate: constexpr __int128 std::abs(__int128)
   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
   ^~~
/usr/x86_64-pc-linux-gnu/include/c++/7.1.0/bits/std_abs.h:102:3: note: candidate: constexpr __float128 std::abs(__float128)
   abs(__float128 __x)



If I monkey-patch that and the similar occurrence in line 271 to (int)(...) I get another error:


git-sources/kde-core/kdenlive/src/profiles/tree/profiletreemodel.cpp
/home/heiko/Quelltexte/exherbo/git-sources/kde-core/kdenlive/src/profiles/tree/profiletreemodel.cpp: In constructor 'ProfileTreeModel::ProfileTreeModel(QObject*)':
/home/heiko/Quelltexte/exherbo/git-sources/kde-core/kdenlive/src/profiles/tree/profiletreemodel.cpp:146:21: error: 'function' is not a member of 'std'
     std::array<std::function<bool(QVariant, std::unique_ptr<ProfileModel>&)>, nbCrit> filtLambdas;
                     ^~~~~~~~
/home/heiko/Quelltexte/exherbo/git-sources/kde-core/kdenlive/src/profiles/tree/profiletreemodel.cpp:146:21: note: suggested alternative: 'is_function'
     std::array<std::function<bool(QVariant, std::unique_ptr<ProfileModel>&)>, nbCrit> filtLambdas;
                     ^~~~~~~~
                     is_function
/home/heiko/Quelltexte/exherbo/git-sources/kde-core/kdenlive/src/profiles/tree/profiletreemodel.cpp:146:21: error: 'function' is not a member of 'std'
/home/heiko/Quelltexte/exherbo/git-sources/kde-core/kdenlive/src/profiles/tree/profiletreemodel.cpp:146:21: note: suggested alternative: 'is_function'
     std::array<std::function<bool(QVariant, std::unique_ptr<ProfileModel>&)>, nbCrit> filtLambdas;
                     ^~~~~~~~
                     is_function
/home/heiko/Quelltexte/exherbo/git-sources/kde-core/kdenlive/src/profiles/tree/profiletreemodel.cpp:146:75: error: expression list treated as compound expression in functional cast [-fpermissive]
     std::array<std::function<bool(QVariant, std::unique_ptr<ProfileModel>&)>, nbCrit> filtLambdas;
                                                                           ^
/home/heiko/Quelltexte/exherbo/git-sources/kde-core/kdenlive/src/profiles/tree/profiletreemodel.cpp:146:76: error: wrong number of template arguments (1, should be 2)
     std::array<std::function<bool(QVariant, std::unique_ptr<ProfileModel>&)>, nbCrit> filtLambdas;
                                                                            ^
In file included from /usr/x86_64-pc-linux-gnu/include/c++/7.1.0/tuple:39:0,
                 from /usr/x86_64-pc-linux-gnu/include/c++/7.1.0/bits/stl_map.h:63,
                 from /usr/x86_64-pc-linux-gnu/include/c++/7.1.0/map:61,
                 from /usr/host/include/qt5/QtCore/qmetatype.h:55,
                 from /usr/host/include/qt5/QtCore/qvariant.h:46,
                 from /usr/host/include/qt5/QtCore/qabstractitemmodel.h:43,
                 from /usr/host/include/qt5/QtCore/QAbstractItemModel:1,
                 from /home/heiko/Quelltexte/exherbo/git-sources/kde-core/kdenlive/src/profiles/tree/profiletreemodel.hpp:25,
                 from /home/heiko/Quelltexte/exherbo/git-sources/kde-core/kdenlive/src/profiles/tree/profiletreemodel.cpp:22:
/usr/x86_64-pc-linux-gnu/include/c++/7.1.0/array:94:12: note: provided for 'template<class _Tp, long unsigned int _Nm> struct std::array'
     struct array
            ^~~~~
/home/heiko/Quelltexte/exherbo/git-sources/kde-core/kdenlive/src/profiles/tree/profiletreemodel.cpp:146:77: error: expected unqualified-id before ',' token
     std::array<std::function<bool(QVariant, std::unique_ptr<ProfileModel>&)>, nbCrit> filtLambdas;
                                                                             ^
/home/heiko/Quelltexte/exherbo/git-sources/kde-core/kdenlive/src/profiles/tree/profiletreemodel.cpp:146:85: error: expected initializer before '>' token
     std::array<std::function<bool(QVariant, std::unique_ptr<ProfileModel>&)>, nbCrit> filtLambdas;
                                                                                     ^
/home/heiko/Quelltexte/exherbo/git-sources/kde-core/kdenlive/src/profiles/tree/profiletreemodel.cpp:147:5: error: 'filtLambdas' was not declared in this scope
     filtLambdas[0] = [](QVariant width, std::unique_ptr<ProfileModel>& ptr){return width==-1 || ptr->width() == width;};
Comment 1 Bruce Dubbs 2017-05-17 23:46:27 UTC
I had the same problems with gcc7.  I was able to get version 17.04.1 to build with:

sed -i '/KLocal/a #include <functional>' src/profiles/tree/profiletreemodel.cpp 
sed -i '/abs/s/leftDist/(int)&/' src/scopes/audioscopes/spectrogram.cpp
Comment 2 Vincent PINON 2017-06-08 12:37:28 UTC
*** Bug 375647 has been marked as a duplicate of this bug. ***
Comment 3 Andreas Sturmlechner 2017-06-09 20:28:18 UTC
(In reply to Bruce Dubbs from comment #1)
> I had the same problems with gcc7.  I was able to get version 17.04.1 to
> build with:
> 
> sed -i '/KLocal/a #include <functional>'
> src/profiles/tree/profiletreemodel.cpp 
> sed -i '/abs/s/leftDist/(int)&/' src/scopes/audioscopes/spectrogram.cpp

Can you turn this into a proper patch and submit it for review?
Comment 4 Bruce Dubbs 2017-06-09 21:26:07 UTC
Created attachment 106016 [details]
kdenlibe-17.04.1-gcct patch

Fix kdenlive 17.04.1 so it builds with gcc7.
Comment 5 RJVB 2017-06-17 08:08:54 UTC
I can confirm that the issue still exists in 17.04.2 and is still addressed by the patch.

Has it been submitted for review yet?
Comment 6 Andreas Sturmlechner 2017-06-24 08:39:03 UTC
A different patch went into 17.04 branch, is this bug fixed now?
Comment 7 RJVB 2017-06-24 09:23:55 UTC
The only difference is that the committed change doesn't touch profiletreemodel.cpp . It isn't clear from the commit message under what context the author intended to fix compilation (using gcc7, an exotic compiler option, etc) but for me it doesn't fix the whole issue:

/usr/bin/g++-7  -DKCOREADDONS_LIB -DKF5_USE_FILEMETADATA -DKGUIADDONS_LIB -DQT5_USE_WEBKIT -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_URL_CAST_FROM_STRING -DQT_QML_LIB -DQT_QUICK_LIB -DQT_SCRIPT_LIB -DQT_SVG_LIB -DQT_WEBKITWIDGETS_LIB -DQT_WEBKIT_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB -DTRANSLATION_DOMAIN=\"kdenlive\" -DUSE_JOGSHUTTLE -DUSE_V4L -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -I/path/to/build/src -I/path/to/kdenlive-17.04.2/src -I/path/to/build/src/kdenlive_autogen/include -I/path/to/build/generated -I/path/to/build -I/path/to/kdenlive-17.04.2/src/lib/external -I/path/to/kdenlive-17.04.2/src/lib -I/path/to/build/src/lib/external/kiss_fft -I/path/to/kdenlive-17.04.2/src/lib/external/kiss_fft -I/path/to/build/src/lib/external/media_ctrl -I/path/to/kdenlive-17.04.2/src/lib/external/media_ctrl -I/opt/local/include/mlt -I/opt/local/include -isystem /opt/local/include/qt5 -isystem /opt/local/include/qt5/QtScript -isystem /opt/local/include/qt5/QtCore -isystem /opt/local/share/qt5/mkspecs/linux-g++-64 -isystem /opt/local/include/qt5/QtWidgets -isystem /opt/local/include/qt5/QtGui -isystem /opt/local/include/qt5/QtConcurrent -isystem /opt/local/include/qt5/QtQml -isystem /opt/local/include/qt5/QtNetwork -isystem /opt/local/include/qt5/QtQuick -isystem /opt/local/include/KF5/KWidgetsAddons -isystem /opt/local/include/KF5 -isystem /opt/local/include/KF5/KArchive -isystem /opt/local/include/KF5/KCoreAddons -isystem /opt/local/include/KF5/KIOCore -isystem /opt/local/include/KF5/KService -isystem /opt/local/include/KF5/KConfigCore -isystem /opt/local/include/KF5/KIOFileWidgets -isystem /opt/local/include/KF5/KIOWidgets -isystem /opt/local/include/KF5/KJobWidgets -isystem /opt/local/include/KF5/KCompletion -isystem /opt/local/include/KF5/KBookmarks -isystem /opt/local/include/qt5/QtXml -isystem /opt/local/include/KF5/KItemViews -isystem /opt/local/include/KF5/KXmlGui -isystem /opt/local/include/qt5/QtDBus -isystem /opt/local/include/KF5/KConfigWidgets -isystem /opt/local/include/KF5/KCodecs -isystem /opt/local/include/KF5/KConfigGui -isystem /opt/local/include/KF5/KAuth -isystem /opt/local/include/KF5/Solid -isystem /opt/local/include/KF5/KNotifyConfig -isystem /opt/local/include/KF5/KNewStuff3 -isystem /opt/local/include/KF5/KNewStuff3/KNS3 -isystem /opt/local/include/KF5/KNewStuff3/knscore -isystem /opt/local/include/KF5/KNewStuff3/kns3 -isystem /opt/local/include/KF5/KNewStuff3/KNSCore -isystem /opt/local/include/KF5/Attica -isystem /opt/local/include/KF5/KDBusAddons -isystem /opt/local/include/KF5/KGuiAddons -isystem /opt/local/include/KF5/KNotifications -isystem /opt/local/include/KF5/KTextWidgets -isystem /opt/local/include/KF5/SonnetUi -isystem /opt/local/include/KF5/KI18n -isystem /opt/local/include/KF5/KIconThemes -isystem /opt/local/include/KF5/KCrash -isystem /opt/local/include/qt5/QtSvg -isystem /opt/local/include/KF5/KFileMetaData -isystem /opt/local/include/qt5/QtWebKitWidgets -isystem /opt/local/include/qt5/QtWebKit  -O3 -ftracer -g -DNDEBUG -m64 -std=c++0x -fno-operator-names -fno-exceptions -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -Wvla -Wdate-time  -fPIC -std=c++11 -Wall -pedantic -Wextra -Wcast-qual -Wcast-align -Wfloat-equal -Wpointer-arith -Wunreachable-code -Wchar-subscripts -Wcomment -Wformat -Werror-implicit-function-declaration -Wmain -Wmissing-braces -Wparentheses -Wsequence-point -Wreturn-type -Wswitch -Wuninitialized -Wreorder -Wundef -Wshadow -Wwrite-strings -Wsign-compare  -Wconversion -Wmissing-noreturn  -Wsign-conversion -Wunused  -Wstrict-aliasing -Wstrict-overflow -Wconversion -Wdisabled-optimization -Wlogical-op -Wunsafe-loop-optimizations   -Wunused-parameter -Wshadow -Wno-variadic-macros -Wno-float-conversion -fvisibility=hidden -fvisibility-inlines-hidden   -fPIC -std=gnu++11 -o CMakeFiles/kdenlive.dir/profiles/tree/profiletreemodel.cpp.o -c /path/to/kdenlive-17.04.2/src/profiles/tree/profiletreemodel.cpp
/path/to/kdenlive-17.04.2/src/profiles/tree/profiletreemodel.cpp: In constructor ‘ProfileTreeModel::ProfileTreeModel(QObject*)’:
/path/to/kdenlive-17.04.2/src/profiles/tree/profiletreemodel.cpp:146:21: error: ‘function’ is not a member of ‘std’
     std::array<std::function<bool(QVariant, std::unique_ptr<ProfileModel>&)>, nbCrit> filtLambdas;
                     ^~~~~~~~
/path/to/kdenlive-17.04.2/src/profiles/tree/profiletreemodel.cpp:146:21: note: suggested alternative: ‘is_function’
     std::array<std::function<bool(QVariant, std::unique_ptr<ProfileModel>&)>, nbCrit> filtLambdas;
                     ^~~~~~~~
                     is_function
/path/to/kdenlive-17.04.2/src/profiles/tree/profiletreemodel.cpp:146:21: error: ‘function’ is not a member of ‘std’
/path/to/kdenlive-17.04.2/src/profiles/tree/profiletreemodel.cpp:146:21: note: suggested alternative: ‘is_function’
     std::array<std::function<bool(QVariant, std::unique_ptr<ProfileModel>&)>, nbCrit> filtLambdas;
                     ^~~~~~~~
                     is_function
/path/to/kdenlive-17.04.2/src/profiles/tree/profiletreemodel.cpp:146:75: error: expression list treated as compound expression in functional cast [-fpermissive]
     std::array<std::function<bool(QVariant, std::unique_ptr<ProfileModel>&)>, nbCrit> filtLambdas;
                                                                           ^
/path/to/kdenlive-17.04.2/src/profiles/tree/profiletreemodel.cpp:146:76: error: wrong number of template arguments (1, should be 2)
     std::array<std::function<bool(QVariant, std::unique_ptr<ProfileModel>&)>, nbCrit> filtLambdas;
                                                                            ^
In file included from /usr/include/c++/7/tuple:39:0,
                 from /usr/include/c++/7/bits/stl_map.h:63,
                 from /usr/include/c++/7/map:61,
                 from /opt/local/include/qt5/QtCore/qmetatype.h:55,
                 from /opt/local/include/qt5/QtCore/qvariant.h:46,
                 from /opt/local/include/qt5/QtCore/qabstractitemmodel.h:43,
                 from /opt/local/include/qt5/QtCore/QAbstractItemModel:1,
                 from /path/to/kdenlive-17.04.2/src/profiles/tree/profiletreemodel.hpp:25,
                 from /path/to/kdenlive-17.04.2/src/profiles/tree/profiletreemodel.cpp:22:
/usr/include/c++/7/array:94:12: note: provided for ‘template<class _Tp, long unsigned int _Nm> struct std::array’
     struct array
            ^~~~~
/path/to/kdenlive-17.04.2/src/profiles/tree/profiletreemodel.cpp:146:77: error: expected unqualified-id before ‘,’ token
     std::array<std::function<bool(QVariant, std::unique_ptr<ProfileModel>&)>, nbCrit> filtLambdas;
                                                                             ^
/path/to/kdenlive-17.04.2/src/profiles/tree/profiletreemodel.cpp:146:85: error: expected initializer before ‘>’ token
     std::array<std::function<bool(QVariant, std::unique_ptr<ProfileModel>&)>, nbCrit> filtLambdas;
                                                                                     ^
/path/to/kdenlive-17.04.2/src/profiles/tree/profiletreemodel.cpp:147:5: error: ‘filtLambdas’ was not declared in this scope
     filtLambdas[0] = [](QVariant width, std::unique_ptr<ProfileModel>& ptr){return width==-1 || ptr->width() == width;};
     ^~~~~~~~~~~
make[2]: *** [src/CMakeFiles/kdenlive.dir/profiles/tree/profiletreemodel.cpp.o] Error 1
Comment 8 RJVB 2017-06-24 09:24:55 UTC
(That's with the patch applied to the 17.04.2 release code)
Comment 9 Heiko Becker 2017-06-24 10:01:34 UTC
(In reply to andreas.sturmlechner from comment #6)
> A different patch went into 17.04 branch, is this bug fixed now?

Despite profiletreemodel not being touched, it does work for me now with 2ed43d34a124609aef092164e2e58e5476228209 applied to 17.04.2.

I guess the missing header is pulled in by something else, which has changed since my original bug report.
Comment 10 Vincent PINON 2017-06-25 11:28:18 UTC
Git commit 5a51022496faf90549a29ff39f0c04ebb72e2a5a by Vincent Pinon.
Committed on 25/06/2017 at 08:11.
Pushed by vpinon into branch 'Applications/17.04'.

fix compile (gcc7)

M  +1    -0    src/profiles/tree/profiletreemodel.cpp

https://commits.kde.org/kdenlive/5a51022496faf90549a29ff39f0c04ebb72e2a5a