Optware / Optware-ng

279 stars 52 forks source link

Some system functions are missing from libc-dev #222

Closed ElTopo closed 6 years ago

ElTopo commented 6 years ago

I have 2 optware-ng systems, they both have the latest libc-dev (1.0.26-3) package installed.

On the arm legacy system, some system functions are missing from libc.a, such as epoll_create1() (defined in <sys/epoll.h>) and inotify_init1() (defined in <sys/inotify.h>); the mips system has these functions.

I have a simple test.c:

#include <sys/epoll.h>
#include <sys/inotify.h>

  int main(int argc, char* argv[])
  {
      int f1 = epoll_create1(0);
      int f2 = inotify_init1(0);
      return 0;
  }

On the arm legacy system:

$ gcc test.c
/tmp/ccqNJlzW.o: In function `main':
test.c:(.text+0x18): undefined reference to `epoll_create1'
test.c:(.text+0x24): undefined reference to `inotify_init1'
collect2: error: ld returned 1 exit status

On the mips system:

# gcc test.c
# 
(i.e., no errors)

On the arm legacey system:

$ nm /opt/lib/libc.a | grep epoll_create
epoll_create.os:
00000000 T epoll_create
$ nm /opt/lib/libc.a | grep inotify_init
00000000 T inotify_init

On the mips system:

#  nm /opt/lib/libc.a | grep epoll_create
epoll_create.os:
00000000 T epoll_create
0000003c T epoll_create1
# nm /opt/lib/libc.a | grep inotify_init
00000000 T inotify_init
0000003c T inotify_init1
alllexx88 commented 6 years ago

Hi,

test.c:(.text+0x18): undefined reference to `epoll_create1'
test.c:(.text+0x24): undefined reference to `inotify_init1'
collect2: error: ld returned 1 exit status

epoll_create1() and inotify_init1() uClibc-ng functions rely on epoll_create1 and inotify_init1 system calls, respectively, but the latter ones aren't available in clean 2.6.22 Linux kernel headers, which are used to build the armv5 legacy feed, so there's nothing I can do here. mipsel feed, on the other hand, uses custom 2.6.22.19 kernel headers from wl500g project (Entware-ng uses the same headers for mipsel), which has these system calls.

P.S. epoll_create1 and inotify_init1 were added to Linux starting from 2.6.27

ElTopo commented 6 years ago

@alllexx88 thanks for the explanation... for now I will replace these functions with supported system calls.