Bug 1381

Summary: busybox does not build because of missing fcntl64 symbol
Product: uClibc Reporter: Abdoulaye Walsimou Gaye <walsimou>
Component: Shared Library SupportAssignee: unassigned
Status: RESOLVED WORKSFORME    
Severity: minor CC: raj.khem, rob, uclibc-cvs
Priority: P5    
Version: 0.9.31   
Target Milestone: 0.9.32   
Hardware: PC   
OS: Linux   
Host: Target: mips64 little
Build:
Attachments: uClibc .config file

Description Abdoulaye Walsimou Gaye 2010-03-21 15:02:05 UTC
Created attachment 1351 [details]
uClibc .config file

When trying to build busybox for mips64el, against git HEAD, I had the following build error:
==========
archival/lib.a(bbunzip.o): In function `bbunpack':
bbunzip.c:(.text.bbunpack+0x1f8): warning: the use of OBSOLESCENT `utime' is discouraged, use `utimes'
networking/lib.a(ipcalc.o): In function `ipcalc_main':
ipcalc.c:(.text.ipcalc_main+0x350): warning: gethostbyaddr is obsolescent, use getaddrinfo() instead.
libbb/lib.a(inet_common.o): In function `INET_resolve':
inet_common.c:(.text.INET_resolve+0x70): warning: gethostbyname is obsolescent, use getnameinfo() instead.
libbb/lib.a(xfuncs.o): In function `close_on_exec_on':
xfuncs.c:(.text.close_on_exec_on+0xc): undefined reference to `fcntl64'
libbb/lib.a(xfuncs.o): In function `ndelay_off':
xfuncs.c:(.text.ndelay_off+0x14): undefined reference to `fcntl64'
xfuncs.c:(.text.ndelay_off+0x34): undefined reference to `fcntl64'
libbb/lib.a(xfuncs.o): In function `ndelay_on':
xfuncs.c:(.text.ndelay_on+0x14): undefined reference to `fcntl64'
xfuncs.c:(.text.ndelay_on+0x2c): undefined reference to `fcntl64'
loginutils/lib.a(getty.o):getty.c:(.text.getty_main+0x2f8): more undefined references to `fcntl64' follow
collect2: ld returned 1 exit status
make[3]: *** [busybox_unstripped] Error 1


This seems to be same error as Rob Landley[1], but against nptl.
See attachment for uClibc .config

[1] http://www.mail-archive.com/uclibc@uclibc.org/msg04792.html
Thanks,
Comment 1 Khem Raj 2010-03-22 07:12:28 UTC
can you also attach preprocessed output of libbb/xfuncs.c please ?
It seems fcntl is defined to fcntl64 for some reason but the syscall is 
missing hence uclibc does not have the function for it. it will help
if you can attach the preprocessed file. 
Comment 2 Abdoulaye Walsimou Gaye 2010-03-28 17:43:18 UTC
Khem,
preprocessed output of libbb/xfuncs.c sent directly to you, beacuse buzilla (due to its size) and uclibc ML moderator reject it.
Comment 3 Rob Landley 2010-04-17 09:11:54 UTC
The x86_64 headers for uClibc have include/fcntl.h as:

#ifndef __USE_FILE_OFFSET64
extern int fcntl (int __fd, int __cmd, ...);
libc_hidden_proto(fcntl)
#else
# ifdef __REDIRECT
extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...), fcntl64);
# else
#  define fcntl fcntl64
# endif
#endif
#ifdef __USE_LARGEFILE64
extern int fcntl64 (int __fd, int __cmd, ...);
libc_hidden_proto(fcntl64)
#endif

Either the REDIRECT or the #define fcntl fcntl64 might have something to do with it.  Just a thought.
Comment 4 Rob Landley 2010-04-17 19:55:50 UTC
And while we're at it, libc/sysdeps/linux/common/__syscall_fcntl.c:

#if ! defined __NR_fcntl64 && defined __UCLIBC_HAS_LFS__
strong_alias(fcntl,fcntl64)
#endif

Which direction should that go in?  Is the new symlink the first or the second argument?  I'll try swapping 'em...

  CC libc/sysdeps/linux/common/__syscall_fcntl64.os
libc/sysdeps/linux/common/__syscall_fcntl.c:49: error: redefinition of 'fcntl'
libc/sysdeps/linux/common/__syscall_fcntl.c:20: error: previous definition of 'fcntl' was here

Ok, that wasn't it.

I have no idea how this build system works.  It's far more complicated than it has any obvious reason to be.
Comment 5 Bernhard Reutner-Fischer 2012-04-18 16:43:31 UTC
This works fine with 0.9.33.1 or later.