This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] uapi glibc compat: fix compile errors when glibc net/if.h included before linux/if.h


From: Mikko Rapeli <mikko.rapeli@iki.fi>
Date: Sun, 24 Apr 2016 17:45:00 +0200

> glibc's net/if.h contains copies of definitions from linux/if.h and these
> conflict and cause build failures if both files are included by application
> source code. Changes in uapi headers, which fixed header file dependencies to
> include linux/if.h when it was needed, e.g. commit 1ffad83d, made the
> net/if.h and linux/if.h incompatibilities visible as build failures for
> userspace applications like iproute2 and xtables-addons.
> 
> This patch fixes compile errors when glibc net/if.h is included before
> linux/if.h:
> 
> ./linux/if.h:99:21: error: redeclaration of enumerator ʽIFF_NOARPʼ
> ./linux/if.h:98:23: error: redeclaration of enumerator ʽIFF_RUNNINGʼ
> ./linux/if.h:97:26: error: redeclaration of enumerator ʽIFF_NOTRAILERSʼ
> ./linux/if.h:96:27: error: redeclaration of enumerator ʽIFF_POINTOPOINTʼ
> ./linux/if.h:95:24: error: redeclaration of enumerator ʽIFF_LOOPBACKʼ
> ./linux/if.h:94:21: error: redeclaration of enumerator ʽIFF_DEBUGʼ
> ./linux/if.h:93:25: error: redeclaration of enumerator ʽIFF_BROADCASTʼ
> ./linux/if.h:92:19: error: redeclaration of enumerator ʽIFF_UPʼ
> ./linux/if.h:252:8: error: redefinition of ʽstruct ifconfʼ
> ./linux/if.h:203:8: error: redefinition of ʽstruct ifreqʼ
> ./linux/if.h:169:8: error: redefinition of ʽstruct ifmapʼ
> ./linux/if.h:107:23: error: redeclaration of enumerator ʽIFF_DYNAMICʼ
> ./linux/if.h:106:25: error: redeclaration of enumerator ʽIFF_AUTOMEDIAʼ
> ./linux/if.h:105:23: error: redeclaration of enumerator ʽIFF_PORTSELʼ
> ./linux/if.h:104:25: error: redeclaration of enumerator ʽIFF_MULTICASTʼ
> ./linux/if.h:103:21: error: redeclaration of enumerator ʽIFF_SLAVEʼ
> ./linux/if.h:102:22: error: redeclaration of enumerator ʽIFF_MASTERʼ
> ./linux/if.h:101:24: error: redeclaration of enumerator ʽIFF_ALLMULTIʼ
> ./linux/if.h:100:23: error: redeclaration of enumerator ʽIFF_PROMISCʼ
> 
> The cases where linux/if.h is included before net/if.h need a similar fix in
> the glibc side, or the order of include files can be changed userspace
> code as a workaround.
> 
> This change was tested in x86 userspace on Debian unstable with
> scripts/headers_compile_test.sh:
> 
> $ make headers_install && \
>   cd usr/include && ../../scripts/headers_compile_test.sh -l -k
> ...
> cc -Wall -c -nostdinc -I /usr/lib/gcc/i586-linux-gnu/5/include -I /usr/lib/gcc/i586-linux-gnu/5/include-fixed -I . -I /home/mcfrisk/src/linux-2.6/usr/headers_compile_test_include.2uX2zH -I /home/mcfrisk/src/linux-2.6/usr/headers_compile_test_include.2uX2zH/i586-linux-gnu -o /dev/null ./linux/if.h_libc_before_kernel.h
> PASSED libc before kernel test: ./linux/if.h
> 
> Reported-by: Jan Engelhardt <jengelh@inai.de>
> Reported-by: Josh Boyer <jwboyer@fedoraproject.org>
> Reported-by: Stephen Hemminger <shemming@brocade.com>
> Reported-by: Waldemar Brodkorb <mail@waldemar-brodkorb.de>
> Cc: Gabriel Laskar <gabriel@lse.epita.fr>
> Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>

Applied and queued up for -stable, t hanks.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]