dylanaraps / community

KISS - Community Repository (temporarily closed for maintenance)
https://k1ss.org
MIT License
111 stars 91 forks source link

libcap: latest version fails to build #495

Closed a-schaefers closed 4 years ago

a-schaefers commented 4 years ago

I am currently unable to bump libcap from 2.32 to 2.33

I suspect undefined reference to pthread_yield is the problem, it seems to build fine with make, but on the second make is failing on a test. And from some googling, it seems that we may be able to patch it to use sched_yield instead

psx_test.c: In function ‘say_hello_expecting’:
psx_test.c:17:34: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘pthread_t’ {aka ‘struct __pthread *’} [-Wformat=]
   17 |     printf("hello [%d], %s<%d> %lx (keepcaps=%d vs. want=%d)\n",
      |                                ~~^
      |                                  |
      |                                  long unsigned int
   18 |     getpid(), title, n, pthread_self(), keeper, kept);
      |                         ~~~~~~~~~~~~~~
      |                         |
      |                         pthread_t {aka struct __pthread *}
psx_test.c:20:34: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘pthread_t’ {aka ‘struct __pthread *’} [-Wformat=]
   20 |  printf("--> FAILURE %s thread=%lx has wrong keepcaps: got=%d want=%d\n",
      |                                ~~^
      |                                  |
      |                                  long unsigned int
   21 |         title, pthread_self(), keeper, kept);
      |                ~~~~~~~~~~~~~~     
      |                |
      |                pthread_t {aka struct __pthread *}
psx_test.c: In function ‘say_hello_expecting’:
psx_test.c:17:34: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘pthread_t’ {aka ‘struct __pthread *’} [-Wformat=]
   17 |     printf("hello [%d], %s<%d> %lx (keepcaps=%d vs. want=%d)\n",
      |                                ~~^
      |                                  |
      |                                  long unsigned int
   18 |     getpid(), title, n, pthread_self(), keeper, kept);
      |                         ~~~~~~~~~~~~~~
      |                         |
      |                         pthread_t {aka struct __pthread *}
psx_test.c:20:34: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘pthread_t’ {aka ‘struct __pthread *’} [-Wformat=]
   20 |  printf("--> FAILURE %s thread=%lx has wrong keepcaps: got=%d want=%d\n",
      |                                ~~^
      |                                  |
      |                                  long unsigned int
   21 |         title, pthread_self(), keeper, kept);
      |                ~~~~~~~~~~~~~~     
      |                |
      |                pthread_t {aka struct __pthread *}
/usr/lib/gcc/x86_64-pc-linux-musl/9.2.0/../../../../x86_64-pc-linux-musl/bin/ld: /home/foo/.cache/kiss/build-1757/libcap/tests/../libcap/libpsx.a(psx.o): in function `__psx_syscall':
/home/foo/.cache/kiss/build-1757/libcap/libcap/psx.c:536: 
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:35: libcap_psx_test] Error 1
make[1]: *** Waiting for unfinished jobs....
/usr/lib/gcc/x86_64-pc-linux-musl/9.2.0/../../../../x86_64-pc-linux-musl/bin/ld: /home/foo/.cache/kiss/build-1757/libcap/tests/../libcap/libpsx.a(psx.o): in function `__psx_syscall':
/home/foo/.cache/kiss/build-1757/libcap/libcap/psx.c:536: undefined reference to `pthread_yield'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:26: psx_test] Error 1
/usr/lib/gcc/x86_64-pc-linux-musl/9.2.0/../../../../x86_64-pc-linux-musl/bin/ld: /home/foo/.cache/kiss/build-1757/libcap/tests/../libcap/libpsx.a(psx.o): in function `__psx_syscall':
/home/foo/.cache/kiss/build-1757/libcap/libcap/psx.c:536: undefined reference to `pthread_yield'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:29: psx_test_wrap] Error 1
make[1]: Leaving directory '/home/foo/.cache/kiss/build-1757/libcap/tests'
make: *** [Makefile:13: all] Error 2
-> libcap Build failed
-> libcap Log stored to /home/foo/.cache/kiss/logs/libcap-2020-03-02-21:44-1757
a-schaefers commented 4 years ago

I made a patch for it https://github.com/kisslinux/community/pull/496