[yocto] linux/bpf.h: no such file or directory

Maytar Byle maytarb at gmail.com
Thu Jan 17 06:49:25 PST 2019


Hey all,

I've wrote a basic recipe to compile few C files and when i compile it, i
get the above error. I looked in 'sysroots/qemux86-64/usr/include/linux/'
and it contains bpf.h.

The recipe:
SRC_URI = "file://dir"

S = "${WORKDIR}/dir"

do_install() {
    install -d ${D}/home/user/dir

    oe_runmake DESTDIR=${D}/home/user/dir install
}

with the following Makefile:
SRC_FILES := $(wildcard *.c)
OUT_FILES := $(patsubst %.c,%.out,$(SRC_FILES))

all: $(OUT_FILES)

%.out: %.c
gcc -o $@ $^
...

The C file include lines goes as follow:
#include <asm/types.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
....
#include <linux/bpf.h>
#include <linux/filter.h>

When i try to build the image using `bitbake core-image-minimal` i get:
DEBUG: Executing shell function do_compile
NOTE: make -j 6
gcc -o a.out a.c
a.c:78:23: fatal error: linux/bpf.h: No such file or directory
 #include <linux/bpf.h>
                       ^
compilation terminated.
make: *** [a.out] Error 1
WARNING: exit code 1 from a shell command.
ERROR: oe_runmake failed
ERROR: Function failed: do_compile (log file is located at
/yocto/build/tmp/work/core2-64-poky-linux/example/1.0-r0/temp/log.do_compile.26127)

Could also be relevant - entries from my local.conf:
PREFERRED_PROVIDER_virtual/kernel = "linux-yocto"
GCCVERSION ?= "4.9.%"
SDKGCCVERSION ?= "4.9.%"

Also, it is weird for me that it gets to 'linux/bpf.h' before it fails
because it includes files from the linux dir before that.. Can someone shed
some light on that? Any directions i should look into?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20190117/820206c8/attachment.html>


More information about the yocto mailing list