Skip to content

Commit

Permalink
test/bpf: use gcc to build unit-test
Browse files Browse the repository at this point in the history
With the recent changes in #10703 the dev VM no longer ships a general
purpose `clang` with all targets, but only one with the `bpf` target.
This leads to the build in `test/bpf` to fail:

```
clang -I../../bpf/ -I../../bpf/include -I. -D__NR_CPUS__=2 -O2 -I../../bpf/ unit-test.c -o unit-test
error: unable to create target: 'No available targets are compatible with triple "x86_64-unknown-linux-gnu"'
```

To fix this, use `gcc` to build non-bpf binaries.

Suggested-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
  • Loading branch information
tklauser committed Mar 27, 2020
1 parent 88f11f4 commit 3f4380a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/bpf/Makefile
Expand Up @@ -8,6 +8,7 @@ LIB := $(shell find ../../bpf/ -name '*.h')

CLANG ?= $(QUIET) clang
LLC ?= llc
GCC ?= $(QUIET) gcc

BPF_TARGETS := elf-demo.o
TARGETS := $(BPF_TARGETS) unit-test
Expand All @@ -19,7 +20,7 @@ elf-demo.o: elf-demo.c

%: %.c $(LIB)
@$(ECHO_CC)
$(CLANG) $(FLAGS) -I../../bpf/ $< -o $@
$(GCC) $(FLAGS) -I../../bpf/ $< -o $@

clean:
@$(ECHO_CLEAN)
Expand Down

0 comments on commit 3f4380a

Please sign in to comment.