GNOME Bugzilla – Bug 676846
CFLAGS are reset when compiling with --enable-gcov.
Last modified: 2012-05-26 14:41:59 UTC
If I try to compile my own gst-plugin and set/unset features in, or include headers by setting compiler flags in CFLAGS when compiling like so: CFLAGS="-DUSE_COOL_FEATURE -I/home/sebrn/src/downstream/include" make Then the plugin will compile successfully. If I attempt to do the same while compiling with gcov enabled (by suppling --enable-gcov to configure) it will fail. This means that it is impossible to override or append new compiler flags using CFLAGS from the command-line. The reason is that in the AG_GST_ARG_GCOV function in common/m4/gst-args.m4 reset the value of CFLAGS (and others) instead of simply appending -O0. Glib handles this by appending -O0, and therefore I propose that GStreamer do the same. Then CFLAGS can again be used to override/append compiler flags if so desired.
Created attachment 215006 [details] [review] Proposed patch to allow overriding/appending CFLAGS.
Seems reasonable, I presume you have tested this with at least one of the gst modules as well to make sure the -O0 ends up in the right place. commit bdc49c4f46af4cdbf39e14c51fe6a5e137f55651 Author: Sebastian Rasmussen <sebrn@axis.com> Date: Fri May 25 23:13:59 2012 +0200 gst-args.m4: append gcov flags to CFLAGS instead of replacing them Fixes https://bugzilla.gnome.org/show_bug.cgi?id=676846 Not going to force a common update to all modules, let me know if you think it's needed. Will happen with the next common change otherwise.
I tested with gst-plugins-base, -good and -bad and have not identified any ill effects from this patch. What I see from the make V=1 logs is that -O0 is appended as expected and is among the last of the compiler flags. This means that you can still supply -I and -D flags in CFLAGS, but you can not override -O0. This makes sense if you configured using --enable-gcov. I'm happy with the patch sitting on master on gstreamer/common. Currently I'm using master when compiling. As long as it is eventually part of the 1.0 release in the future, that's fine.