Bug 413416 - Build failure with gcc 9
Summary: Build failure with gcc 9
Status: RESOLVED FIXED
Alias: None
Product: kdenlive
Classification: Unclassified
Component: Installation (show other bugs)
Version: git-master
Platform: Other Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Vincent PINON
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-25 04:57 UTC by Luca Beltrame
Modified: 2019-11-05 07:01 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:
fritzibaby: Brainstorm+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luca Beltrame 2019-10-25 04:57:45 UTC
SUMMARY

When trying to build kdenlive git master on openSUSE Tumbleweed, with GCC 9, compilation fails with this error:

[  120s] cd "/home/abuild/rpmbuild/BUILD/kdenlive-19.11.70git.20191024T115227~628d47842/build/thumbnailer" && /usr/bin/c++  -DKCOREADDONS_LIB -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_WIDGETS_LIB -DTRANSLATION_DOMAIN=\"kdenlive\" -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -Dmltpreview_EXPORTS -I"/home/abuild/rpmbuild/BUILD/kdenlive-19.11.70git.20191024T115227~628d47842/build/thumbnailer" -I"/home/abuild/rpmbuild/BUILD/kdenlive-19.11.70git.20191024T115227~628d47842/thumbnailer" -I"/home/abuild/rpmbuild/BUILD/kdenlive-19.11.70git.20191024T115227~628d47842/build/thumbnailer/mltpreview_autogen/include" -I/usr/include/mlt -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtCore -isystem /usr/lib/qt5/mkspecs/linux-g++ -isystem /usr/include/qt5/QtGui -isystem /usr/include/KF5/KIOCore -isystem /usr/include/KF5 -isystem /usr/include/KF5/KCoreAddons -isystem /usr/include/KF5/KService -isystem /usr/include/KF5/KConfigCore -isystem /usr/include/qt5/QtNetwork -isystem /usr/include/qt5/QtConcurrent -isystem /usr/include/qt5/QtDBus -isystem /usr/include/KF5/KIOWidgets -isystem /usr/include/KF5/KJobWidgets -isystem /usr/include/qt5/QtWidgets -isystem /usr/include/KF5/KCompletion -isystem /usr/include/KF5/KWidgetsAddons  -fomit-frame-pointer -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g -DNDEBUG -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 -Wsuggest-override -Wlogical-op -fPIC -Wno-suggest-override -fPIC -fvisibility=hidden -fvisibility-inlines-hidden   -fPIC -std=gnu++11 -o CMakeFiles/mltpreview.dir/mltpreview.cpp.o -c "/home/abuild/rpmbuild/BUILD/kdenlive-19.11.70git.20191024T115227~628d47842/thumbnailer/mltpreview.cpp"
[  120s] /home/abuild/rpmbuild/BUILD/kdenlive-19.11.70git.20191024T115227~628d47842/src/lib/external/media_ctrl/mediactrl.c: In function 'find_first_device':
[  120s] /home/abuild/rpmbuild/BUILD/kdenlive-19.11.70git.20191024T115227~628d47842/src/lib/external/media_ctrl/mediactrl.c:355:5: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
[  120s]   355 |     for (int i = 0; i < 32; i++) {
[  120s]       |     ^~~
[  120s] /home/abuild/rpmbuild/BUILD/kdenlive-19.11.70git.20191024T115227~628d47842/src/lib/external/media_ctrl/mediactrl.c:355:5: note: use option '-std=c99', '-std=gnu99', '-std=c11' or '-std=gnu11' to compile your code
[  120s] make[2]: *** [src/lib/external/media_ctrl/CMakeFiles/media_ctrl.dir/build.make:76: src/lib/external/media_ctrl/CMakeFiles/media_ctrl.dir/mediactrl.c.o] Error 1
[  120s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/kdenlive-19.11.70git.20191024T115227~628d47842/build'
[  120s] make[1]: *** [CMakeFiles/Makefile2:752: src/lib/external/media_ctrl/CMakeFiles/media_ctrl.dir/all] Error 2

I can't track which recent commit might have broken it, though.

STEPS TO REPRODUCE
1. Build the latest kdenlive git master

SOFTWARE/OS VERSIONS

gcc --version
gcc (SUSE Linux) 9.2.1 20190903 [gcc-9-branch revision 275330]
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.

All the KF5 stack is built from its latest git master state.
Comment 1 Christophe Giboudeaux 2019-10-25 07:02:56 UTC
David, Hannah, I guess this is another issue caused by the recent ECM changes
Comment 3 Hannah von Reth 2019-10-25 08:47:08 UTC
(In reply to Christophe Giboudeaux from comment #1)
> David, Hannah, I guess this is another issue caused by the recent ECM changes

Shouldn't that be fixed now by https://github.com/KDE/extra-cmake-modules/commit/fd6e98ba6de89a7f08364bb2ec096a5310c1cde8 ?
Comment 4 Rik Mills 2019-10-25 08:56:30 UTC
(In reply to Hannah von Reth from comment #3)
> Shouldn't that be fixed now by
> https://github.com/KDE/extra-cmake-modules/commit/
> fd6e98ba6de89a7f08364bb2ec096a5310c1cde8 ?

The builds I linked/referred to in #2 are all using ECM built including that commit.
Comment 5 Christophe Giboudeaux 2019-10-25 10:12:47 UTC
(In reply to Hannah von Reth from comment #3)
> (In reply to Christophe Giboudeaux from comment #1)
> > David, Hannah, I guess this is another issue caused by the recent ECM changes
> 
> Shouldn't that be fixed now by
> https://github.com/KDE/extra-cmake-modules/commit/
> fd6e98ba6de89a7f08364bb2ec096a5310c1cde8 ?

Not in this case. previously, ECM was setting '-std=iso9899:1990', now it sets C90 which defines '-std=c90'
Comment 6 Christophe Giboudeaux 2019-10-25 10:16:33 UTC
and that overwrites `set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --std=c99")` in kdenlive/src/lib/external/media_ctrl/CMakeLists.txt
Comment 7 Christophe Giboudeaux 2019-10-25 10:19:46 UTC
It can be fixed with:

diff --git a/src/lib/external/media_ctrl/CMakeLists.txt b/src/lib/external/media_ctrl/CMakeLists.txt
index 24870ad3b..ec8e2fb71 100644
--- a/src/lib/external/media_ctrl/CMakeLists.txt
+++ b/src/lib/external/media_ctrl/CMakeLists.txt
@@ -1,10 +1,10 @@
 if(HAVE_LINUX_INPUT_H)
   # Create a static library media_ctrl
-  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --std=c99")
   include_directories(
     ${CMAKE_BINARY_DIR}
   )
   add_library(media_ctrl STATIC
     mediactrl.c
   )
+  set_target_properties(media_ctrl PROPERTIES C_STANDARD 99)
 endif()

but that means the ECM backward compatibility is broken
Comment 8 Christoph Feck 2019-10-27 10:39:19 UTC
https://invent.kde.org/kde/kdenlive/commit/1a26aa5032afbb47442b23bf5230661b92a00a23 was pushed, but without a review.
Comment 9 Christoph Feck 2019-11-01 23:42:01 UTC
According to https://invent.kde.org/kde/kdenlive/-/jobs/20790/ it also fails to build the 19.08 branch. Could someone backport if this is the correct fix?
Comment 10 Vincent PINON 2019-11-05 07:01:49 UTC
Git commit 63f232560ec2fd98b266f2177b37c51c4ceb1428 by Vincent Pinon, on behalf of Yuri Chornoivan.
Committed on 05/11/2019 at 06:59.
Pushed by vpinon into branch 'Applications/19.08'.

Try to make it compile with gcc 9

Signed-off-by: Vincent Pinon <vpinon@kde.org>

M  +2    -1    src/lib/external/media_ctrl/mediactrl.c

https://invent.kde.org/kde/kdenlive/commit/63f232560ec2fd98b266f2177b37c51c4ceb1428