Re: RFC - Raw Kernel Headers -- Compatibility scripts

2006-03-19 Thread DJ Lucas

Jürg Billeter wrote:


Yes, as I've written before, iproute2 is one of the problematic
packages. Besides fixing the includes[1] you need to remove the local
copy of the not sanitized kernel headers, i.e. rm -r include/linux[2]

Jürg

[1] 
http://www.paldo.org/paldo/sources/iproute2/iproute2-2.6.15-060110-linux-glibc-headers-1.patch.bz2
[2] http://www.paldo.org/paldo/specs/iproute2.xml




I'm using with the compat headers (modified from Jurg's version of the 
script) and glibc-2.3.6.  Did not use Jurg's patch, well I did, but came 
across the same types of errors.  After adding net/if.h to ipaddress.c 
and ifstat.c, here is the remaining error.


/usr/include/linux/socket.h:2:2: warning: #warning You should include 
sys/socket.h.  This time I will do it for you. 

ipaddress.c: In function 'print_link_flags':
ipaddress.c:96: error: 'IFF_DYNAMIC' undeclared (first use in this function)
ipaddress.c:96: error: (Each undeclared identifier is reported only once
ipaddress.c:96: error: for each function it appears in.)
make[1]: *** [ipaddress.o] Error 1

IFF_DYNAMIC is not in /usr/include/net/if.h.

The attached patch (please ignore the name, I had already included it in 
my scripts and just overwrote the existing one from Jürg) makes it 
build.  Even though the change is fairly simple, it's not been tested 
yet, and this is also some loss of functionality in comparison to using 
a kernel header (glibc doesn't supprot it however).  Also, no need to 
remove the included kernel headers.  That is the proper placement if a 
package _needs_ kernel headers, correct?


Next error was in sysklogd:

gcc  -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce -DFSSTND 
 -c ksym_mod.cIn file included from ksym_mod.c:97:

module.h:31:24: error: asm/atomic.h: No such file or directory
make: *** [ksym_mod.o] Error 1

I didn't look at the code, a simple sed -i /atomic.h/d module.h 
'fixed' the compilation problem.  Need to double check why it thinks it 
needs atomic.h.


And that's it.  The build completed successfully.

Hope that helps...

-- DJ Lucas

diff -Naur iproute2-2.6.15-060110-orig/ip/ipaddress.c iproute2-2.6.15-060110/ip/ipaddress.c
--- iproute2-2.6.15-060110-orig/ip/ipaddress.c	2005-09-21 19:33:18.0 +
+++ iproute2-2.6.15-060110/ip/ipaddress.c	2006-03-19 16:55:26.0 +
@@ -28,6 +28,7 @@
 #include linux/netdevice.h
 #include linux/if_arp.h
 #include linux/sockios.h
+#include net/if.h
 
 #include rt_names.h
 #include utils.h
@@ -92,7 +93,9 @@
 	_PF(MASTER);
 	_PF(SLAVE);
 	_PF(DEBUG);
+#ifdef IFF_DYNAMIC
 	_PF(DYNAMIC);
+#endif
 	_PF(AUTOMEDIA);
 	_PF(PORTSEL);
 	_PF(NOTRAILERS);
diff -Naur iproute2-2.6.15-060110-orig/misc/ifstat.c iproute2-2.6.15-060110/misc/ifstat.c
--- iproute2-2.6.15-060110-orig/misc/ifstat.c	2005-07-08 22:08:47.0 +
+++ iproute2-2.6.15-060110/misc/ifstat.c	2006-03-19 16:55:50.0 +
@@ -30,6 +30,7 @@
 
 #include libnetlink.h
 #include linux/netdevice.h
+#include net/if.h
 
 #include SNAPSHOT.h
 
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page


Re: RFC - Raw Kernel Headers -- Compatibility scripts

2006-03-19 Thread Jürg Billeter
On Son, 2006-03-19 at 12:28 -0600, DJ Lucas wrote:
 Jürg Billeter wrote:
  
  Yes, as I've written before, iproute2 is one of the problematic
  packages. Besides fixing the includes[1] you need to remove the local
  copy of the not sanitized kernel headers, i.e. rm -r include/linux[2]

 I'm using with the compat headers (modified from Jurg's version of the 
 script) and glibc-2.3.6.  Did not use Jurg's patch, well I did, but came 
 across the same types of errors.  After adding net/if.h to ipaddress.c 
 and ifstat.c, here is the remaining error.
 
 /usr/include/linux/socket.h:2:2: warning: #warning You should include 
 sys/socket.h.  This time I will do it for you. 
 ipaddress.c: In function 'print_link_flags':
 ipaddress.c:96: error: 'IFF_DYNAMIC' undeclared (first use in this function)
 ipaddress.c:96: error: (Each undeclared identifier is reported only once
 ipaddress.c:96: error: for each function it appears in.)
 make[1]: *** [ipaddress.o] Error 1
 
 IFF_DYNAMIC is not in /usr/include/net/if.h.

Well, glibc 2.3.6 is too old, then. The sanitized headers my script
generate are not just generic sanitized kernel headers, they are
specific to glibc and as we've just found out, it only works with 2.4
even.

 [...] Also, no need to 
 remove the included kernel headers.  That is the proper placement if a 
 package _needs_ kernel headers, correct?

Not sure about that. Including kernel headers in a userspace package is
just a convenience that it can be compiled on not up-to-date or
incomplete/broken systems. It probably makes sense to do that for some
packages but there should be a configure check or option to not include
the copies if the system is up-to-date, IMO.

 
 Next error was in sysklogd:
 
 gcc  -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce -DFSSTND 
   -c ksym_mod.cIn file included from ksym_mod.c:97:
 module.h:31:24: error: asm/atomic.h: No such file or directory
 make: *** [ksym_mod.o] Error 1
 
 I didn't look at the code, a simple sed -i /atomic.h/d module.h 
 'fixed' the compilation problem.  Need to double check why it thinks it 
 needs atomic.h.

That's funny; the kernel headers patch I use in paldo is the one you
submitted in 2003 to lfs (origin LSB), and this version works just fine
as it doesn't contain a atomic.h reference :)

Regards,

Jürg

--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page


Re: RFC - Raw Kernel Headers -- Compatibility scripts

2006-03-19 Thread DJ Lucas

Jürg Billeter wrote:

On Son, 2006-03-19 at 12:28 -0600, DJ Lucas wrote:


I'm using with the compat headers (modified from Jurg's version of the 
script) and glibc-2.3.6.  Did not use Jurg's patch, well I did, but came 
across the same types of errors.  After adding net/if.h to ipaddress.c 
and ifstat.c, here is the remaining error.


/usr/include/linux/socket.h:2:2: warning: #warning You should include 
sys/socket.h.  This time I will do it for you. 

ipaddress.c: In function 'print_link_flags':
ipaddress.c:96: error: 'IFF_DYNAMIC' undeclared (first use in this function)
ipaddress.c:96: error: (Each undeclared identifier is reported only once
ipaddress.c:96: error: for each function it appears in.)
make[1]: *** [ipaddress.o] Error 1

IFF_DYNAMIC is not in /usr/include/net/if.h.



Well, glibc 2.3.6 is too old, then. The sanitized headers my script
generate are not just generic sanitized kernel headers, they are
specific to glibc and as we've just found out, it only works with 2.4
even.


Well, specific to what paldo uses, but the package base is large enough 
to catch most, if not all, of what LFS will use too.  For this 
particular situation, I think it's still best (LFS Specific) to wrap it 
in an ifdef rather than pull in something from kernel that glibc doesn't 
know about.





Next error was in sysklogd:

gcc  -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce -DFSSTND 
 -c ksym_mod.cIn file included from ksym_mod.c:97:

module.h:31:24: error: asm/atomic.h: No such file or directory
make: *** [ksym_mod.o] Error 1

I didn't look at the code, a simple sed -i /atomic.h/d module.h 
'fixed' the compilation problem.  Need to double check why it thinks it 
needs atomic.h.



That's funny; the kernel headers patch I use in paldo is the one you
submitted in 2003 to lfs (origin LSB), and this version works just fine
as it doesn't contain a atomic.h reference :)



Well, LFS chose to use the debian patch.  But I believe that include is 
not needed anymore.  According to the comments in ksym_mod.c, it was 
added Jan 10, 1998 to overcome a problem with linux-2.1.18. :-)  This 
was brought up in this thread previously and discussed by Jim, Andy, and 
Alexander IIRC.  Will reply in that part of the thread for the archives.


-- DJ Lucas
--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page


Re: RFC - Raw Kernel Headers -- Compatibility scripts

2006-03-19 Thread DJ Lucas

DJ Lucas wrote:


Jan 10, 1998 to overcome a problem with linux-2.1.18. 
Whoops.  Wrong long entry!  Let me correct that Mar 31, 2004 to correct 
a problem with 2.4 and 2.6.  May still be unneeded.


-- DJ Lucas
--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page


Re: RFC - Raw Kernel Headers -- Compatibility scripts

2006-03-18 Thread Bryan Kadzban
DJ Lucas wrote:
 for FILE in `echo 
 linux/{acct.h,quota.h,resource.h,socket.h,stat.h,time.h,timex.h,un.h,wait.h}`

Er, hang on here -- why are the echo and the backquotes in there?  (I
should note that they're in Jürg's script as well.)  They gain nothing,
and waste at least one process.  (I believe this is one of the Useless
Uses of Backticks, but I could be wrong on that.)

When you use brace expansion, the shell doesn't omit files that don't
exist (like it does when you use pathname expansion, i.e. globbing).  So
the braces get expanded by the shell into:

linux/acct.h linux/quota.h linux/resource.h ...

all the time, whether or not those files exist.  Then the echo runs, as
do the backquotes, and you get this for command out:

for FILE in linux/acct.h linux/quota.h linux/resource.h ...

So there's really no point in having the backquotes or the echo; just
make this be:

for FILE in linux/{acct.h,quota.h,resource.h,...}

And likewise for all the other loops in the script.  That's at least a
little better in terms of number of processes.



signature.asc
Description: OpenPGP digital signature
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page


Re: RFC - Raw Kernel Headers -- Compatibility scripts

2006-03-18 Thread DJ Lucas

Bryan Kadzban wrote:

DJ Lucas wrote:

for FILE in `echo 
linux/{acct.h,quota.h,resource.h,socket.h,stat.h,time.h,timex.h,un.h,wait.h}`



Er, hang on here -- why are the echo and the backquotes in there?  (I
should note that they're in Jürg's script as well.)  They gain nothing,
and waste at least one process.  (I believe this is one of the Useless
Uses of Backticks, but I could be wrong on that.)



Yes.  I hadn't even thought about it. It just copied well from the 
example already available.


-- DJ Lucas
--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page


Re: RFC - Raw Kernel Headers -- Compatibility scripts

2006-03-18 Thread Jürg Billeter
On Fre, 2006-03-17 at 23:37 -0600, DJ Lucas wrote:
 Using the above notes, I've added the following to Jürg's version of the 
   script so to create the 'compatibility' headers.  Of course these 
 could be created once and be copied too...just figured I'd add to the 
 script so no local files must be kept around.  Also, as Alexander 
 mentioned in the other reply to this message, it might be best to just 
 empty linux/compiler.h, as is done with llh instead of erroring out.

I've integrated most of your changes and put it online at
http://www.paldo.org/headers/linux-glibc-headers-20060318
I changed the error messages in linux/compiler.h and linux/config.h to
warnings to really be a compatibility header. I've made the separate
destination tree and tarball generation optional and added support for
version detection with rc kernels. I've also removed the asm-generic
flattening as I don't see any benefit in doing that but maybe there is,
then please explain.

Regards,

Jürg

--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page


Re: RFC - Raw Kernel Headers -- Compatibility scripts

2006-03-18 Thread Jürg Billeter
On Sam, 2006-03-18 at 08:24 -0500, Bryan Kadzban wrote:
 DJ Lucas wrote:
  for FILE in `echo 
  linux/{acct.h,quota.h,resource.h,socket.h,stat.h,time.h,timex.h,un.h,wait.h}`
 
 Er, hang on here -- why are the echo and the backquotes in there?  (I
 should note that they're in Jürg's script as well.)  They gain nothing,
 and waste at least one process.  (I believe this is one of the Useless
 Uses of Backticks, but I could be wrong on that.)

It's right that they gain nothing in the for loops. I've added the
backticks to the REMOVE_HEADERS lines on purpose, though, as the shell
doesn't expand braces when defining variables but probably there is a
better way to get expanded variables, don't know.

Jürg

--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page


Re: RFC - Raw Kernel Headers -- Compatibility scripts

2006-03-18 Thread DJ Lucas

Jürg Billeter wrote:


I've also removed the asm-generic
flattening as I don't see any benefit in doing that but maybe there is,
then please explain.


Not really any benifit other than it was done with previous LLH.  The 
one minor benefit is one less directory.  That's it.  :-)  It adds about 
3 seconds to the runtime of the script (per arch).


-- DJ Lucas
--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page


Re: RFC - Raw Kernel Headers -- Compatibility scripts

2006-03-18 Thread Bryan Kadzban
Jürg Billeter wrote:
 It's right that they gain nothing in the for loops. I've added the 
 backticks to the REMOVE_HEADERS lines on purpose, though, as the
 shell doesn't expand braces when defining variables but probably
 there is a better way to get expanded variables, don't know.

Hmm...  You seem to be correct.  About the only way I can get this to
work without the echo and backticks (or $(...)) is to stick an `eval
echo $REMOVE_HEADERS` as the argument of the rm command.  But that's
not any better, I don't think.  It's too bad that there's no way to tell
the shell to do brace expansion when assigning variables.  (Normally it
does brace expansion before parameter expansion, so there's no way to do
it when substituting the variable back in.)

I suppose you could do:

for file in linux/{acct.h,...} ; do
REMOVE_HEADERS=$REMOVE_HEADERS $file
done

instead of each of your REMOVE_HEADERS=... lines, but that seems more
wasteful somehow.

(Also note that it doesn't seem to be the quotes that prevent the brace
expansion in the first place, it seems to be the variable assignment.
Even if you do a test like:

VAR=x{1,2,3,4,5}

, without the quotes, then when you echo $VAR, you get x{1,2,3,4,5}, not
x1 x2 x3 x4 x5.  So you'd still need the echo for that no matter how you
set up REMOVE_HEADERS.)



signature.asc
Description: OpenPGP digital signature
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page


Re: RFC - Raw Kernel Headers -- Compatibility scripts

2006-03-18 Thread Andrew Benton

Jürg Billeter wrote:

I've integrated most of your changes and put it online at
http://www.paldo.org/headers/linux-glibc-headers-20060318
I changed the error messages in linux/compiler.h and linux/config.h to
warnings to really be a compatibility header.


Thanks Jürg. With that script I made the headers from a 2.6.15 kernel 
(without the compat headers) and the first problem I can see is 
iproute2, it wants linux/socket.h


In file included from ../include/libnetlink.h:5,
 from ll_map.c:23:
../include/linux/netlink.h:4:48: error: linux/socket.h: No such file or 
directory

make[1]: *** [ll_map.o] Error 1

Andy
--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page


Re: RFC - Raw Kernel Headers -- Compatibility scripts

2006-03-18 Thread Jürg Billeter
On Son, 2006-03-19 at 00:31 +, Andrew Benton wrote:
 Jürg Billeter wrote:
  I've integrated most of your changes and put it online at
  http://www.paldo.org/headers/linux-glibc-headers-20060318
  I changed the error messages in linux/compiler.h and linux/config.h to
  warnings to really be a compatibility header.
 
 Thanks Jürg. With that script I made the headers from a 2.6.15 kernel 
 (without the compat headers) and the first problem I can see is 
 iproute2, it wants linux/socket.h
 
 In file included from ../include/libnetlink.h:5,
   from ll_map.c:23:
 ../include/linux/netlink.h:4:48: error: linux/socket.h: No such file or 
 directory
 make[1]: *** [ll_map.o] Error 1

Yes, as I've written before, iproute2 is one of the problematic
packages. Besides fixing the includes[1] you need to remove the local
copy of the not sanitized kernel headers, i.e. rm -r include/linux[2]

Jürg

[1] 
http://www.paldo.org/paldo/sources/iproute2/iproute2-2.6.15-060110-linux-glibc-headers-1.patch.bz2
[2] http://www.paldo.org/paldo/specs/iproute2.xml


--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page


Re: RFC - Raw Kernel Headers -- Compatibility scripts

2006-03-17 Thread DJ Lucas

Jürg Billeter wrote:

On Die, 2006-03-14 at 22:01 +0100, Jürg Billeter wrote:


On Die, 2006-03-14 at 14:10 +0100, Jürg Billeter wrote:


* Verify headers with real applications
  Will do a full distro (800 packages) recompilation with these headers
sometime this week and fix headers resp. applications as necessary



About 700 packages have been built now. Additionally to the already
reported problems I've got two further problematic packages:

- xen: Uses linux/{if.h,ip.h,udp.h} instead of net/if.h,
netinet/{ip.h,udp.h}

- asterisk: Uses linux/compiler.h, include line could just be removed as
linux/ixjuser.h doesn't need the compiler.h defines due to the seds we
apply to the headers




Using the above notes, I've added the following to Jürg's version of the 
 script so to create the 'compatibility' headers.  Of course these 
could be created once and be copied too...just figured I'd add to the 
script so no local files must be kept around.  Also, as Alexander 
mentioned in the other reply to this message, it might be best to just 
empty linux/compiler.h, as is done with llh instead of erroring out.


-- DJ Lucas


# Replace removed kernel headers that have a glibc equivelent.

# /usr/include/sys/*
for FILE in `echo 
linux/{acct.h,quota.h,resource.h,socket.h,stat.h,time.h,timex.h,un.h,wait.h}`

do
GFILE=`echo ${FILE} | sed '[EMAIL PROTECTED]@sys@'`
echo '#if defined(__GNUC__)  !defined(__STRICT_ANSI__)'  ${FILE}
echo #warning \You should include ${GFILE}.  This time I will 
do it for you. \  ${FILE}

echo #endif  ${FILE}
echo #include ${GFILE}  ${FILE}
done

# /usr/include/net/*
for FILE in `echo linux/{if.h,route.h}`
do
GFILE=`echo ${FILE} | sed '[EMAIL PROTECTED]@net@'`
echo '#if defined(__GNUC__)  !defined(__STRICT_ANSI__)'  ${FILE}
echo #warning \You should include ${GFILE}.  This time I will 
do it for you. \  ${FILE}

echo #endif  ${FILE}
echo #include ${GFILE}  ${FILE}
done

# /usr/include/netinet/*
for FILE in `echo linux/{in.h,ip.h,tcp.h,udp.h}`
do
GFILE=`echo ${FILE} | sed '[EMAIL PROTECTED]@netinet@'`
echo '#if defined(__GNUC__)  !defined(__STRICT_ANSI__)'  ${FILE}
echo #warning \You should include ${GFILE}.  This time I will 
do it for you. \  ${FILE}

echo #endif  ${FILE}
echo #include ${GFILE}  ${FILE}
done

# /usr/include/*
for FILE in `echo linux/{dirent.h,elf.h,signal.h,utime.h}`
do
GFILE=`echo ${FILE} | sed '[EMAIL PROTECTED]/@@'`
echo '#if defined(__GNUC__)  !defined(__STRICT_ANSI__)'  ${FILE}
echo #warning \You should include ${GFILE}.  This time I will 
do it for you. \  ${FILE}

echo #endif  ${FILE}
echo #include ${GFILE}  ${FILE}
done

# /usr/include/linux/ax25.h
echo '#if defined(__GNUC__)  !defined(__STRICT_ANSI__)'  linux/ax25.h
echo #warning \You should include netax25/ax25.h. This time I will 
do it for you. \  linux/ax25.h

echo #endif  linux/ax25.h
echo #include netax25/ax25.h  linux/ax25.h

# /usr/include/linux/netrom.h
echo '#if defined(__GNUC__)  !defined(__STRICT_ANSI__)'  linux/netrom.h
echo #warning \You should include netrom/netrom.h. This time I will 
do it for you. \  linux/netrom.h

echo #endif  linux/netrom.h
echo #include netrom/netrom.h  linux/netrom.h

# /usr/include/asm/io.h
echo '#if defined(__GNUC__)  !defined(__STRICT_ANSI__)'  asm/io.h
echo #warning \You should include sys/io.h. This time I will do it 
for you. \  asm/io.h

echo #endif  asm/io.h
echo #include sys/io.h  asm/io.h

# /usr/include/linux/config.h
echo '#error Compilation Aborted!'  linux/config.h
echo '#error Do not include linux/config.h in userspace!'  
linux/config.h


# /usr/include/linux/compiler.h
echo '#error Compilation Aborted!'  linux/compiler.h
echo '#error Do not include linux/compiler.h in userspace!'  
linux/compiler.h



--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page