Re: Facing an error while compiling for bpf using clang


Tom Stellard
 

On 05/21/2019 08:42 PM, Prashanth Fernando wrote:
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
Which version of clang are you using? It looks like it is missing the bpf
target.

-Tom

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.