* [ptxdist] [PATCH] Example minimal project demonstrating glib compile failure with -Wcast-qual
@ 2015-10-30 15:47 jon
0 siblings, 0 replies; only message in thread
From: jon @ 2015-10-30 15:47 UTC (permalink / raw)
To: ptxdist; +Cc: Jon Ringle
From: Jon Ringle <jringle@gridpoint.com>
This minimal project will fail to compile with the following errors due to
-Werror and -Wcast-qual
------------------------
target: glibtest.compile
------------------------
make[1]: Entering directory `/home/local/GRIDPOINT/jringle/code/gpec/ec1k-rootfs/platform-EC1K/build-target/glibtest-1-build'
CC glibtest.o
In file included from /home/local/GRIDPOINT/jringle/code/gpec/ec1k-rootfs/platform-EC1K/sysroot-target/usr/include/glib-2.0/gio/gio.h:164:0,
from /home/local/GRIDPOINT/jringle/code/gpec/ec1k-rootfs/platform-EC1K/sysroot-target/usr/include/libnm/nm-types.h:24,
from /home/local/GRIDPOINT/jringle/code/gpec/ec1k-rootfs/platform-EC1K/sysroot-target/usr/include/libnm/nm-object.h:29,
from /home/local/GRIDPOINT/jringle/code/gpec/ec1k-rootfs/platform-EC1K/sysroot-target/usr/include/libnm/nm-access-point.h:29,
from /home/local/GRIDPOINT/jringle/code/gpec/ec1k-rootfs/platform-EC1K/sysroot-target/usr/include/libnm/NetworkManager.h:26,
from /home/local/GRIDPOINT/jringle/code/gpec/ec1k-rootfs/platform-EC1K/build-target/glibtest-1/glibtest.c:2:
/home/local/GRIDPOINT/jringle/code/gpec/ec1k-rootfs/platform-EC1K/sysroot-target/usr/include/glib-2.0/gio/glistmodel.h: In function 'G_LIST_MODEL':
/home/local/GRIDPOINT/jringle/code/gpec/ec1k-rootfs/platform-EC1K/sysroot-target/usr/include/glib-2.0/gio/glistmodel.h:36:376: error: cast discards '__attribute__((const))' qualifier from pointer target type [-Werror=cast-qual]
G_DECLARE_INTERFACE(GListModel, g_list_model, G, LIST_MODEL, GObject)
^
/home/local/GRIDPOINT/jringle/code/gpec/ec1k-rootfs/platform-EC1K/sysroot-target/usr/include/glib-2.0/gio/glistmodel.h: In function 'G_IS_LIST_MODEL':
/home/local/GRIDPOINT/jringle/code/gpec/ec1k-rootfs/platform-EC1K/sysroot-target/usr/include/glib-2.0/gio/glistmodel.h:36:544: error: cast discards '__attribute__((const))' qualifier from pointer target type [-Werror=cast-qual]
G_DECLARE_INTERFACE(GListModel, g_list_model, G, LIST_MODEL, GObject)
^
/home/local/GRIDPOINT/jringle/code/gpec/ec1k-rootfs/platform-EC1K/sysroot-target/usr/include/glib-2.0/gio/glistmodel.h: In function 'G_LIST_MODEL_GET_IFACE':
/home/local/GRIDPOINT/jringle/code/gpec/ec1k-rootfs/platform-EC1K/sysroot-target/usr/include/glib-2.0/gio/glistmodel.h:36:923: error: cast discards '__attribute__((const))' qualifier from pointer target type [-Werror=cast-qual]
G_DECLARE_INTERFACE(GListModel, g_list_model, G, LIST_MODEL, GObject)
^
In file included from /home/local/GRIDPOINT/jringle/code/gpec/ec1k-rootfs/platform-EC1K/sysroot-target/usr/include/glib-2.0/gio/gio.h:165:0,
from /home/local/GRIDPOINT/jringle/code/gpec/ec1k-rootfs/platform-EC1K/sysroot-target/usr/include/libnm/nm-types.h:24,
from /home/local/GRIDPOINT/jringle/code/gpec/ec1k-rootfs/platform-EC1K/sysroot-target/usr/include/libnm/nm-object.h:29,
from /home/local/GRIDPOINT/jringle/code/gpec/ec1k-rootfs/platform-EC1K/sysroot-target/usr/include/libnm/nm-access-point.h:29,
from /home/local/GRIDPOINT/jringle/code/gpec/ec1k-rootfs/platform-EC1K/sysroot-target/usr/include/libnm/NetworkManager.h:26,
from /home/local/GRIDPOINT/jringle/code/gpec/ec1k-rootfs/platform-EC1K/build-target/glibtest-1/glibtest.c:2:
/home/local/GRIDPOINT/jringle/code/gpec/ec1k-rootfs/platform-EC1K/sysroot-target/usr/include/glib-2.0/gio/gliststore.h: In function 'G_LIST_STORE':
/home/local/GRIDPOINT/jringle/code/gpec/ec1k-rootfs/platform-EC1K/sysroot-target/usr/include/glib-2.0/gio/gliststore.h:36:382: error: cast discards '__attribute__((const))' qualifier from pointer target type [-Werror=cast-qual]
G_DECLARE_FINAL_TYPE(GListStore, g_list_store, G, LIST_STORE, GObject)
^
/home/local/GRIDPOINT/jringle/code/gpec/ec1k-rootfs/platform-EC1K/sysroot-target/usr/include/glib-2.0/gio/gliststore.h: In function 'G_IS_LIST_STORE':
/home/local/GRIDPOINT/jringle/code/gpec/ec1k-rootfs/platform-EC1K/sysroot-target/usr/include/glib-2.0/gio/gliststore.h:36:550: error: cast discards '__attribute__((const))' qualifier from pointer target type [-Werror=cast-qual]
G_DECLARE_FINAL_TYPE(GListStore, g_list_store, G, LIST_STORE, GObject)
^
cc1: all warnings being treated as errors
make[1]: *** [glibtest.o] Error 1
make[1]: Leaving directory `/home/local/GRIDPOINT/jringle/code/gpec/ec1k-rootfs/platform-EC1K/build-target/glibtest-1-build'
make: *** [/home/local/GRIDPOINT/jringle/code/gpec/ec1k-rootfs/platform-EC1K/state/glibtest.compile] Error 2
---
local_src/glibtest/Makefile.am | 27 +++++++++
local_src/glibtest/autogen.sh | 22 +++++++
local_src/glibtest/configure.ac | 68 ++++++++++++++++++++++
local_src/glibtest/glibtest.c | 9 +++
rules/glibtest.in | 9 +++
rules/glibtest.make | 123 ++++++++++++++++++++++++++++++++++++++++
6 files changed, 258 insertions(+)
create mode 100644 local_src/glibtest/Makefile.am
create mode 100755 local_src/glibtest/autogen.sh
create mode 100644 local_src/glibtest/configure.ac
create mode 100644 local_src/glibtest/glibtest.c
create mode 100644 rules/glibtest.in
create mode 100644 rules/glibtest.make
diff --git a/local_src/glibtest/Makefile.am b/local_src/glibtest/Makefile.am
new file mode 100644
index 0000000..aeeec78
--- /dev/null
+++ b/local_src/glibtest/Makefile.am
@@ -0,0 +1,27 @@
+bin_PROGRAMS = \
+ glibtest
+
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_builddir)/include \
+ $(GLIB_CFLAGS) \
+ $(NM_CFLAGS)
+
+EXTRA_DIST = \
+ autogen.sh
+
+MAINTAINERCLEANFILES = \
+ configure \
+ aclocal.m4 \
+ Makefile.in
+
+#
+# binary
+#
+glibtest_SOURCES = \
+ glibtest.c
+
+glibtest_LDADD = \
+ $(GLIB_LIBS) \
+ $(NM_LIBS)
+
diff --git a/local_src/glibtest/autogen.sh b/local_src/glibtest/autogen.sh
new file mode 100755
index 0000000..6d1c20a
--- /dev/null
+++ b/local_src/glibtest/autogen.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+#
+# usage:
+#
+# banner <target name>
+#
+banner() {
+ echo
+ TG=`echo $1 | sed -e "s,/.*/,,g"`
+ LINE=`echo $TG |sed -e "s/./-/g"`
+ echo $LINE
+ echo $TG
+ echo $LINE
+ echo
+}
+
+banner "autoreconf"
+
+autoreconf --force --install -Wall || exit $?
+
+banner "Finished"
diff --git a/local_src/glibtest/configure.ac b/local_src/glibtest/configure.ac
new file mode 100644
index 0000000..cb540db
--- /dev/null
+++ b/local_src/glibtest/configure.ac
@@ -0,0 +1,68 @@
+AC_PREREQ([2.69])
+
+AC_INIT([glibtest],[1],[bugs@pengutronix.de])
+AC_CONFIG_SRCDIR([glibtest.c])
+AC_CANONICAL_BUILD
+AC_CANONICAL_HOST
+
+AM_MAINTAINER_MODE
+
+CFLAGS="${CFLAGS} -W -Wall -Wcast-qual"
+
+#
+# libtool library versioning stuff
+#
+# Library code modified: REVISION++
+# Interfaces changed/added/removed: CURRENT++ REVISION=0
+# Interfaces added: AGE++
+# Interfaces removed: AGE=0
+LT_CURRENT=0
+LT_REVISION=0
+LT_AGE=0
+AC_SUBST(LT_CURRENT)
+AC_SUBST(LT_REVISION)
+AC_SUBST(LT_AGE)
+
+
+#
+# Checks for programs.
+#
+AC_PROG_CC
+LT_INIT
+
+AM_INIT_AUTOMAKE([foreign no-exeext dist-bzip2])
+
+PKG_PROG_PKG_CONFIG
+
+PKG_CHECK_MODULES([GLIB], [glib-2.0])
+AC_SUBST([GLIB_CFLAGS])
+AC_SUBST([GLIB_LIBS])
+
+PKG_CHECK_MODULES([NM], [libnm])
+AC_SUBST([NM_CFLAGS])
+AC_SUBST([NM_LIBS])
+
+#
+# Debugging
+#
+AC_MSG_CHECKING([whether to enable debugging])
+AC_ARG_ENABLE(debug,
+ AS_HELP_STRING([--enable-debug], [enable debugging @<:@default=yes@:>@]),
+ [case "$enableval" in
+ y | yes) CONFIG_DEBUG=yes ;;
+ *) CONFIG_DEBUG=no ;;
+ esac],
+ [CONFIG_DEBUG=yes])
+AC_MSG_RESULT([${CONFIG_DEBUG}])
+if test "${CONFIG_DEBUG}" = "yes"; then
+ CFLAGS="${CFLAGS} -Werror -Wsign-compare -Wfloat-equal -Wformat-security -g -O1"
+ AC_DEFINE(DEBUG, 1, [debugging])
+else
+ CFLAGS="${CFLAGS} -O2"
+fi
+
+
+AC_CONFIG_FILES([
+ Makefile
+])
+AC_OUTPUT
diff --git a/local_src/glibtest/glibtest.c b/local_src/glibtest/glibtest.c
new file mode 100644
index 0000000..b5dd21c
--- /dev/null
+++ b/local_src/glibtest/glibtest.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+#include <NetworkManager.h>
+
+int main(void)
+{
+ printf("hello fish!\n");
+ return 0;
+}
+
diff --git a/rules/glibtest.in b/rules/glibtest.in
new file mode 100644
index 0000000..ad02d55
--- /dev/null
+++ b/rules/glibtest.in
@@ -0,0 +1,9 @@
+## SECTION=project_specific
+
+config GLIBTEST
+ bool
+ select GLIB
+ select NETWORKMANAGER
+ prompt "glibtest"
+ help
+ FIXME
diff --git a/rules/glibtest.make b/rules/glibtest.make
new file mode 100644
index 0000000..10b3512
--- /dev/null
+++ b/rules/glibtest.make
@@ -0,0 +1,123 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2015 by Jon Ringle <jringle@gridpoint.com>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_GLIBTEST) += glibtest
+
+#
+# Paths and names
+#
+GLIBTEST_VERSION := 1
+GLIBTEST := glibtest-$(GLIBTEST_VERSION)
+GLIBTEST_URL := file://$(PTXDIST_WORKSPACE)/local_src/glibtest
+GLIBTEST_DIR := $(BUILDDIR)/$(GLIBTEST)
+GLIBTEST_BUILD_OOT := YES
+GLIBTEST_LICENSE := unknown
+
+# ----------------------------------------------------------------------------
+# Extract
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/glibtest.extract: $(STATEDIR)/autogen-tools
+
+$(STATEDIR)/glibtest.extract:
+ @$(call targetinfo)
+ @$(call clean, $(GLIBTEST_DIR))
+ @$(call extract, GLIBTEST)
+ cd $(GLIBTEST_DIR) && [ -f configure ] || sh autogen.sh
+ @$(call patchin, GLIBTEST)
+ @$(call touch)
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+#GLIBTEST_CONF_ENV := $(CROSS_ENV)
+
+#
+# autoconf
+#
+GLIBTEST_CONF_TOOL := autoconf
+#GLIBTEST_CONF_OPT := $(CROSS_AUTOCONF_USR)
+
+#$(STATEDIR)/glibtest.prepare:
+# @$(call targetinfo)
+# @$(call world/prepare, GLIBTEST)
+# @$(call touch)
+
+# ----------------------------------------------------------------------------
+# Compile
+# ----------------------------------------------------------------------------
+
+#$(STATEDIR)/glibtest.compile:
+# @$(call targetinfo)
+# @$(call world/compile, GLIBTEST)
+# @$(call touch)
+
+# ----------------------------------------------------------------------------
+# Install
+# ----------------------------------------------------------------------------
+
+#$(STATEDIR)/glibtest.install:
+# @$(call targetinfo)
+# @$(call world/install, GLIBTEST)
+# @$(call touch)
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/glibtest.targetinstall:
+ @$(call targetinfo)
+
+ @$(call install_init, glibtest)
+ @$(call install_fixup, glibtest, PRIORITY, optional)
+ @$(call install_fixup, glibtest, SECTION, base)
+ @$(call install_fixup, glibtest, AUTHOR, "Jon Ringle <jringle@gridpoint.com>")
+ @$(call install_fixup, glibtest, DESCRIPTION, missing)
+
+# #
+# # example code:; copy all libraries, links and binaries
+# #
+
+ @for i in $(shell cd $(GLIBTEST_PKGDIR) && find bin sbin usr/bin usr/sbin -type f); do \
+ $(call install_copy, glibtest, 0, 0, 0755, -, /$$i); \
+ done
+ @for i in $(shell cd $(GLIBTEST_PKGDIR) && find lib usr/lib -name "*.so*"); do \
+ $(call install_copy, glibtest, 0, 0, 0644, -, /$$i); \
+ done
+ @links="$(shell cd $(GLIBTEST_PKGDIR) && find lib usr/lib -type l)"; \
+ if [ -n "$$links" ]; then \
+ for i in $$links; do \
+ from="`readlink $(GLIBTEST_PKGDIR)/$$i`"; \
+ to="/$$i"; \
+ $(call install_link, glibtest, $$from, $$to); \
+ done; \
+ fi
+
+# #
+# # FIXME: add all necessary things here
+# #
+
+ @$(call install_finish, glibtest)
+
+ @$(call touch)
+
+# ----------------------------------------------------------------------------
+# Clean
+# ----------------------------------------------------------------------------
+
+#$(STATEDIR)/glibtest.clean:
+# @$(call targetinfo)
+# @$(call clean_pkg, GLIBTEST)
+
+# vim: syntax=make
--
2.4.1
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-10-30 15:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-30 15:47 [ptxdist] [PATCH] Example minimal project demonstrating glib compile failure with -Wcast-qual jon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox