install error for iio oscillscope

got error when  sudo make -j 4

In file included from //usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h:9:0,
                 from //usr/include/glib-2.0/glib/gtypes.h:34,
                 from //usr/include/glib-2.0/glib/galloca.h:34,
                 from //usr/include/glib-2.0/glib.h:32,
                 from //usr/include/glib-2.0/gobject/gbinding.h:30,
                 from //usr/include/glib-2.0/glib-object.h:25,
                 from //usr/include/glib-2.0/gio/gioenums.h:30,
                 from //usr/include/glib-2.0/gio/giotypes.h:30,
                 from //usr/include/glib-2.0/gio/gio.h:28,
                 from //usr/include/gtk-2.0/gdk/gdkapplaunchcontext.h:30,
                 from //usr/include/gtk-2.0/gdk/gdk.h:32,
                 from //usr/include/gtk-2.0/gtk/gtk.h:32,
                 from oscplot.c:8:
oscplot.c: In function ‘osc_plot_get_type’:
//usr/include/glib-2.0/glib/gmacros.h:162:53: error: typedef ‘_GStaticAssertCompileTimeAssertion_0’ locally defined but not used [-Werror=unused-local-typedefs]
 #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1]

oscplot.c:402:1: note: in expansion of macro ‘G_DEFINE_TYPE’
 G_DEFINE_TYPE(OscPlot, osc_plot, GTK_TYPE_WIDGET)
 ^
cc1: all warnings being treated as errors
make: *** [oscplot.o] Error 1

  • 0
    •  Analog Employees 
    on Sep 11, 2017 6:11 AM

    The issue should only appear if a version of gcc >= 4.8 and a version of glib2 < 2.36 (5 years old) is used.

  • Hi,

    What's happening is that during the compile process we treat all warnings as errors. This allows us to keep the iio-oscilloscope source code aligned to a certain strictness and prevent unexpected runtime errors that could result from overlooking warnings.

    I'm not sure why you are getting that specific warning. It would be interesting to know what Linux distribution and version you have.

    A quick solution is to suppress that type of warning by adding the -Wno-unused-local-typedefs flag to the CFLAGS variable. Below is a diff that does exactly that:

    diff --git a/Makefile b/Makefile
    index aadb041..34da567 100644
    --- a/Makefile
    +++ b/Makefile
    @@ -40,7 +40,7 @@ endif
     CFLAGS := $(shell $(PKG_CONFIG) --cflags $(DEPENDENCIES)) \
            -I$(SYSROOT)/usr/include $(if $(WITH_MINGW),-mwindows,-fPIC) \
            -Wall -Wclobbered -Wempty-body -Wignored-qualifiers -Wmissing-field-initializers \
    -       -Wmissing-parameter-type -Wold-style-declaration -Woverride-init \
    +       -Wmissing-parameter-type -Wold-style-declaration -Woverride-init -Wno-unused-local-typedefs\
            -Wsign-compare -Wtype-limits -Wuninitialized -Wunused-but-set-parameter \
            -Werror -g -std=gnu90 -D_GNU_SOURCE -O2 -funwind-tables \
            -DPREFIX='"$(PREFIX)"' \

    Dan