Skip to contentSkip to conversation

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

DISCUSSION Timo Juhani Lindfors 2 participants 2 messages Sep 15, 2009 – Sep 16, 2009

lore
Share & tools
lore
#0 lore raw

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

Quoted 7 lines

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

#1 lore raw

Hi,

2009/9/15 Timo Juhani Lindfors <[email protected]>:

Quoted 7 lines
Quoted 7 lines

  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

This was discussed some weeks ago, and that warning is bogus in this case, but there wasn't a clean workaround for it.

Quoted 2 lines

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

First of all, you probably should configure --disable-isimodem, which excludes gisi as well, since the openmoko surely doesn't have a Nokia modem in it. ;)

Also, distributors really should build without maintainer mode, which makes the problem go away. It does suck for us, though, when building in scratchbox armel target.

Cheers,
Aki