Skip to content

Commit 03e26df

Browse files
committed
Fix build on x86
1 parent 0feb8a3 commit 03e26df

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

Makefile

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: all clean test build-amd64 build-arm64 build-all cross docker-push docker-test-build docker-test-run format local debug bpf-test microbenchmarks test-multi test-pc-real test-pc-mock
1+
.PHONY: all clean test build-amd64 build-arm64 build-all cross docker-push docker-test-build docker-test-run format local debug generate bpf-test microbenchmarks test-multi test-pc-real test-pc-mock
22

33
LIB_NAME = libparcagpucupti.so
44

@@ -115,18 +115,23 @@ microbenchmarks: $(MICROBENCH_BINS)
115115
microbenchmarks/%: microbenchmarks/%.cu
116116
$(NVCC) -g -lineinfo -arch=$(CUDA_ARCH) -o $@ $<
117117

118-
# Build the BPF activity parser test program
118+
# Run go generate for the BPF test program (compiles .bpf.c via bpf2go)
119119
# Requires: clang, libbpf-dev, bpftool (for vmlinux.h), Go 1.21+
120-
bpf-test:
121-
@echo "=== Building BPF activity parser test ==="
120+
generate:
121+
@echo "=== Generating BPF objects ==="
122122
@if [ ! -f test/bpf/vmlinux.h ]; then \
123123
echo "Generating vmlinux.h from kernel BTF..."; \
124124
bpftool btf dump file /sys/kernel/btf/vmlinux format c > test/bpf/vmlinux.h; \
125125
fi
126126
@cd test/bpf && \
127-
export USDT_HEADERS=$$(go mod download github.com/parca-dev/usdt >/dev/null && \
128-
go list -m -f '{{.Dir}}' github.com/parca-dev/usdt)/ebpf && \
129-
go generate ./... && CGO_ENABLED=0 go build -o activity_parser .
127+
USDT_HEADERS=$$(go list -m -f '{{.Dir}}' github.com/parca-dev/usdt)/ebpf && \
128+
export USDT_HEADERS && \
129+
go generate ./...
130+
131+
# Build the BPF activity parser test program
132+
bpf-test: generate
133+
@echo "=== Building BPF activity parser test ==="
134+
@cd test/bpf && CGO_ENABLED=0 go build -o activity_parser .
130135
@echo "BPF test built: test/bpf/activity_parser"
131136

132137
# Run test_cupti_prof and BPF activity parser in parallel.

0 commit comments

Comments
 (0)