GNOME Bugzilla – Bug 628875
libgnome-keyring fails to build on ARM with -Werror
Last modified: 2019-02-22 11:46:38 UTC
Created attachment 169567 [details] Full build.log Original report downstream at: http://bugs.gentoo.org/show_bug.cgi?id=332303 This is the error people is getting on ARM: /bin/sh ../libtool --tag=CC --mode=compile armv5tel-softfloat-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I.. -DPREFIX=\""/usr"\" -DBINDIR=\""/usr/bin"\" -DLIBEXECDIR=\""/usr/libexec"\" -DGNOMELOCALEDIR=\""/usr/share/locale"\" -I.. -I.. -pthread -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/eggdbus-1 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -DGKR_DBUS_MAJOR_VERSION=1 -DGKR_DBUS_MINOR_VERSION=2 -DGKR_DBUS_MICRO_VERSION=24 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -Wall -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wcast-align -Wsign-compare -O2 -march=armv5te -pipe -Wno-strict-aliasing -Wno-sign-compare -Werror -MT gnome-keyring-memory.lo -MD -MP -MF .deps/gnome-keyring-memory.Tpo -c -o gnome-keyring-memory.lo gnome-keyring-memory.c libtool: compile: armv5tel-softfloat-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I.. -DPREFIX=\"/usr\" -DBINDIR=\"/usr/bin\" -DLIBEXECDIR=\"/usr/libexec\" -DGNOMELOCALEDIR=\"/usr/share/locale\" -I.. -I.. -pthread -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/eggdbus-1 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -DGKR_DBUS_MAJOR_VERSION=1 -DGKR_DBUS_MINOR_VERSION=2 -DGKR_DBUS_MICRO_VERSION=24 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -Wall -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wcast-align -Wsign-compare -O2 -march=armv5te -pipe -Wno-strict-aliasing -Wno-sign-compare -Werror -MT gnome-keyring-memory.lo -MD -MP -MF .deps/gnome-keyring-memory.Tpo -c gnome-keyring-memory.c -fPIC -DPIC -o .libs/gnome-keyring-memory.o cc1: warnings being treated as errors gnome-keyring.c: In function 'find_network_password_filter': gnome-keyring.c:3830: error: cast increases required alignment of target type make[3]: *** [gnome-keyring.lo] Error 1 make[3]: *** Waiting for unfinished jobs.... mv -f .deps/gnome-keyring-memory.Tpo .deps/gnome-keyring-memory.Plo make[3]: Leaving directory `/var/tmp/portage/gnome-base/libgnome-keyring-2.30.1/work/libgnome-keyring-2.30.1/library' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/var/tmp/portage/gnome-base/libgnome-keyring-2.30.1/work/libgnome-keyring-2.30.1/library' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/var/tmp/portage/gnome-base/libgnome-keyring-2.30.1/work/libgnome-keyring-2.30.1' make: *** [all] Error 2 Thanks for your help :-)
The error occurs on this line in gnome-keyring.c in find_network_password_filter: attributes = (GnomeKeyringAttribute *) found->attributes->data; Line 3977 in git master. But I'm not familiar enough with ARM to know why or how to fix it. I'd include a patch in libgnome-keyring.
Created attachment 169736 [details] [review] Access GArray members using g_array_index() This handles type-casting internally to avoid alignment warnings on platforms that need to deal with these issues.
GArray->data is a gchar*, and on ARM, this can point to any location. We are type casting it to a (GnomeKeyringAttribute *), which, on ARM, will very likely need to be aligned to a word/double-word boundary. Yes, programming on x86 really spoils us. :) The attached patch uses a GArray macro for access (which, if you see, fools the compiler by first type-casting to a (void *), which it can't make any alignment guesses on, and then to a (Type *)). I prefer this version of the patch, but if you want to run with the way the code was originally written, you could also just replace: attributes = (GnomeKeyringAttribute *) found->attributes->data; with: attributes = &(g_array_index (found->attributes, GnomeKeyringAttribute, 0));
Caveat: I've not tested this, since I don't have access to a GNOME development stack for ARM.
Thanks. Merged.