All of lore.kernel.org
 help / color / mirror / Atom feed
* ofono build error on ARM
@ 2009-07-31 15:13 Andres Salomon
  2009-07-31 15:30 ` Andres Salomon
  2009-08-01  8:14 ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
  0 siblings, 2 replies; 6+ messages in thread
From: Andres Salomon @ 2009-07-31 15:13 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2430 bytes --]

Hi,

I'm seeing the following build error when building ofono on an HTC G1
phone:

gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/glib-2.0
-I/usr/lib/glib-2.0/include -g -O2 -g -Werror -Wextra
-Wno-unused-parameter -Wno-missing-field-initializers
-Wdeclaration-after-statement -Wmissing-declarations -Wredundant-decls
-Wcast-align -MT netlink.lo -MD -MP -MF .deps/netlink.Tpo -c netlink.c
-fPIC -DPIC -o .libs/netlink.o

cc1: warnings being treated as errors
netlink.c: In function ‘g_pn_nl_process’:
netlink.c:75: error: cast increases required alignment of target type
netlink.c:107: error: cast increases required alignment of target type
netlink.c:109: error: cast increases required alignment of target type
make[2]: *** [netlink.lo] Error 1

This is on a Debian lenny system.  The code in question is (for
example):

                for (rta = IFA_RTA(ifa);

Which expands to:

for (rta = 
((struct rtattr*)  ( ((char*)(ifa)) + ( ((sizeof(struct ifaddrmsg))+4 -1) & ~(4 -1) )))
;

I believe the compiler is not liking the cast from char* to rtattr*,
but I'm not certain.

gcc info:

localhost:~/ofono#  gcc -v
Using built-in specs.
Target: arm-linux-gnueabi
Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.2-1.1' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --disable-libssp --disable-sjlj-exceptions --enable-checking=release --build=arm-linux-gnueabi --host=arm-linux-gnueabi --target=arm-linux-gnueabi
Thread model: posix
gcc version 4.3.2 (Debian 4.3.2-1.1) 

localhost:~/ofono# cat /proc/cpuinfo 
Processor	: ARMv6-compatible processor rev 2 (v6l)
BogoMIPS	: 383.38
Features	: swp half thumb fastmult edsp java 
CPU implementer	: 0x41
CPU architecture: 6TEJ
CPU variant	: 0x1
CPU part	: 0xb36
CPU revision	: 2
Cache type	: write-back
Cache clean	: cp15 c7 ops
Cache lockdown	: format C
Cache format	: Harvard
I size		: 32768
I assoc		: 4
I line length	: 32
I sets		: 256
D size		: 32768
D assoc		: 4
D line length	: 32
D sets		: 256

Hardware	: trout
Revision	: 0080
Serial		: 0000000000000000



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ofono build error on ARM
  2009-07-31 15:13 ofono build error on ARM Andres Salomon
@ 2009-07-31 15:30 ` Andres Salomon
  2009-08-01  8:14 ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
  1 sibling, 0 replies; 6+ messages in thread
From: Andres Salomon @ 2009-07-31 15:30 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1045 bytes --]

On Fri, 31 Jul 2009 11:13:10 -0400
Andres Salomon <dilinger@collabora.co.uk> wrote:

> Hi,
> 
> I'm seeing the following build error when building ofono on an HTC G1
> phone:
> 
> gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/glib-2.0
> -I/usr/lib/glib-2.0/include -g -O2 -g -Werror -Wextra
> -Wno-unused-parameter -Wno-missing-field-initializers
> -Wdeclaration-after-statement -Wmissing-declarations -Wredundant-decls
> -Wcast-align -MT netlink.lo -MD -MP -MF .deps/netlink.Tpo -c netlink.c
> -fPIC -DPIC -o .libs/netlink.o
> 
> cc1: warnings being treated as errors
> netlink.c: In function ‘g_pn_nl_process’:
> netlink.c:75: error: cast increases required alignment of target type
> netlink.c:107: error: cast increases required alignment of target type
> netlink.c:109: error: cast increases required alignment of target type
> make[2]: *** [netlink.lo] Error 1
> 

Note that building the file without -Wcast-align fixes the
issue.  Perhaps just that single file should be built without cast
alignment checking?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ofono build error on ARM
  2009-07-31 15:13 ofono build error on ARM Andres Salomon
  2009-07-31 15:30 ` Andres Salomon
@ 2009-08-01  8:14 ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
  2009-08-01 15:06   ` Marcel Holtmann
  1 sibling, 1 reply; 6+ messages in thread
From: =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont @ 2009-08-01  8:14 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1083 bytes --]

Le vendredi 31 juillet 2009 18:13:10 Andres Salomon, vous avez écrit :
> Hi,
>
> I'm seeing the following build error when building ofono on an HTC G1
> phone:
>
> gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/glib-2.0
> -I/usr/lib/glib-2.0/include -g -O2 -g -Werror -Wextra
> -Wno-unused-parameter -Wno-missing-field-initializers
> -Wdeclaration-after-statement -Wmissing-declarations -Wredundant-decls
> -Wcast-align -MT netlink.lo -MD -MP -MF .deps/netlink.Tpo -c netlink.c
> -fPIC -DPIC -o .libs/netlink.o
>
> cc1: warnings being treated as errors
> netlink.c: In function ‘g_pn_nl_process’:
> netlink.c:75: error: cast increases required alignment of target type
> netlink.c:107: error: cast increases required alignment of target type
> netlink.c:109: error: cast increases required alignment of target type
> make[2]: *** [netlink.lo] Error 1

I think there is no way to fix this. It comes from the Netlink packet format 
and macros, which are confusing gcc. That's why I hate to enfore -Werror.

-- 
Rémi Denis-Courmont
http://www.remlab.net/


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ofono build error on ARM
  2009-08-01  8:14 ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
@ 2009-08-01 15:06   ` Marcel Holtmann
  2009-08-01 15:56     ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
  0 siblings, 1 reply; 6+ messages in thread
From: Marcel Holtmann @ 2009-08-01 15:06 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1226 bytes --]

Hi Remi,

> > I'm seeing the following build error when building ofono on an HTC G1
> > phone:
> >
> > gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/glib-2.0
> > -I/usr/lib/glib-2.0/include -g -O2 -g -Werror -Wextra
> > -Wno-unused-parameter -Wno-missing-field-initializers
> > -Wdeclaration-after-statement -Wmissing-declarations -Wredundant-decls
> > -Wcast-align -MT netlink.lo -MD -MP -MF .deps/netlink.Tpo -c netlink.c
> > -fPIC -DPIC -o .libs/netlink.o
> >
> > cc1: warnings being treated as errors
> > netlink.c: In function ‘g_pn_nl_process’:
> > netlink.c:75: error: cast increases required alignment of target type
> > netlink.c:107: error: cast increases required alignment of target type
> > netlink.c:109: error: cast increases required alignment of target type
> > make[2]: *** [netlink.lo] Error 1
> 
> I think there is no way to fix this. It comes from the Netlink packet format 
> and macros, which are confusing gcc. That's why I hate to enfore -Werror.

we only enforce -Werror for the developers and it is important to have
gcc help us catch mistakes that might be easily overlooked. I would have
to look into these one and how we can fix them properly.

Regards

Marcel



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ofono build error on ARM
  2009-08-01 15:06   ` Marcel Holtmann
@ 2009-08-01 15:56     ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
  2009-08-03  7:48       ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
  0 siblings, 1 reply; 6+ messages in thread
From: =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont @ 2009-08-01 15:56 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2075 bytes --]

Le samedi 1 août 2009 18:06:49 Marcel Holtmann, vous avez écrit :
> > > cc1: warnings being treated as errors
> > > netlink.c: In function ‘g_pn_nl_process’:
> > > netlink.c:75: error: cast increases required alignment of target type
> > > netlink.c:107: error: cast increases required alignment of target type
> > > netlink.c:109: error: cast increases required alignment of target type
> > > make[2]: *** [netlink.lo] Error 1
> >
> > I think there is no way to fix this. It comes from the Netlink packet
> > format and macros, which are confusing gcc. That's why I hate to enfore
> > -Werror.
>
> we only enforce -Werror for the developers and it is important to have
> gcc help us catch mistakes that might be easily overlooked.

If I recall correctly, `-Werror' is enforced when maintainer mode is enabled. 
Really, turning off maintainer mode is primilarly useful to binary package 
maintainers who *might* not want to trigger autotools updates. Then again, 
some might waht to have them anyway... I find the underlying assumption to be 
a bit restrictive if not flawed.

> I would have to look into these one and how we can fix them properly.

As far as I understand, those warnings come from casting receive buffers into 
structure with higher-order alignment requirement  - with some of your 
competitors' CPU architectures anyway ;) Arguably, those are caused by 
kernel/libc headers, not Ofono. I will check on Monday if we can fix them by 
promoting the receive buffers to larger integer types, but it might make the 
code worse.

But generally, there remain a problem that some warnings might simply be 
bogus, or not under our control. For instance -outside of Ofono- I'm yet to 
find a way around dummy variable "clobber warnings" when using POSIX thread 
cancellation cleanup handlers. Sure, I could make all variables volatile, but 
I refuse to damage optimizations for the sake of bogus warnings...

The real shame is that -Werror-* is dysfunctional in GCC :(

-- 
Rémi Denis-Courmont
http://www.remlab.net/


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ofono build error on ARM
  2009-08-01 15:56     ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
@ 2009-08-03  7:48       ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
  0 siblings, 0 replies; 6+ messages in thread
From: =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont @ 2009-08-03  7:48 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 731 bytes --]


On Sat, 1 Aug 2009 18:56:54 +0300, "Rémi Denis-Courmont" <remi@remlab.net>
wrote:
> As far as I understand, those warnings come from casting receive buffers
> into structure with higher-order alignment requirement  - with some of
> your competitors' CPU architectures anyway ;) Arguably, those are caused
> by kernel/libc headers, not Ofono. I will check on Monday if we can fix
> them by promoting the receive buffers to larger integer types, but it
might
> make the code worse.

Nope. The problem is that netlink is internally casting pointers to char*
for arithmetic operation, and then back to struct whatever. This confuses
gcc, even though it should be a non-issue at run-time.

-- 
Rémi Denis-Courmont


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-08-03  7:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-31 15:13 ofono build error on ARM Andres Salomon
2009-07-31 15:30 ` Andres Salomon
2009-08-01  8:14 ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2009-08-01 15:06   ` Marcel Holtmann
2009-08-01 15:56     ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2009-08-03  7:48       ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.