Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cross compile systemd : cap_init not found

I am trying to cross compile systemd-213 for ARM and am getting an error during configure

checking for library containing dlsym... -ldl
checking sys/capability.h usability... yes
checking sys/capability.h presence... yes
checking for sys/capability.h... yes
checking linux/btrfs.h usability... no
checking linux/btrfs.h presence... no
checking for linux/btrfs.h... no
checking for library containing clock_gettime... -lrt
checking for library containing cap_init... no
configure: error: *** POSIX caps library not found

I have already cross compiled libcap and added the directory containing the produced libraries to LDFLAGS using -L as verified by echo $LDFLAGS before calling configure.

The error comes from the following line in configure.ac

AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not found])])

I have examined both libcap.a and libcap.so with objdump -t and found the entries for cap_init

00000108 g     F .text  000000b4 cap_init  <- libcap.a
00001240 g     F .text  000000b4 cap_init  <- libcap.so

I don't have much experience with autoconf but I don't see why cap_init cannot be found.

I think I have posted the relevant information but I can give more if needed.

like image 666
DrYap Avatar asked Dec 07 '22 01:12

DrYap


2 Answers

Got the same error too while compiling systemd-204. The solution is to execute:

sudo apt-get install libcap-dev
like image 75
Peter Teoh Avatar answered Dec 27 '22 11:12

Peter Teoh


I had the same problem but I was crosscompiling pulseaudio. The problem was not that libcap.so could not be found; the problem was that libattr.so, needed by libcap.so, could not be found. I saw this in the config.log file. My solution was to add -lattr to the LDFLAGS environment variable before bootstrapping and configuring.

like image 44
Ester Olivella Avatar answered Dec 27 '22 11:12

Ester Olivella