Message ID | 20210506231158.250926-1-yanjun.zhu@intel.com |
---|---|
State | New |
Headers | show |
Series | [1/1] samples: bpf: fix the compiling error | expand |
On Thu, May 6, 2021 at 8:47 AM Zhu Yanjun <yanjun.zhu@intel.com> wrote: > > From: Zhu Yanjun <zyjzyj2000@gmail.com> > > When compiling, the following error will appear. > > " > samples/bpf//xdpsock_user.c:27:10: fatal error: sys/capability.h: > No such file or directory > " On my system, I get a compilation error if I include linux/capability.h as it does not have capget(). NAME capget, capset - set/get capabilities of thread(s) SYNOPSIS #include <sys/capability.h> int capget(cap_user_header_t hdrp, cap_user_data_t datap); Have you installed libcap? It contains the sys/capability.h header file that you need. > Now capability.h is in linux directory. > > Fixes: 3627d9702d78 ("samples/bpf: Sample application for eBPF load and socket creation split") > Signed-off-by: Zhu Yanjun <zyjzyj2000@gmail.com> > --- > samples/bpf/xdpsock_user.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_user.c > index aa696854be78..44200aa694cb 100644 > --- a/samples/bpf/xdpsock_user.c > +++ b/samples/bpf/xdpsock_user.c > @@ -24,7 +24,7 @@ > #include <stdio.h> > #include <stdlib.h> > #include <string.h> > -#include <sys/capability.h> > +#include <linux/capability.h> > #include <sys/mman.h> > #include <sys/resource.h> > #include <sys/socket.h> > -- > 2.27.0 >
On Thu, May 6, 2021 at 3:51 PM Zhu Yanjun <zyjzyj2000@gmail.com> wrote: > > On Thu, May 6, 2021 at 8:54 PM Magnus Karlsson > <magnus.karlsson@gmail.com> wrote: > > > > On Thu, May 6, 2021 at 8:47 AM Zhu Yanjun <yanjun.zhu@intel.com> wrote: > > > > > > From: Zhu Yanjun <zyjzyj2000@gmail.com> > > > > > > When compiling, the following error will appear. > > > > > > " > > > samples/bpf//xdpsock_user.c:27:10: fatal error: sys/capability.h: > > > No such file or directory > > > " > > > > On my system, I get a compilation error if I include > > linux/capability.h as it does not have capget(). > > Thanks. Can you run "rpm -qf /xxx/xxx/sys/capability.h" to check which > software provides sys/capability.h? > Now I am on CentOS Linux release 8.3.2011. I do not have CentOS, but it is likely called libcap-dev or libcap-devel. If that does not work, Google/Baidu it. > Thanks a lot. > Zhu Yanjun > > > > > > NAME > > capget, capset - set/get capabilities of thread(s) > > > > SYNOPSIS > > #include <sys/capability.h> > > > > int capget(cap_user_header_t hdrp, cap_user_data_t datap); > > > > Have you installed libcap? It contains the sys/capability.h header > > file that you need. > > > > > Now capability.h is in linux directory. > > > > > > Fixes: 3627d9702d78 ("samples/bpf: Sample application for eBPF load and socket creation split") > > > Signed-off-by: Zhu Yanjun <zyjzyj2000@gmail.com> > > > --- > > > samples/bpf/xdpsock_user.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_user.c > > > index aa696854be78..44200aa694cb 100644 > > > --- a/samples/bpf/xdpsock_user.c > > > +++ b/samples/bpf/xdpsock_user.c > > > @@ -24,7 +24,7 @@ > > > #include <stdio.h> > > > #include <stdlib.h> > > > #include <string.h> > > > -#include <sys/capability.h> > > > +#include <linux/capability.h> > > > #include <sys/mman.h> > > > #include <sys/resource.h> > > > #include <sys/socket.h> > > > -- > > > 2.27.0 > > >
On Thu, May 6, 2021 at 10:04 PM Magnus Karlsson <magnus.karlsson@gmail.com> wrote: > > On Thu, May 6, 2021 at 3:51 PM Zhu Yanjun <zyjzyj2000@gmail.com> wrote: > > > > On Thu, May 6, 2021 at 8:54 PM Magnus Karlsson > > <magnus.karlsson@gmail.com> wrote: > > > > > > On Thu, May 6, 2021 at 8:47 AM Zhu Yanjun <yanjun.zhu@intel.com> wrote: > > > > > > > > From: Zhu Yanjun <zyjzyj2000@gmail.com> > > > > > > > > When compiling, the following error will appear. > > > > > > > > " > > > > samples/bpf//xdpsock_user.c:27:10: fatal error: sys/capability.h: > > > > No such file or directory > > > > " > > > > > > On my system, I get a compilation error if I include > > > linux/capability.h as it does not have capget(). > > > > Thanks. Can you run "rpm -qf /xxx/xxx/sys/capability.h" to check which > > software provides sys/capability.h? > > Now I am on CentOS Linux release 8.3.2011. > > I do not have CentOS, but it is likely called libcap-dev or > libcap-devel. If that does not work, Google/Baidu it. Thanks. On centos8.3, libcap-devel can be installed by "dnf install libcap-devel". Then this problem is fixed. So please ignore this commit. Zhu Yanjun > > > Thanks a lot. > > Zhu Yanjun > > > > > > > > > > NAME > > > capget, capset - set/get capabilities of thread(s) > > > > > > SYNOPSIS > > > #include <sys/capability.h> > > > > > > int capget(cap_user_header_t hdrp, cap_user_data_t datap); > > > > > > Have you installed libcap? It contains the sys/capability.h header > > > file that you need. > > > > > > > Now capability.h is in linux directory. > > > > > > > > Fixes: 3627d9702d78 ("samples/bpf: Sample application for eBPF load and socket creation split") > > > > Signed-off-by: Zhu Yanjun <zyjzyj2000@gmail.com> > > > > --- > > > > samples/bpf/xdpsock_user.c | 2 +- > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_user.c > > > > index aa696854be78..44200aa694cb 100644 > > > > --- a/samples/bpf/xdpsock_user.c > > > > +++ b/samples/bpf/xdpsock_user.c > > > > @@ -24,7 +24,7 @@ > > > > #include <stdio.h> > > > > #include <stdlib.h> > > > > #include <string.h> > > > > -#include <sys/capability.h> > > > > +#include <linux/capability.h> > > > > #include <sys/mman.h> > > > > #include <sys/resource.h> > > > > #include <sys/socket.h> > > > > -- > > > > 2.27.0 > > > >
diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_user.c index aa696854be78..44200aa694cb 100644 --- a/samples/bpf/xdpsock_user.c +++ b/samples/bpf/xdpsock_user.c @@ -24,7 +24,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sys/capability.h> +#include <linux/capability.h> #include <sys/mman.h> #include <sys/resource.h> #include <sys/socket.h>