LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-23-2007, 07:58 AM   #1
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
gcc compilation fails due to __KERNEL__ macro in mod_devicetable.h and linux/types.h


Hello!
Currently compilation of some packages (libsvga-1.4.3, dosemu 1.2.2) fails with errors in /include/mod_devicetable.h. Error messages sounds like "295: error: storage size of 'swbit" is not known" and "error: syntax error before '__u32'". I'm using Slackware 11 with 2.6.17.13 kernel. Those errors appear when program (the one that doesn't compile) use #include <pci.h>. Upon closer examination it look like problems are caused by those lines in mod_devicetable.h:
Code:
#ifndef LINUX_MOD_DEVICETABLE_H
#define LINUX_MOD_DEVICETABLE_H

#ifdef __KERNEL__
#include <linux/types.h>
typedef unsigned long kernel_ulong_t;
#endif
compilation most likely fails because __u16 and __u32 types are declared in <linux/types.h> (actually they are defined in <linux/config.h> which is #include'd in <linux/types.h>). But __KERNEL__ macro isn't defined at compile time.

The questions are:
1)I could just comment out __KERNEL__ lines, but wouldn't that break something somewhere else? Or must I just fix every program that use <pci.h>?
2)Is this behavior "normal"? (i've rebuilt kernel recently and I'm not sure if I didn't break something somewhere).

Last edited by ErV; 03-23-2007 at 08:00 AM.
 
Old 03-25-2007, 08:07 AM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
Don't define __KERNEL__. It would include too many differet things you do not want. Instead, add #include <linux/types.h> to the files with #include <pci.h> (before that pci includes).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
lighttpd fails due to installation in different directories i.you Linux - Software 0 03-07-2007 03:30 AM
have gcc compilation error during gcc installtion in linuxfromscratch vbshanmugaprakash Linux - General 3 12-13-2006 05:52 AM
C-cpp forgets to remove gcc-keywords and to expand __restrict-macro bramadams Fedora 0 02-11-2005 04:53 AM
Mplayer compilation problem on linux 2.6.3 gcc 3.3.3 glibc 2.3.2 realloc Linux - Software 4 10-22-2004 03:44 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration