Facing an error while compiling for bpf using clang


Prashanth Fernando
 

Hi, 

I'm new to XDP, I am trying to compile a simple code to start with.
When I compile with clang, I face an error. Can someone please help me out in resolving this issue.

# clang -target bpf -c drop.c -o drop.o
error: unknown target triple 'bpf', please use -triple or -arch

OS: CentOS 7
Updated Kernel:
# uname -msr
Linux 5.1.3 x86_64

Built the kernel with the following flags on:
CONFIG_CGROUP_BPF=y
CONFIG_BPF=y
CONFIG_BPF_SYSCALL=y
CONFIG_BPF_JIT_ALWAYS_ON=y
CONFIG_NETFILTER_XT_MATCH_BPF=m
CONFIG_BPFILTER=y
CONFIG_BPFILTER_UMH=m
CONFIG_NET_CLS_BPF=m
CONFIG_NET_ACT_BPF=m
CONFIG_BPF_JIT=y
CONFIG_BPF_STREAM_PARSER=y
CONFIG_LWTUNNEL_BPF=y
CONFIG_HAVE_EBPF_JIT=y
CONFIG_BPF_EVENTS=y
CONFIG_BPF_KPROBE_OVERRIDE=y
CONFIG_TEST_BPF=m

I am not sure what I am missing still.

Join iovisor-dev@lists.iovisor.org to automatically receive all group messages.