Bug 76822 - failed to build on ARM, MIPS, SPARC: error: cast increases required alignment of target type [-Werror=cast-align]
Summary: failed to build on ARM, MIPS, SPARC: error: cast increases required alignment...
Status: RESOLVED FIXED
Alias: None
Product: nice
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Dafydd Harries
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-31 08:38 UTC by Simon McVittie
Modified: 2014-03-31 22:34 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon McVittie 2014-03-31 08:38:10 UTC
From Debian's armel (ARMv4t EABI softfloat) build log <https://buildd.debian.org/status/fetch.php?pkg=libnice&arch=armel&ver=0.1.5-1&stamp=1395857260>:

libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I.. -D_FORTIFY_SOURCE=2 -std=gnu99 -DG_LOG_DOMAIN=\"libnice-stun\" -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_30 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_36 -fno-strict-aliasing -Wall -Wextra -Wundef -Wnested-externs -Wwrite-strings -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wno-unused-parameter -Wno-missing-field-initializers -Wdeclaration-after-statement -Wformat=2 -Wold-style-definition -Wcast-align -Wformat-nonliteral -Wformat-security -Wsign-compare -Wstrict-aliasing -Wshadow -Winline -Wpacked -Wmissing-format-attribute -Wmissing-noreturn -Winit-self -Wredundant-decls -Wmissing-include-dirs -Wunused-but-set-variable -Warray-bounds -Wswitch-enum -Wswitch-default -Waggregate-return -Werror -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -c stunmessage.c  -fPIC -DPIC -o .libs/stunmessage.o
stunmessage.c: In function 'stun_message_find_addr':
stunmessage.c:242:35: error: cast increases required alignment of target type [-Werror=cast-align]
         struct sockaddr_in *ip4 = (struct sockaddr_in *)addr;
                                   ^
stunmessage.c:262:36: error: cast increases required alignment of target type [-Werror=cast-align]
         struct sockaddr_in6 *ip6 = (struct sockaddr_in6 *)addr;
                                    ^
stunmessage.c: In function 'stun_message_append_addr':
stunmessage.c:439:41: error: cast increases required alignment of target type [-Werror=cast-align]
         const struct sockaddr_in *ip4 = (const struct sockaddr_in *)addr;
                                         ^
stunmessage.c:449:42: error: cast increases required alignment of target type [-Werror=cast-align]
         const struct sockaddr_in6 *ip6 = (const struct sockaddr_in6 *)addr;

Similar errors can be seen on the other 32-bit architectures, other than i386 and powerpc which presumably have less strict alignment requirements: armhf (32-bit ARM EABI hardfloat), mips (32-bit MIPS big-endian), mipsel (32-bit MIPS little-endian) and sparc (32-bit SPARC).

All logs:
<https://buildd.debian.org/status/package.php?p=libnice>
Comment 1 Simon McVittie 2014-03-31 08:41:52 UTC
I think this might only be a build failure (and not just a warning) because

    LIBNICE_RELEASE="no"

was not changed to "yes" in configure.ac when doing the 0.1.5 release.

I don't know whether the warnings also indicate a real bug, though.
Comment 2 Olivier Crête 2014-03-31 15:09:45 UTC
I indeed forgot it. Should probably use a union anyway, I assume the compiler doesn't create these warnings for no reason. Can you try to put the RELEASE flag to true, and send it through the debian build system so we can find all of them?
Comment 3 Olivier Crête 2014-03-31 22:34:04 UTC
This should also be fixed by using struct sockaddr_storage more liberally.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.