Sunday, December 28, 2008

glibc doesn't build with linux-header-2.6.28 on loongson

Update: It is said that this problem has already been fixed. I will test it later.

Actually I intended to send this to LKML, but just before I was about to send I found there was already some discussions about this . So instead I decided to just post it here.

To make long story short, please take a look at these two files first:

The first file, which will become part of /usr/include/endian.h. This file defines both __LITTLE_ENDIAN and __BIG_ENDIAN. And this file will be included by the second file.

The second file, which will be /usr/include/linux/byteorder.h

Obviously, this test in the second file will fail:
#if defined(__LITTLE_ENDIAN) && defined(__BIG_ENDIAN)
# error Fix asm/byteorder.h to define one endianness
#endif
It seems that there is an inconsistency between Linux and glibc on handling __LITTLE_ENDIAN and __BIG_ENDIAN. Linux treats them like a flag, while glibc treats them like a value. glibc uses __BYTE_ORDER to determine the endianness.

This problem must be solved, or any userland program including kernel headers which include {asm,linux}/byteorder.h will fail to build, e.g. glibc.

It seems to me that the most straight forward way, but also very intrusive way is to make the handling of these two marco consistent in the two projects. That'll be a very large changeset. Also it will suddenly change a convention in a project that has already been followed for a long time. So I don't think people will accept this.

How this problem will be solved is still remained to be seen.

EDIT: someone reported that it worked well on ~amd64. So I modified the title and removed the last sentence. I will see if this problem still exists on my x86 notebook.

EDIT 2: I confirm that this problem does not exists on x86. I will find out what exactly is going on loongson, or rather mips. :)

Labels: ,

7 Comments:

Anonymous Anonymous said...

Something must have been patched somewhere, as yesterday's Gentoo updates brought me both glibc-2.9_p20081201-r1 and linux-headers-2.6.28, with, according to the date on my binpkgs, linux-headers packaged and merged 12 minutes before glibc, so glibc used the .28 linux-headers and merged just fine. ~amd64, FWIW.

Duncan

12/29/2008 12:10 AM  
Blogger Zhang Le said...

Thanks, I will test it on my x86 notebook. I have only tested it on my loongson 2f box so far.

12/29/2008 12:22 AM  
Blogger Zhang Le said...

Thank you, Duncan!

12/29/2008 1:43 AM  
Blogger Dao Rex said...

今天才看到。
一直不知道哪里可以获得关于gentoo的动态,三天前使用~amd64编译不过,总是提示glibc编译错误(或是glib?),我不大懂编程,这类错误只能白眼,结果系统安不下去,无奈在磁盘上划了一个lv把archlinux装上了。现在问题解决没有?

1/03/2009 10:34 PM  
Blogger Zhang Le said...

@Rex, please pay attention to previous comments. This problem doesn't exist on amd64.

Plus, you need to be very specific about the name of the package when reporting bugs. "glibc" or "glib" is unacceptable.

As to the problem itself, I have started to look at it yet.

1/03/2009 11:34 PM  
Blogger daniel said...

你好, 张先生, 我使用Gentoo已经有4年多, 最初从rh9转过来至现在, 我希望能够在工作空闲时间为社区做一些事情, 但不知道如何联系. 前几周在GWN中, kernel team提到需要人手, 我的申请由于人数太多被婉拒, 希望你可以给我一些建议. 我是一个c++程序员, 有python的经验.

1/13/2009 11:00 AM  
Blogger Zhang Le said...

http://www.gentoo.org/proj/en/devrel/staffing-needs/

please take a look here

1/13/2009 12:06 PM  

Post a Comment

Links to this post:

Create a Link

<< Home