Greetings, I am witnessing a conflict of opinions between /usr/include/sys/types.h and /usr/include/linux/types.h while trying to build a program with gcc (aireplay-ng). It appears that when the /usr/include/sys/types.h header is referenced make fails with errors that the type definitions are already defined (and different) within /usr/include/linux/types.h. Which header is correctly defining the data types? linux/types.h or sys/types.h ... why do they differ? This is occuring on a fully patched OpenSUSE 10.1 box. uname -r output 2.6.16.13-4-default. I have appended the compile failure below, but am not sure how to submit this as a bug (if it is a bug), as gcc bugs are preferred to exclude the headers, but it appears the headers may be the issue. Has anyone else experienced this? How should I proceed? Ryan Compile Failure: ---------------- gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 src/aireplay-ng.c src/common.c -o aireplay-ng In file included from src/aireplay-ng.c:27: /usr/include/sys/types.h:52: error: conflicting types for ‘ino_t’ /usr/include/linux/types.h:24: error: previous declaration of ‘ino_t’ was here /usr/include/sys/types.h:62: error: conflicting types for ‘dev_t’ /usr/include/linux/types.h:23: error: previous declaration of ‘dev_t’ was here /usr/include/sys/types.h:67: error: conflicting types for ‘gid_t’ /usr/include/linux/types.h:53: error: previous declaration of ‘gid_t’ was here /usr/include/sys/types.h:72: error: conflicting types for ‘mode_t’ /usr/include/linux/types.h:25: error: previous declaration of ‘mode_t’ was here /usr/include/sys/types.h:77: error: conflicting types for ‘nlink_t’ /usr/include/linux/types.h:26: error: previous declaration of ‘nlink_t’ was here/usr/include/sys/types.h:82: error: conflicting types for ‘uid_t’ /usr/include/linux/types.h:52: error: previous declaration of ‘uid_t’ was here /usr/include/sys/types.h:90: error: conflicting types for ‘off_t’ /usr/include/linux/types.h:27: error: previous declaration of ‘off_t’ was here In file included from /usr/include/sys/types.h:133, from src/aireplay-ng.c:27: /usr/include/time.h:105: error: conflicting types for ‘timer_t’ /usr/include/linux/types.h:32: error: previous declaration of ‘timer_t’ was hereIn file included from /usr/include/sys/types.h:220, from src/aireplay-ng.c:27: /usr/include/sys/select.h:78: error: conflicting types for ‘fd_set’ /usr/include/linux/types.h:22: error: previous declaration of ‘fd_set’ was here make: *** [aireplay-ng] Error 1
On Tuesday 30 May 2006 21:42, Ryan Kather wrote:
Which header is correctly defining the data types? linux/types.h or sys/types.h ... why do they differ?
linux/types.h contains kernel definitions and shouldn't be used for user space programs. sys/types.h contains the user space version. Somewhere, something is including something it shouldn't, but I can't immediately say what. Off the top of my head I'd say there should be a user space version of linux/if_ether.h, but that's just a first impression The bug is in either the program you're compiling or in glibc-devel. Not in gcc
Thanks for your help! The issue seems to be resolved, but I'm still left with some questions. Responses inline;
Which header is correctly defining the data types? linux/types.h or sys/types.h ... why do they differ?
linux/types.h contains kernel definitions and shouldn't be used for user space programs. sys/types.h contains the user space version. Somewhere, something is including something it shouldn't, but I can't immediately say what.
That sounds logical. I have identified the double inclusion based on your advise and explanation. aireplay-ng.c has an include for linux/rtc.h and linux/if_ether.h and sys/types.h. It appears that if_ether.h references linux/types.h which conflicts with sys/types.h. An aireplay dev has confirmed this to only be an issue on SUSE (to their knowledge), thus far.
Off the top of my head I'd say there should be a user space version of linux/if_ether.h, but that's just a first impression
There is a userspace version at /usr/include/netinet/. I have altered the aireplay source to use userspace versions of all linux/ includes, but compile failed with an error in a function for RTC. Leaving rtc as a linux/ include and changing if_ether to netinet/ has allowed the program to successfully compile.
The bug is in either the program you're compiling or in glibc-devel. Not in gcc
Understood. The aireplay dev has not answered why they are using linux/ includes instead of userspace includes. It definitely seems to matter for RTC, but not for if_ether. I have suggested as best practice they should avoid the kernel includes. However, I am a little perplexed as to why that code works fine on Fedora, Ubuntu, Gentoo, etc.. but not SUSE. At that level it must be differences in kernel versions... Is this still an issue? Are there logical reasons to goto kernel includes ever from a userspace program? If not, I would say it's aireplay's issue and chalk it up as a fluke that it works most of the time on most distros. If so and they have a justification for using the kernel includes why doesn't the error occur on other distros? What is SUSE doing differently? Ryan
On Tue, 30 May 2006, Ryan Kather <rkather@missionpenguin.com> wrote:- <snip>
aireplay-ng.c has an include for linux/rtc.h and linux/if_ether.h and sys/types.h. It appears that if_ether.h references linux/types.h which conflicts with sys/types.h. An aireplay dev has confirmed this to only be an issue on SUSE (to their knowledge), thus far.
And only on 10.1. I've built the packages for SUSE 9.0 to 10.0, and those build properly. Only with 10.1 was there a problem which failed to build.
Off the top of my head I'd say there should be a user space version of linux/if_ether.h, but that's just a first impression
There is a userspace version at /usr/include/netinet/. I have altered the aireplay source to use userspace versions of all linux/ includes, but compile failed with an error in a function for RTC. Leaving rtc as a linux/ include and changing if_ether to netinet/ has allowed the program to successfully compile.
Thanks. I hadn't had the time to sit down and figure out what was wrong. <Snip>
The aireplay dev has not answered why they are using linux/ includes instead of userspace includes. It definitely seems to matter for RTC, but not for if_ether. I have suggested as best practice they should avoid the kernel includes. However, I am a little perplexed as to why that code works fine on Fedora, Ubuntu, Gentoo, etc.. but not SUSE.
Having built the package on all the SUSE versions from 9.0, my guess would be something to do with the difference in glibc versions. All the versions that previously built without changes were using glibc 2.3.x whereas 10.1 is using 2.4. Not having systems running the other distros, I'd hazard a guess that they may still be using 2.3.x. Regards, David Bolt -- Member of Team Acorn checking nodes at 50 Mnodes/s: http://www.distributed.net/ AMD1800 1Gb WinXP/SUSE 9.3 | AMD2400 256Mb SuSE 9.0 | A3010 4Mb RISCOS 3.11 AMD2400(32) 768Mb SUSE 10.0 | Falcon 14Mb TOS 4.02 | A4000 4Mb RISCOS 3.11 AMD2600(64) 512Mb SUSE 10.0 | | RPC600 129Mb RISCOS 3.6 -- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
participants (3)
-
Anders Johansson
-
David Bolt
-
Ryan Kather