Conflicts in kernel 2.6 headers and {glibc,Xorg}
Hello evereyone!
First, I'm not on kernel mailing list so please CC any replies to me. Thank you.
Yesterday I was recompiling my Linux from Scratch distribution for the first time with Linux kernel 2.6.10 headers as a base for glibc. I've found, that glibc (and XOrg later on too) won't compile, as there is a conflict in certain functions or macros that glibc and Kernel headers both define.
One was in asm/bitops.h (strictly speaking, asm-i386/bitops.h) named __ffs, which is defined with unsigned long (both for return type and parameter) in linux kernel, but as int in glibc sources. Others were in asm/system.h. Macro mb() and nop() which conflicts with Xorg sources and with one part of KDE as well (mb() macro and kdepim sources).
Now I am a bit confused. To force my glibc, Xorg and KDE to compile cleanly, I had to rename these in kernel headers in my /usr/include/asm directory, so they are no longer conflicting (which of course breaks the
rest of kernel header files, that use these macros), but since I was
changing only files in /usr/include/asm, it's probably a "no harm done" change, as my Kernel has it's own copy of these files.
My question is: is this a bug in glibc and Xorg sources that they declare macros and functions with the same name as kernel headers? I believe not, as it worked cleanly with kernel 2.4 headers and glibc was first to use these names. :)
Or is it a bug in kernel 2.6 headers, which should be fixed by including these functions and macros into __KERNEL__ block, so they will not collide with userspace sources?
Thanks for reading this to the end... :)
Signature · 2 lines
Michal Feix [email protected]
Quoted 10 lines · Michal Feix
Hello evereyone!
First, I'm not on kernel mailing list so please CC any replies to me. Thank you.
Yesterday I was recompiling my Linux from Scratch distribution for the first time with Linux kernel 2.6.10 headers as a base for glibc. I've found, that glibc (and XOrg later on too) won't compile, as there is a conflict in certain functions or macros that glibc and Kernel headers both define.
Are you using proper kernel headers - from
http://ep09.pld-linux.org/~mmazur/linux-libc-headers/ ?
Signature · 2 lines
Tomasz Torcz "God, root, what's the difference?" [email protected] "God is more forgiving."
Quoted 7 lines
Quoted 3 lines
First, I'm not on kernel mailing list so please CC any replies to me. Thank you.
Yesterday I was recompiling my Linux from Scratch distribution for the first time with Linux kernel 2.6.10 headers as a base for glibc. I've found, that glibc (and XOrg later on too) won't compile, as there is a conflict in certain functions or macros that glibc and Kernel headers both define.
Are you using proper kernel headers - from
http://ep09.pld-linux.org/~mmazur/linux-libc-headers/ ?
No, I am not, because I wasn't told to do so. For meny years I always used vanilla sources from kernel.org for my /usr/include/... I wasn't told, that it is wrong and I still believe, that Linux kernel headers should be fixed by including these conflicting macros and functions into __KERNEL__ block instead. Or am I missing something?
Signature · 1 line
Michal
Quoted 8 lines · Michal Feix
Quoted 2 lines
Are you using proper kernel headers - from
http://ep09.pld-linux.org/~mmazur/linux-libc-headers/ ?No, I am not, because I wasn't told to do so. For meny years I always used vanilla sources from kernel.org for my
/usr/include/... I wasn't told, that it is wrong and I still believe, that Linux kernel headers should be fixed by including these conflicting macros and functions into__KERNEL__block instead. Or am I missing something?
According to Linus, using straight kernel headers for /usr/include
is obsolete for 10 (ten) years now. I do not agree, but kernel developers do.
There was few discussion on this topic. Here's one Linus post:
http://www.ussg.iu.edu/hypermail/linux/kernel/0007.3/0587.html
Here you can find latest thread about fixing this issue:
http://lkml.org/lkml/2004/11/26/106
Mainstream distributions use ,,sanitized'' version o kernel
headers - Fedora has own set, Debian has another, LFS too. For rest and for us, casual users, there are headers made as byproduct of PLD Linux, which are used since december 2003 (before kernel 2.6 was even released).
Cheers,
Signature · 2 lines
Tomasz Torcz Only gods can safely risk perfection, [email protected] it's a dangerous thing for a man. -- Alia
Hi All :)
* Tomasz Torcz <[email protected]> dixit:
Quoted 5 lines
Mainstream distributions use ,,sanitized'' version o kernel
headers - Fedora has own set, Debian has another, LFS too. For rest and for us, casual users, there are headers made as byproduct of PLD Linux, which are used since december 2003 (before kernel 2.6 was even released).
But the set of sanitized kernel headers, if you build your own
software and you're not using a distro, is only available for 2.6.x kernels, not for 2.4.x kernels. What should be done for 2.4 kernels? I currently use a set of headers from the 2.4 kernel I used to build my libc, not the headers from the current kernel I'm running, but I would like to know anyway.
Raúl Núñez de Arenas Coronado
Signature · 3 lines
Linux Registered User 88736 http://www.dervishd.net & http://www.pleyades.net/ It's my PC and I'll cry if I want to...
Quoted 9 lines · DervishD
Hi All :)
* Tomasz Torcz <[email protected]> dixit:
Quoted 5 lines
Mainstream distributions use ,,sanitized'' version o kernel
headers - Fedora has own set, Debian has another, LFS too. For rest and for us, casual users, there are headers made as byproduct of PLD Linux, which are used since december 2003 (before kernel 2.6 was even released).
Quoted 3 lines
But the set of sanitized kernel headers, if you build your own
software and you're not using a distro, is only available for 2.6.x kernels, not for 2.4.x kernels.
The headers RH ships work for both...
Quoted 5 lines
What should be done for 2.4 kernels?
I currently use a set of headers from the 2.4 kernel I used to build my libc, not the headers from the current kernel I'm running, but I would like to know anyway.
.... and you can use 2.6 headers to build a glibc that works excellent for 2.4 kernels too. The kernel API/ABI *does not change on this level* between kernel versions. Things may get added, but they do not change.
Hi Arjan :)
* Arjan van de Ven <[email protected]> dixit:
Quoted 4 lines
Quoted 3 lines
But the set of sanitized kernel headers, if you build your own
software and you're not using a distro, is only available for 2.6.x kernels, not for 2.4.x kernels.The headers RH ships work for both...
Did not know...
Quoted 7 lines
Quoted 4 lines
What should be done for 2.4 kernels?
I currently use a set of headers from the 2.4 kernel I used to build my libc, not the headers from the current kernel I'm running, but I would like to know anyway..... and you can use 2.6 headers to build a glibc that works excellent for 2.4 kernels too. The kernel API/ABI *does not change on this level* between kernel versions. Things may get added, but they do not change.
That's perfect then :))) No problem about the headers then. When
I recompile my glibc I'll pick the latest libc-kernel-headers available. Thanks a lot for the information, Arjan :))
Raúl Núñez de Arenas Coronado
Signature · 3 lines
Linux Registered User 88736 http://www.dervishd.net & http://www.pleyades.net/ It's my PC and I'll cry if I want to...
Quoted 10 lines · Michal Feix
Quoted 10 lines
Quoted 8 lines
First, I'm not on kernel mailing list so please CC any replies to me. Thank you.
Yesterday I was recompiling my Linux from Scratch distribution for the first time with Linux kernel 2.6.10 headers as a base for glibc. I've found, that glibc (and XOrg later on too) won't compile, as there is a conflict in certain functions or macros that glibc and Kernel headers both define.
Quoted 9 lines
Quoted 2 lines
Are you using proper kernel headers - from
http://ep09.pld-linux.org/~mmazur/linux-libc-headers/ ?No, I am not, because I wasn't told to do so. For meny years I always used vanilla sources from kernel.org for my
/usr/include/... I wasn't told, that it is wrong and I still believe, that Linux kernel headers should be fixed by including these conflicting macros and functions into__KERNEL__block instead. Or am I missing something?
I think you'll find these links informative :
http://www.kernelnewbies.org/faq/
- read the section entitled "What's going on with the kernel headers ?"
http://uwsg.iu.edu/hypermail/linux/kernel/0007.3/0587.html
- that's Linus' own explanation of the header issue.
http://groups-beta.google.com/group/linux.kernel/msg/9c467432e123860a?q=kernel+headers+user+space+group:linux.kernel&rnum=2
- a bit more from Linus
Signature · 1 line
Jesper Juhl
Quoted 6 lines · Tomasz Torcz
Quoted 5 lines · Michal Feix
Hello evereyone!
First, I'm not on kernel mailing list so please CC any replies to me. Thank you.
Quoted 8 lines
Quoted 5 lines
Yesterday I was recompiling my Linux from Scratch distribution for the first time with Linux kernel 2.6.10 headers as a base for glibc. I've found, that glibc (and XOrg later on too) won't compile, as there is a conflict in certain functions or macros that glibc and Kernel headers both define.
Are you using proper kernel headers - from
http://ep09.pld-linux.org/~mmazur/linux-libc-headers/ ?
I with 2.6.10 a problem came up that had me looking into this too.
Using gcc 3.3.3, my xfree86 is built from cvs release xf-4_4-branch. When I tried 2.6.10, it built with no problems.
To the best of my knolege, xfree86 is not including any kernel headers, my source is not where any package would know to look and there don't seem to be any distro (woody) kernel header packages installed. I could be wrong, but I don't know where they might be found, or that I ever needed them for this xfree86 build.
The problem is running X, my display is littered with flashing bits, as if the card is rendering some cpu register or bus in 2% of the display.
02:00.0 VGA compatible controller: nVidia Corporation: Unknown device 01f0 (rev a3) (prog-if 00 [VGA])
Flags: bus master, 66Mhz, medium devsel, latency 32, IRQ 16 Memory at ea000000 (32-bit, non-prefetchable) [size=16M] Memory at e0000000 (32-bit, prefetchable) [size=64M] Memory at e4000000 (32-bit, prefetchable) [size=512K] Expansion ROM at <unassigned> [disabled] [size=128K]
Capabilities: [60] Power Management version 2
Capabilities: [44] AGP version 2.0
Is this due to namespace collision? Do I have to take extra precautions with 2.6.10?
// George
Signature · 2 lines
George Georgalis, systems architect, administrator Linux BSD IXOYE http://galis.org/george/ cell:646-331-2027 mailto:[email protected]
Quoted 2 lines · you
Yesterday I was recompiling my Linux from Scratch distribution for the first time with Linux kernel 2.6.10 headers as a base for glibc.
Linux from Scratch uses sanitized headers; if you want to use raw headers, you should be able to solve your own problems.
http://www.lfs-matrix.de/lfs/view/stable/chapter05/linux-libc-headers.html
Chris Lingard