From: Michael R. <re...@eu...> - 2005-05-02 10:45:03
Attachments:
test-i2c.c
|
Hi there, I prepared a superb fully-featured massively complext i2c test program to verify wether I cannot compile it or not. Well, the latter: I can not. I tried on another notebook (debian sarge, too), and I get the same errors. Here's the test program: #include <stdlib.h> #include <stdio.h> #include <linux/i2c.h> int main (int argc, char *argv[]) { printf ("Hello, world\n"); } If any (or all) of you are able to compile this beast, I really wonder what's wrong here. Maybe we should start with comparing the result of the preporocessor stage.... bye, Michael -- Michael Reinelt <re...@eu...> http://home.pages.at/reinelt GPG-Key 0xDF13BA50 ICQ #288386781 |
From: paul k. <pau...@xs...> - 2005-05-02 11:38:05
|
Hi Michael, I haven't tested your test program, but I think it is similar to the test program I started with. I know that you are at least missing the following include. #include <linux/compiler.h> This include is required for i2c.h to compile correctly. It should however be noted that this compiler.h creates different defines based on the fact if it compiling for kernel space or user space. We need to compile for user space. My guess is, that on your system you are somehow by default compiling for kernel space. The problem is I don't know to switch between kernel and user space compilation. Can you send your compile errors? regards, Paul Michael Reinelt wrote: >Hi there, > >I prepared a superb fully-featured massively complext i2c test program >to verify wether I cannot compile it or not. Well, the latter: I can not. > >I tried on another notebook (debian sarge, too), and I get the same errors. > >Here's the test program: > >#include <stdlib.h> >#include <stdio.h> > >#include <linux/i2c.h> > > >int main (int argc, char *argv[]) >{ > printf ("Hello, world\n"); >} > > > > |
From: Michael R. <re...@eu...> - 2005-05-02 15:24:47
Attachments:
test-i2c.error
|
Hi Paul, thanks for your quick response. paul kamphuis schrieb: > I haven't tested your test program, but I think it is similar to the > test program I started with. > I know that you are at least missing the following include. > > #include <linux/compiler.h> ok, I've added this one. But it doesn't help. > This include is required for i2c.h to compile correctly. It should > however be noted that this compiler.h creates different defines based on > the fact if it compiling for kernel space or user space. We need to > compile for user space. My guess is, that on your system you are somehow > by default compiling for kernel space. The problem is I don't know to > switch between kernel and user space compilation. I don't think that I'm compiling for kernel space, especially because of one of the errors i get: /usr/include/linux/list.h:705:2: warning: #warning "don't include kernel headers in userspace" > Can you send your compile errors? Here you are... created only from the preprocessor stage, i.e. gcc -E -o test-i2c.e test-i2c.c 2>test-i2c.error bye, Michael -- Michael Reinelt <re...@eu...> http://home.pages.at/reinelt GPG-Key 0xDF13BA50 ICQ #288386781 |
From: Paul K. <pau...@xs...> - 2005-05-05 13:58:04
|
Hi Michael, >I don't think that I'm compiling for kernel space, especially because of >one of the errors i get: > >/usr/include/linux/list.h:705:2: warning: #warning "don't include kernel >headers in userspace > I still think that somehow you're building for kernel space. The reason for this is the following items in your output: >------------------------------------------------------------------------ > >In file included from /usr/include/linux/sched.h:12, > from /usr/include/linux/module.h:10, > from /usr/include/linux/i2c.h:31, > from test-i2c.c:6: >/usr/include/linux/jiffies.h:385:41: division by zero in #if > > This module.h is only included (on my system) when __KERNEL__ is defined when compiling i2c.h Which version of the kernel headers are you using? That warning message in list.h is on line 713 on my system. On more thing to check is gcc -v -E -dM test-i2c.c > defines-test-i2c.lst gcc -v -E -dM test-i2c.c 2> defines-test-i2c2.lst This list all the defines gcc uses when compiling test-i2c.c. Maybe we can find something there. Just send me the output for comparison. I am going to update to the latest kernel version/headers, see what happens there. Note: I am using linux-headers 2.6.8 and kernel 2.6.10 Can any one explain why this is different :-\ Paul |
From: Michael R. <re...@eu...> - 2005-05-06 07:31:23
|
Hi Paul, > I still think that somehow you're building for kernel space. The reason > for this is the following items in your output: >=20 >> ----------------------------------------------------------------------= -- >> >> In file included from /usr/include/linux/sched.h:12, >> from /usr/include/linux/module.h:10, >> from /usr/include/linux/i2c.h:31, >> from test-i2c.c:6: >> /usr/include/linux/jiffies.h:385:41: division by zero in #if >> =20 >> > This module.h is only included (on my system) when __KERNEL__ is define= d > when compiling i2c.h No, not here: merlin:~ $ more /usr/include/linux/i2c.h /*--------------------------------------------------------------------*/ /* */ /* i2c.h - definitions for the i2c-bus interface */ /* */ /*--------------------------------------------------------------------*/ /* Copyright (C) 1995-2000 Simon G. Vogl This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /*--------------------------------------------------------------------*/ /* With some changes from Ky=F6sti M=E4lkki <km...@cc...> and Frodo Looijaard <fr...@dd...> */ /* $Id: i2c.h,v 1.68 2003/01/21 08:08:16 kmalkki Exp $ */ #ifndef _LINUX_I2C_H #define _LINUX_I2C_H #include <linux/module.h> #include <linux/types.h> #include <linux/i2c-id.h> #include <linux/device.h> /* for struct device */ #include <asm/semaphore.h> There's no #ifdef __KERNEL__ around here... > Which version of the kernel headers are you using? That warning message > in list.h is on line 713 on my system. Line 705 or so here. Ther header files are from a vanilla 2.6.11 kernel > On more thing to check is > gcc -v -E -dM test-i2c.c > defines-test-i2c.lst > gcc -v -E -dM test-i2c.c 2> defines-test-i2c2.lst Too big for the mailing list, I'll send them with a PM to Paul only. I think the i2c.h file from the kernel ist simply not intended for userspace programs... if this is true, we have to create our own i2c.h... bye, Michael --=20 Michael Reinelt <re...@eu...> http://home.pages.at/reinelt GPG-Key 0xDF13BA50 ICQ #288386781 |
From: paul k. <pau...@xs...> - 2005-05-06 07:39:46
|
This is strange. Look what my first part of the i2c.h looks like. /* ------------------------------------------------------------------------- */ /* */ /* i2c.h - definitions for the i2c-bus interface */ /* */ /* ------------------------------------------------------------------------- */ /* Copyright (C) 1995-2000 Simon G. Vogl This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* ------------------------------------------------------------------------- */ /* With some changes from Kyösti Mälkki <km...@cc...> and Frodo Looijaard <fr...@dd...> */ /* $Id: i2c.h,v 1.68 2003/01/21 08:08:16 kmalkki Exp $ */ #ifndef _LINUX_I2C_H #define _LINUX_I2C_H #ifdef __KERNEL__ # include <linux/module.h> # include <linux/types.h> #else # define __KERNEL__ # include <linux/types.h> # undef __KERNEL__ #endif #include <linux/i2c-id.h> #ifdef __KERNEL__ #include <linux/device.h> /* for struct device */ #include <asm/semaphore.h> Same file revision, only different contents. I am now first going to check, if gentoo apply patches to these headers files. This is really strange. Paul Michael Reinelt wrote: >Hi Paul, > > > > >>I still think that somehow you're building for kernel space. The reason >>for this is the following items in your output: >> >> >> >>>------------------------------------------------------------------------ >>> >>>In file included from /usr/include/linux/sched.h:12, >>> from /usr/include/linux/module.h:10, >>> from /usr/include/linux/i2c.h:31, >>> from test-i2c.c:6: >>>/usr/include/linux/jiffies.h:385:41: division by zero in #if >>> >>> >>> >>> >>This module.h is only included (on my system) when __KERNEL__ is defined >>when compiling i2c.h >> >> > >No, not here: > >merlin:~ $ more /usr/include/linux/i2c.h >/*--------------------------------------------------------------------*/ >/* */ >/* i2c.h - definitions for the i2c-bus interface */ >/* */ >/*--------------------------------------------------------------------*/ >/* Copyright (C) 1995-2000 Simon G. Vogl > > This program is free software; you can redistribute it and/or modify > it under the terms of the GNU General Public License as published by > the Free Software Foundation; either version 2 of the License, or > (at your option) any later version. > > This program is distributed in the hope that it will be useful, > but WITHOUT ANY WARRANTY; without even the implied warranty of > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > GNU General Public License for more details. > > You should have received a copy of the GNU General Public License > along with this program; if not, write to the Free Software > Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. > */ >/*--------------------------------------------------------------------*/ > >/* With some changes from Kyösti Mälkki <km...@cc...> and > Frodo Looijaard <fr...@dd...> */ > >/* $Id: i2c.h,v 1.68 2003/01/21 08:08:16 kmalkki Exp $ */ > >#ifndef _LINUX_I2C_H >#define _LINUX_I2C_H > >#include <linux/module.h> >#include <linux/types.h> >#include <linux/i2c-id.h> >#include <linux/device.h> /* for struct device */ >#include <asm/semaphore.h> > >There's no #ifdef __KERNEL__ around here... > > > >>Which version of the kernel headers are you using? That warning message >>in list.h is on line 713 on my system. >> >> >Line 705 or so here. Ther header files are from a vanilla 2.6.11 kernel > > > >>On more thing to check is >>gcc -v -E -dM test-i2c.c > defines-test-i2c.lst >>gcc -v -E -dM test-i2c.c 2> defines-test-i2c2.lst >> >> > >Too big for the mailing list, I'll send them with a PM to Paul only. > >I think the i2c.h file from the kernel ist simply not intended for >userspace programs... if this is true, we have to create our own i2c.h... > > >bye, Michael > > > |
From: Michael R. <re...@eu...> - 2005-05-06 08:00:43
|
Paul, > This is strange. Look what my first part of the i2c.h looks like. > [...] > #ifdef __KERNEL__ > # include <linux/module.h> > # include <linux/types.h> > #else > # define __KERNEL__ > # include <linux/types.h> > # undef __KERNEL__ > #endif > Same file revision, only different contents. Yes, and this contens explains why it works for you. > I am now first going to > check, if gentoo apply patches to these headers files. This is really > strange. I'm shure that there are some patches from gentoo. As I said, my headers are from Linus himself :-), and I did not modify them. I'm afraid we really have to create our own i2c.h... -- Michael Reinelt <re...@eu...> http://home.pages.at/reinelt GPG-Key 0xDF13BA50 ICQ #288386781 |
From: paul k. <pau...@xs...> - 2005-05-06 08:06:30
|
>See attachment. > >I think the i2c.h file from the kernel ist simply not intended for >userspace programs... if this is true, we have to create our own i2c.h... > > >bye, Michael > > > You are right. This is what I found. On the gentoo forum: Hence the two separate sets of header files: 1. system headers in /usr/include, to build software, and 2. current kernel headers in /usr/src/linux, to build the kernel. Some e-mail message from Linus on this: http://www.linuxmafia.com/faq/Kernel/usr-src-linux-symlink.html And the clearest explaination http://linuxfromscratch.org/pipermail/faq/2004-July/000159.html Note the FAQ at the end of this page: I think on gentoo the so called linux-headers are actually the mentioned linux-libc-headers. And on your system the headers are the true kernel headers. The best solution for us right now would be extract what we need from the kernel headers and put it in our own header. And keep track of changes in the kernel on this in the future. Sad but true. Give me a little time to get it done :-) bye, Paul |
From: Michael R. <re...@eu...> - 2005-05-06 08:20:51
|
Hi Paul, > I think on gentoo the so called linux-headers are actually the mentioned > linux-libc-headers. And on your system the headers are the true kernel > headers. I've got libc-headers, too. They differ a bit from the kernel headers (libc headers are from an older kernel), but there's neither a #ifdef __KERNEL__ with i2c.h > The best solution for us right now would be extract what we need from > the kernel headers and put it in our own header. And keep track of > changes in the kernel on this in the future. Sad but true. Right. > Give me a little time to get it done :-) You will do it? Great! We sould change the configure stuff, too. There's no need to check for a "global" i2c.h bye, Michael -- Michael Reinelt <re...@eu...> http://home.pages.at/reinelt GPG-Key 0xDF13BA50 ICQ #288386781 |
From: Luis C. <lfc...@lf...> - 2005-05-02 19:45:22
|
paul kamphuis wrote: > Hi Michael, > > I haven't tested your test program, but I think it is similar to the > test program I started with. > I know that you are at least missing the following include. > > #include <linux/compiler.h> > > This include is required for i2c.h to compile correctly. It should > however be noted that this compiler.h creates different defines based > on the fact if it compiling for kernel space or user space. We need to > compile for user space. My guess is, that on your system you are > somehow by default compiling for kernel space. The problem is I don't > know to switch between kernel and user space compilation. > > Can you send your compile errors? > > regards, > > Paul > Maybe we could provide our own i2c.h helper files, as we do not really need that much info from the I2C subsystem. The main problem would be wether we can accurately detect the presence of the real files... Paul, i'm waiting for your comments on this. Luis |
From: Paul K. <pau...@xs...> - 2005-05-02 22:18:46
|
Hi All, Luis Correia wrote: > > Maybe we could provide our own i2c.h helper files, as we do not really > need that much info from the I2C subsystem. This could be a solution. But it still is strange that there is difference in the preprocessor stage. Different version of gcc maybe? I have to think on what would be needed for this. > The main problem would be wether we can accurately detect the presence > of the real files... > > Paul, i'm waiting for your comments on this. > Actually I was thinking that Michael and I already solved this problem. We recently made changes to the configure.in file to solve this correct include file detection. It should work properly for nearly everyone (only exception is Michael) Michael could you send me a tar of your linux header directory. See if we can figure out if there is a difference in any of the files. Are you sure you have only one copy of i2c.h on your machine? good night, Paul |
From: Michael R. <re...@eu...> - 2005-05-03 07:41:34
|
Hi all, > This could be a solution. But it still is strange that there is > difference in the preprocessor stage. Different version of gcc maybe? > I have to think on what would be needed for this. I tried with gcc-3.3 and gcc-4.0. Same result. > Actually I was thinking that Michael and I already solved this > problem. We recently made changes to the configure.in file to solve > this correct include file detection. It should work properly for > nearly everyone I think the changes to autoconf solved the problem of detecting the presence of i2c header files only. The errors I get are still the same. > (only exception is Michael) No, I'm not. I know at least of one person having the same problems (gipsy, are you listening? :-) > Michael could you send me a tar of your linux header directory. See > if we can figure out if there is a difference in any of the files. Which one do you want? I've got two of'em: one is /usr/include/linux, which comes with glibc, the other one is from vanilla kernel-2.6.11 > Are you sure you have only one copy of i2c.h on your machine? That's what 'find / -name "i2c.h"' gives on my notebook: /usr/include/sound/i2c.h /usr/include/linux.orig/i2c.h /usr/src/linux-2.6/arch/cris/arch-v10/drivers/i2c.h /usr/src/linux-2.6/include/linux/i2c.h /usr/src/linux-2.6/include/sound/i2c.h /usr/src/linux-2.6/include/config/fb/riva/i2c.h /usr/src/linux-2.6/include/config/fb/radeon/i2c.h the /usr/include/linux.orig is the one from glibc, I renamed it and placed a symlink to the original kernel headers there: /usr/include/linux -> /usr/src/linux/include/linux/ bye, Michael -- Michael Reinelt <re...@eu...> http://home.pages.at/reinelt GPG-Key 0xDF13BA50 ICQ #288386781 |