libbpfgo icon indicating copy to clipboard operation
libbpfgo copied to clipboard

Building static libbpfgo fails in Makefile running in v0.2.5: /usr/bin/ld cannot found lXX

Open zbh255 opened this issue 3 years ago • 4 comments

Run command make -C selftest/perfbuffers or make selftest-static-run

Out Error

/usr/lib/golang/pkg/tool/linux_amd64/link: running clang failed: exit status 1
/usr/bin/ld: cannot found -lelf
/usr/bin/ld: cannot found -lz
/usr/bin/ld: cannot found -lelf
/usr/bin/ld: cannot found -lz
/usr/bin/ld: cannot found -lelf
/usr/bin/ld: cannot found -lz
/usr/bin/ld: cannot found -lc
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)

Linux Version

Fedora release 36 (Thirty Six)
Linux fedora 5.17.5 #2 SMP PREEMPT Sun Sep 4 19:24:15 CST 2022 x86_64 x86_64 x86_64 GNU/Linux

Libbpf Version

Name         : libbpf
Epoch        : 2
Version      : 0.7.0
Release      : 3.fc36
Architecture : x86_64
Size         : 356 k
Source       : libbpf-0.7.0-3.fc36.src.rpm

zbh255 avatar Sep 09 '22 17:09 zbh255

Possible example on how to "solve" issues like this in Makefile: https://github.com/aquasecurity/tracee/blob/main/Makefile#L50

rafaeldtinoco avatar Sep 15 '22 12:09 rafaeldtinoco

I have the same problem, have you solved it? Architecture:ARM64 clang version:clang-12

sunhaotian0122 avatar Sep 19 '22 11:09 sunhaotian0122

@zbh255 @sunhaotian0122 In the meantime you can try: https://github.com/aquasecurity/libbpfgo#contributing

geyslan avatar Sep 19 '22 12:09 geyslan

@zbh255 Would you mind trying against main? We've merged related fixes: https://github.com/aquasecurity/libbpfgo/pull/431

geyslan avatar May 24 '24 22:05 geyslan