Unable to build uClibc with _FILE_OFFSET_BITS=64

mail-an-mw123 at gmx.de mail-an-mw123 at gmx.de
Fri Jan 11 08:57:05 UTC 2013


> > Now I set UCLIBC_EXTRA_CFLAGS="-EB" in .config file and used the mipsel
> compiler:
> >
> > $ make CROSS_COMPILE=mipsel-linux- ARCH=mipsel
> >
> > The compilation is not finished completely (please see attached log
> file). The file opendir.c is compiled so I could check that _FILE_OFFSET_BITS
> is also not defined during compilation of opendir.c although LFS is defined
> in .config file.
> 
> the LFS functions live in the 64.o files, see e.g. readdir64.o
I supposed that ;) but I can't find the file opendir64.c?

The root cause I am searching for is related to an error of fstat on a CIFS mounted folder using the option <nounix>. This option causes the kernel to map the server inodes to large values (> 32 bit). Thus the fstat call returns with a <Value too large for defined data type> error. An <ls> call on that folder shows the following syscalls:

/ > ls -la /mnt/test/
ls: can't open '/mnt/test/': Value too large for defined data type

/ > /bin/strace /bin/ls -la /mnt/test/
execve("/bin/ls", ["/bin/ls", "-la", "/mnt/test/"], [/* 7 vars */]) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x4000000, -1, 0) = 0x77afb000
stat("/etc/ld.so.cache", 0x7fe6ebd8)    = -1 ENOENT (No such file or directory)
open("/lib/libcrypt.so.0", O_RDONLY)    = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=11420, ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x4000000, -1, 0) = 0x77afa000
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\10\0\1\0\0\0`\4\0\0004\0\0\0"..., 4096) = 4096
old_mmap(NULL, 147456, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x77ac2000
old_mmap(0x77ac2000, 10020, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x77ac2000
old_mmap(0x77ad4000, 1904, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x2000) = 0x77ad4000
old_mmap(0x77ad5000, 68080, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x77ad5000
close(3)                                = 0
munmap(0x77afa000, 4096)                = 0
open("/lib/libc.so.0", O_RDONLY)        = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=676044, ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x4000000, -1, 0) = 0x77afa000
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\10\0\1\0\0\0p\260\0\0004\0\0\0"..., 4096) = 4096
old_mmap(NULL, 716800, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x77a13000
old_mmap(0x77a13000, 619408, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x77a13000
old_mmap(0x77aba000, 7936, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x97000) = 0x77aba000
old_mmap(0x77abc000, 23084, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x77abc000
close(3)                                = 0
munmap(0x77afa000, 4096)                = 0
open("/lib/libc.so.0", O_RDONLY)        = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=676044, ...}) = 0
close(3)                                = 0
stat("/lib/ld-uClibc.so.0", {st_mode=S_IFREG|0755, st_size=31760, ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x4000000, -1, 0) = 0x77afa000
set_thread_area(0x77b01460)             = 0
mprotect(0x77aba000, 4096, PROT_READ)   = 0
mprotect(0x77afc000, 4096, PROT_READ)   = 0
ioctl(0, TIOCNXCL, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, TIOCNXCL, {B38400 opost isig icanon echo ...}) = 0
getuid()                                = 0
time([352])                             = 352
ioctl(0, 0x40087468, 0x7fe6ed6c)        = 0
lstat64("/mnt/test/", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
brk(0)                                  = 0x485000
brk(0x486000)                           = 0x486000
open("/mnt/test/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
fstat(3, 0x7fe6ebb8)                    = -1 EOVERFLOW (Value too large for defined data type)
close(3)                                = 0
brk(0x487000)                           = 0x487000
brk(0x488000)                           = 0x488000
write(2, "ls: can't open '/mnt/test/': Val"..., 67ls: can't open '/mnt/test/': Value too large for defined data type
) = 67
exit_group(1)                           = ?

Assumed that ls calls opendir, then the 64 bit handling of fstat is missing, right?

> 
> Regarding the ethers compilation error, what kernel-headers do you use
> (grep KERNEL .config)?
I've fixed the kernel source path and can compile uClibc.

BR
Martin


More information about the uClibc mailing list