netlink.c:97: error: cast increases required alignment of target type

Timo Juhani Lindfors timo.lindfors at iki.fi
Tue Sep 15 11:36:51 PDT 2009


Hi,

git clone git://git.kernel.org/pub/scm/network/ofono/ofono.git
cd ofono
./bootstrap
./configure --enable-debug --prefix=/home/lindi/install --enable-maintainer-mode --mandir=/home/lindi/install/usr/share/man --sysconfdir=/home/lindi/install/etc --localstatedir=/home/lindi/install/var --disable-datafiles
make

fails with

>   CC     gdbus/watch.o
>   CC     gisi/netlink.o
> cc1: warnings being treated as errors
> gisi/netlink.c: In function 'g_pn_nl_process':
> gisi/netlink.c:97: error: cast increases required alignment of target type
> gisi/netlink.c:129: error: cast increases required alignment of target type
> gisi/netlink.c:130: error: cast increases required alignment of target type

on armel (openmoko gta02) debian unstable system with gcc 4:4.3.3-9
apparently since in mainstainer mode -Wcast-align complains about

#define NLMSG_NEXT(nlh,len)      ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \
                                  (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)))

which is defined in /usr/include/linux/netlink. I don't know how to
best fix this. The options that I see are

1) Add

pragma GCC diagnostic warning "-Wcast-align"

to ignore the issue in the four affected files: gisi/client.c gisi/iter.c gisi/netlink.c gisi/socket.c

2) Disable -Wcast-alignt checks completely even in maintainer mode (not very nice)

3) Include a fixed version of NLMSG_ALIGN (and also send it usptream of course).


best regards,
Timo Lindfors


More information about the ofono mailing list