After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 628875 - libgnome-keyring fails to build on ARM with -Werror
libgnome-keyring fails to build on ARM with -Werror
Status: RESOLVED FIXED
Product: libgnome-keyring
Classification: Core
Component: General
2.30.x
Other Linux
: Normal normal
: ---
Assigned To: GNOME keyring maintainer(s)
GNOME keyring maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2010-09-06 11:59 UTC by Pacho Ramos
Modified: 2019-02-22 11:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Full build.log (32.45 KB, text/x-log)
2010-09-06 11:59 UTC, Pacho Ramos
  Details
Access GArray members using g_array_index() (3.49 KB, patch)
2010-09-08 06:27 UTC, Arun Raghavan
none Details | Review

Description Pacho Ramos 2010-09-06 11:59:22 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 :-)
Comment 1 Stef Walter 2010-09-08 04:23:32 UTC
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.
Comment 2 Arun Raghavan 2010-09-08 06:27:32 UTC
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.
Comment 3 Arun Raghavan 2010-09-08 06:35:37 UTC
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));
Comment 4 Arun Raghavan 2010-09-08 06:36:34 UTC
Caveat: I've not tested this, since I don't have access to a GNOME development stack for ARM.
Comment 5 Stef Walter 2010-09-08 14:46:54 UTC
Thanks. Merged.