Subject: Build failure: kdenlive
From: Jesse Gibbons <[email-masked]>
To: [email-masked]
Date: Sun, 5 Jul 2020 14:57:19 -0600
List-Id: <debbugs-submit.debbugs.gnu.org>

Though I am working on this in a personal fork channel, I can confirm 
using time-machine that it is also an issue in guix's master branch.

Closest Commit (in guix master): 2ca4ae2993e20a1415fa25acf8fd6b993ee48c18

Since the build system uses multiple threads, the log itself is a mess. 
Here's what it says when it fails.

-------------------------------------------------------------------------------------

cd /tmp/guix-build-kdenlive-18.08.1.drv-0/build && 
/gnu/store/89rj5fqcg48afgk99639ds602pgf92k4-cmake-minimal-3.16.5/bin/cmake 
-E cmake_depends "Unix Makefiles" /tmp/guix-build-kdenlive-18.08
.1.drv-0/source 
/tmp/guix-build-kdenlive-18.08.1.drv-0/source/thumbnailer 
/tmp/guix-build-kdenlive-18.08.1.drv-0/build 
/tmp/guix-build-kdenlive-18.08.1.drv-0/build/thumbnailer /tmp/guix-buil
d-kdenlive-18.08.1.drv-0/build/thumbnailer/CMakeFiles/mltpreview.dir/DependInfo.cmake 
--color=
/tmp/guix-build-kdenlive-18.08.1.drv-0/source/src/lib/external/media_ctrl/mediactrl.c: 
In function ‘find_first_device’:
/tmp/guix-build-kdenlive-18.08.1.drv-0/source/src/lib/external/media_ctrl/mediactrl.c:406:2: 
error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
   for (int i = 0; i < 32; i++ ) {
   ^~~
/tmp/guix-build-kdenlive-18.08.1.drv-0/source/src/lib/external/media_ctrl/mediactrl.c:406:2: 
note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile 
your code
make[2]: *** 
[src/lib/external/media_ctrl/CMakeFiles/media_ctrl.dir/build.make:79: 
src/lib/external/media_ctrl/CMakeFiles/media_ctrl.dir/mediactrl.c.o] Error 1
make[2]: Leaving directory '/tmp/guix-build-kdenlive-18.08.1.drv-0/build'
make[1]: *** [CMakeFiles/Makefile2:1291: 
src/lib/external/media_ctrl/CMakeFiles/media_ctrl.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

-------------------------------------------------------------------------------------

Based on this, I know it's a problem in mediactrl.c related to the 
version of c the compiler is expecting. Here is what make calls when it 
compiles mediactrl.c:

-------------------------------------------------------------------------------------

cd 
/tmp/guix-build-kdenlive-18.08.1.drv-0/build/src/lib/external/media_ctrl 
&& /gnu/store/rn75fm7adgx3pw5j8pg3bczfqq1y17lk-gcc-7.5.0/bin/gcc 
-DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_CAST_TO_ASCII
-DQT_NO_URL_CAST_FROM_STRING -DTRANSLATION_DOMAIN=\"kdenlive\" 
-D_GNU_SOURCE -D_LARGEFILE64_SOURCE 
-I/tmp/guix-build-kdenlive-18.08.1.drv-0/build/src/lib/external/media_ctrl 
-I/tmp/guix-buil
d-kdenlive-18.08.1.drv-0/source/src/lib/external/media_ctrl 
-I/tmp/guix-build-kdenlive-18.08.1.drv-0/build/src/lib/external/media_ctrl/media_ctrl_autogen/include 
-I/tmp/guix-build-kdenlive-1
8.08.1.drv-0/build/generated 
-I/tmp/guix-build-kdenlive-18.08.1.drv-0/build  -fno-common -Wall 
-Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long 
-Wpointer-arith -Wundef
  -Wmissing-format-attribute -Wwrite-strings 
-Werror=implicit-function-declaration --std=c99 -O2 -g -DNDEBUG 
-fvisibility=hidden   -std=gnu90 -o 
CMakeFiles/media_ctrl.dir/mediactrl.c.o   -c /
tmp/guix-build-kdenlive-18.08.1.drv-0/source/src/lib/external/media_ctrl/mediactrl.c

-------------------------------------------------------------------------------------

I see --std=c99 and -std=gnu90 here. I'm guessing gcc favors std=-gnu90 
in this situation.

I have passed --keep-failed and searched for "gnu90" in the source, and 
only found it in the generated Makefiles. I also searched for gnu90 in 
the package definition, but I can't find it.

I have tried adding the following line to the list of arguments in the 
package definition, but it doesn't remove the -std=gnu90 option.

-------------------------------------------------------------------------------------

         #:configure-flags '("-DCMAKE_C_FLAGS=-std=c99")))

-------------------------------------------------------------------------------------

What a puzzle.

-Jesse Gibbons