GNOME Bugzilla – Bug 797204
vaapi: tests: compile error since 00f5fe9ccf
Last modified: 2018-09-26 17:39:49 UTC
Compilation fails on Ubuntu Xenial (gcc 5.4.0) and Fedora 27 (gcc 7.3.1) since... commit 00f5fe9ccfc7183eb0f3f02f6efcca06343e70b2 Author: Víctor Manuel Jáquez Leal <vjaquez@igalia.com> Date: Tue Sep 25 20:28:02 2018 +0200 tests: don's use sysdeps.h in header Compilation succeeds on Ubuntu Bionic (gcc 7.3.0) and Fedora 28 (gcc 8.1.1)
y4mreader.c: In function 'parse_int': y4mreader.c:44:11: error: implicit declaration of function 'strtol'; did you mean 'g_strtod'? [-Werror=implicit-function-declaration] value = strtol (str, NULL, 0); ^~~~~~ g_strtod y4mreader.c:44:11: error: nested extern declaration of 'strtol' [-Werror=nested-externs] y4mreader.c: In function 'parse_header': y4mreader.c:63:3: error: implicit declaration of function 'memset' [-Werror=implicit-function-declaration] memset (header, 0, BUFSIZ); ^~~~~~ y4mreader.c:63:3: error: incompatible implicit declaration of built-in function 'memset' [-Werror] y4mreader.c:63:3: note: include '<string.h>' or provide a declaration of 'memset' y4mreader.c:68:7: error: implicit declaration of function 'memcmp' [-Werror=implicit-function-declaration] if (memcmp (header, "YUV4MPEG2", 9) != 0) ^~~~~~ y4mreader.c:97:15: error: implicit declaration of function 'strncmp' [-Werror=implicit-function-declaration] if (strncmp (str, "420", 3) != 0) { ^~~~~~~ y4mreader.c: In function 'skip_frame_header': y4mreader.c:191:3: error: incompatible implicit declaration of built-in function 'memset' [-Werror] memset (header, 0, BUFSIZ); ^~~~~~ y4mreader.c:191:3: note: include '<string.h>' or provide a declaration of 'memset' cc1: all warnings being treated as errors make[3]: *** [Makefile:977: simple_encoder-y4mreader.o] Error 1 make[3]: Leaving directory '/opt/media/build/gstreamer-vaapi/tests' make[2]: *** [Makefile:1157: all-recursive] Error 1 make[2]: Leaving directory '/opt/media/build/gstreamer-vaapi/tests' make[1]: *** [Makefile:541: all-recursive] Error 1 make[1]: Leaving directory '/opt/media/build/gstreamer-vaapi' make: *** [Makefile:473: all] Error 2
Created attachment 373761 [details] [review] fix compilation errors
Review of attachment 373761 [details] [review]: ::: tests/y4mreader.c @@ +20,3 @@ */ +#include "gst/vaapi/sysdeps.h" Why not just include string.h?
(In reply to Víctor Manuel Jáquez Leal from comment #3) > Review of attachment 373761 [details] [review] [review]: > > ::: tests/y4mreader.c > @@ +20,3 @@ > */ > > +#include "gst/vaapi/sysdeps.h" > > Why not just include string.h? It seems not. It requires <gst/gst.h> The header handling inside gstreamer-vaapi is a mess :( Cooking a patch
(In reply to Víctor Manuel Jáquez Leal from comment #3) > Review of attachment 373761 [details] [review] [review]: > > ::: tests/y4mreader.c > @@ +20,3 @@ > */ > > +#include "gst/vaapi/sysdeps.h" > > Why not just include string.h? Because sysdeps.h includes two headers needed here. It also includes the project config.h first, which is traditionally intended to be used in all compilation units to prevent inconsistencies in declarations, etc...
Created attachment 373773 [details] [review] tests: fix compilation
Comment on attachment 373773 [details] [review] tests: fix compilation pushed attachment 373773 [details] [review] as commit fbc5ed16 - tests: fix compilation
Artie, reopen if the problem isn't fixed :)
Victor, Why wouldn't we want config.h included in all compilation units (.c files). If it's not included first, then all subsequent includes (including indirect includes) could potentially introduce inconsistent declarations. I mean, that's the purpose of using a config.h in the first place, isn't it.
(In reply to Víctor Manuel Jáquez Leal from comment #8) > Artie, reopen if the problem isn't fixed :) y4mreader.c:43:11: error: implicit declaration of function 'strtol'; did you mean 'strtok'? [-Werror=implicit-function-declaration] value = strtol (str, NULL, 0); ^~~~~~ strtok
strtol is in stdlib.h
a modified version of attachment 373761 [details] [review] was pushed