git.iko.soy/typeable/nixpkgs
on master help sign in
libselinux: Fix ARM build failure

Avoid this warning (which is in turn an error via -Werror): ```` avc_internal.c: In function 'avc_netlink_receive': avc_internal.c:105:25: error: cast increases required alignment of target type [-Werror=cast-align] struct nlmsghdr *nlh = (struct nlmsghdr *)buf; ^ ```` The code allocates abuffer with "__attribute__ ((aligned))", then passes it via a 'char*' parameter, which is then finally cast, causing the warning. So the code is ok but compiler is not smart enough to see it. It seems that -Wcast-align is a no-op on x86, so this shows up on ARM only.

commitba42683e9afd8f3195d2c9659bb5f9f368ea0560 authorTuomas Tynkkynen <tuomas@tuxera.com> dateTue 18 Oct 2016, 23:41 (10 years ago) parent0240306
1 file changed+7−1
pkgs/os-specific/linux/libselinux/default.nix+7−1
pkgs/os-specific/linux/libselinux/default.nix+7−1
@@ -19,7 +19,13 @@ stdenv.mkDerivation rec {
1919 buildInputs = [ pkgconfig libsepol pcre ]
2020 ++ optionals enablePython [ swig python ];
2121
22− NIX_CFLAGS_COMPILE = "-fstack-protector-all -std=gnu89";
22+ # Avoid this false warning:
23+ # avc_internal.c: In function 'avc_netlink_receive':
24+ # avc_internal.c:105:25: error: cast increases required alignment of target type [-Werror=cast-align]
25+ # struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
26+ # ^
27+
28+ NIX_CFLAGS_COMPILE = "-std=gnu89 -Wno-error=cast-align";
2329
2430 # Unreleased upstream patch that fixes Python package issue arising
2531 # from recent SWIG changes.