You are not logged in.

#1 2022-06-05 07:51:27

archladyQ
Member
Registered: 2022-06-05
Posts: 4

/usr/bin/ld: cannot find : No such file ... When static compiling

Hi all,
  I static compile this code https://github.com/kris-nova/boopkit.git ,it shows some error like below:

[k8s@boopkit] $ make static
  ->  Building boopkit
#gcc -I/usr/local/include -g  -lbpf -lelf -lpcap -lpthread -static -o boopkit boopkit.c common.c dpi.c -Wl, -v 
gcc -I/usr/local/include -g  -lbpf -lelf -lpcap -lpthread -static -o boopkit boopkit.c common.c dpi.c -Wl,
/usr/bin/ld: cannot find : No such file or directory
collect2: error: ld returned 1 exit status
make: *** [Makefile:73: static] Error 1

I used the -v to show the detail

GNU C17 (GCC) version 12.1.0 (x86_64-pc-linux-gnu)
        compiled by GNU C version 12.1.0, GMP version 6.2.1, MPFR version 4.1.0-p13, MPC version 1.2.1, isl version isl-0.24-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 3e6a47a96552b6758214eb71bda8ede7
COLLECT_GCC_OPTIONS='-I' '/usr/local/include' '-g' '-static' '-o' 'boopkit' '-v' '-mtune=generic' '-march=x86-64' '-dumpdir' 'boopkit-'
 as -v -I /usr/local/include --gdwarf-5 --64 -o /tmp/cc6fHVXo.o /tmp/cc2crZi2.s
GNU assembler version 2.38 (x86_64-pc-linux-gnu) using BFD version (GNU Binutils) 2.38
COMPILER_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.0/:/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.0/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.0/:/usr/lib/gcc/x86_64-pc-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.0/:/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.0/../../../../lib/:/lib/../lib/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-I' '/usr/local/include' '-g' '-static' '-o' 'boopkit' '-v' '-mtune=generic' '-march=x86-64' '-dumpdir' 'boopkit.'
 /usr/lib/gcc/x86_64-pc-linux-gnu/12.1.0/collect2 -plugin /usr/lib/gcc/x86_64-pc-linux-gnu/12.1.0/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.0/lto-wrapper -plugin-opt=-fresolution=/tmp/cccd2mPu.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_eh -plugin-opt=-pass-through=-lc --build-id --hash-style=gnu -m elf_x86_64 -static -o boopkit /usr/lib/gcc/x86_64-pc-linux-gnu/12.1.0/../../../../lib/crt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/12.1.0/../../../../lib/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/12.1.0/crtbeginT.o -L/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.0 -L/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.0/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.0/../../.. -lbpf -lelf -lpcap -lpthread /tmp/ccAaIz0N.o /tmp/cch3FFZk.o /tmp/cc6fHVXo.o "" --start-group -lgcc -lgcc_eh -lc --end-group /usr/lib/gcc/x86_64-pc-linux-gnu/12.1.0/crtend.o /usr/lib/gcc/x86_64-pc-linux-gnu/12.1.0/../../../../lib/crtn.o
/usr/bin/ld: cannot find : No such file or directory
collect2: error: ld returned 1 exit status

I used strace to find what's wrong.

read(13, "\1\0\0\0\2\0\0\0\30\10\0\0\0\0\0\0\250\v\0\0\0\0\0\0\n\0\0\0\7\0\0\0"..., 4096) = 3864
newfstatat(13, "", {st_mode=S_IFREG|0600, st_size=20248, ...}, AT_EMPTY_PATH) = 0
lseek(13, 20248, SEEK_SET)              = 20248
lseek(13, 0, SEEK_SET)                  = 0
read(13, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\1\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 4096
lseek(13, 4096, SEEK_SET)               = 4096
read(13, "!\301\271\342\250\245\316\327;_x\326F\2278\363\21\20\302\332+\304$\30\313\236\305\335?\4*R"..., 4096) = 4096
lseek(13, 8192, SEEK_SET)               = 8192
openat(AT_FDCWD, "/tmp/ccWseH2z.o", O_RDONLY) = 14
newfstatat(14, "", {st_mode=S_IFREG|0600, st_size=20248, ...}, AT_EMPTY_PATH) = 0
lseek(14, 0, SEEK_SET)                  = 0
read(14, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0", 16) = 16
lseek(14, 0, SEEK_SET)                  = 0
read(14, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\1\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 64) = 64
lseek(14, 18840, SEEK_SET)              = 18840
read(14, " \0\0\0\1\0\0\0\6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 1408) = 1408
lseek(14, 18560, SEEK_SET)              = 18560
read(14, "\0.symtab\0.strtab\0.shstrtab\0.rela"..., 211) = 211
lseek(14, 18840, SEEK_SET)              = 18840
read(14, " \0\0\0\1\0\0\0\6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 1408) = 1408
lseek(14, 18560, SEEK_SET)              = 18560
read(14, "\0.symtab\0.strtab\0.shstrtab\0.rela"..., 211) = 211
close(14)                               = 0
lseek(13, 8192, SEEK_SET)               = 8192
read(13, "\0\0\0\0\0\0\0\0\7\0\0\0\21\0\4\0\0\0\0\0\0\0\0\0\0\0@\0\0\0\0\0"..., 4096) = 4096
read(13, "\274\1\0\0\0\0\0\0O\v\0\0\0\0\0\0\4\0\0\0\16\0\0\0\374\377\377\377\377\377\377\377"..., 4096) = 4096
read(13, "\1\0\0\0\2\0\0\0\30\10\0\0\0\0\0\0\250\v\0\0\0\0\0\0\n\0\0\0\7\0\0\0"..., 4096) = 3864
openat(AT_FDCWD, "", O_RDONLY)          = -1 ENOENT (No such file or directory)
write(2, "/usr/bin/ld", 11)             = 11
write(2, ": cannot find ", 14)          = 14
write(2, ": ", 2)                       = 2
openat(AT_FDCWD, "/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)

I can compile it without static.(clang)

[k8s@boopkit] $ make
bpftool btf dump file /sys/kernel/btf/vmlinux format c > vmlinux.h
  ->  Building eBPF pr0bes
  ->  Generating pr0be.skel.safe.h
bpftool gen skeleton pr0be.safe.o -p > pr0be.skel.safe.h
bpftool gen skeleton pr0be.xdp.o -p > pr0be.skel.xdp.h
  ->  Building trigger program
cd boop && make
make[1]: Entering directory '/home/k8s/boopkit/boop'
rm -f boopkit-boop
clang -Wall -o boopkit-boop \
        packets.c \
        ../common.c \
        boopkit-boop.c
make[1]: Leaving directory '/home/k8s/boopkit/boop'
  ->  Building boopkit
clang -I/usr/local/include -g  -lbpf -lelf -lpcap -lpthread -o boopkit boopkit.c common.c dpi.c -Wl,
[k8s@boopkit] $ file boopkit     
boopkit: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 4.4.0, with debug_info, not stripped

Last edited by archladyQ (2022-06-05 07:53:24)


ArchLinux,simple & powerfull,I love it.

Offline

#2 2022-06-05 11:40:47

lmn
Member
Registered: 2021-05-09
Posts: 61

Re: /usr/bin/ld: cannot find : No such file ... When static compiling

The -Wl is for setting linker options and gcc does not seem to like it when there are no options set. Have you tried to removing that option (since it does nothing anyway) ?

Edit: spelling

Last edited by lmn (2022-06-05 11:50:04)

Offline

#3 2022-06-05 12:50:35

archladyQ
Member
Registered: 2022-06-05
Posts: 4

Re: /usr/bin/ld: cannot find : No such file ... When static compiling

lmn wrote:

The -Wl is for setting linker options and gcc does not seem to like it when there are no options set. Have you tried to removing that option (since it does nothing anyway) ?

Edit: spelling

Thanks for your reply.
I compile it without -Wl,but it returns lots of errors.

gcc -I/usr/local/include -g  -lbpf -lelf -lpcap -lpthread -static -o boopkit boopkit.c common.c dpi.c

/usr/bin/ld: /tmp/ccot7u74.o: in function `pr0be_safe__destroy':
/home/k8s/boopkit/pr0be.skel.safe.h:49: undefined reference to `bpf_object__destroy_skeleton'
/usr/bin/ld: /tmp/ccot7u74.o: in function `pr0be_safe__open_opts':
/home/k8s/boopkit/pr0be.skel.safe.h:69: undefined reference to `bpf_object__open_skeleton'
/usr/bin/ld: /tmp/ccot7u74.o: in function `pr0be_safe__load':
/home/k8s/boopkit/pr0be.skel.safe.h:89: undefined reference to `bpf_object__load_skeleton'
/usr/bin/ld: /tmp/ccot7u74.o: in function `pr0be_safe__attach':
/home/k8s/boopkit/pr0be.skel.safe.h:113: undefined reference to `bpf_object__attach_skeleton'
/usr/bin/ld: /tmp/ccot7u74.o: in function `pr0be_safe__create_skeleton':
/home/k8s/boopkit/pr0be.skel.safe.h:40147: undefined reference to `bpf_object__destroy_skeleton'
/usr/bin/ld: /tmp/ccot7u74.o: in function `pr0be_xdp__destroy':
/home/k8s/boopkit/pr0be.skel.xdp.h:22: undefined reference to `bpf_object__destroy_skeleton'
/usr/bin/ld: /tmp/ccot7u74.o: in function `main':
/home/k8s/boopkit/boopkit.c:331: undefined reference to `bpf_program__fd'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:332: undefined reference to `bpf_map__fd'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:332: undefined reference to `bpf_map_update_elem'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:339: undefined reference to `bpf_program__fd'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:340: undefined reference to `bpf_map__fd'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:340: undefined reference to `bpf_map_update_elem'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:351: undefined reference to `bpf_map__fd'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:351: undefined reference to `ring_buffer__new'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:365: undefined reference to `bpf_object__open'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:372: undefined reference to `bpf_object__load'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:378: undefined reference to `bpf_object__next_map'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:379: undefined reference to `bpf_object__next_program'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:380: undefined reference to `bpf_program__name'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:381: undefined reference to `bpf_program__section_name'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:383: undefined reference to `bpf_program__attach'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:379: undefined reference to `bpf_object__next_program'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:393: undefined reference to `bpf_object__next_map'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:394: undefined reference to `bpf_map__name'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:396: undefined reference to `bpf_map__fd'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:409: undefined reference to `ring_buffer__poll'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:418: undefined reference to `bpf_map_lookup_elem'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:439: undefined reference to `bpf_map_delete_elem'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:452: undefined reference to `bpf_map_delete_elem'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:463: undefined reference to `bpf_map_delete_elem'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:469: undefined reference to `bpf_map_delete_elem'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:417: undefined reference to `bpf_map_get_next_key'
/usr/bin/ld: /tmp/ccjSopgn.o: in function `xcap':
/home/k8s/boopkit/dpi.c:188: undefined reference to `pcap_lookupnet'
/usr/bin/ld: /home/k8s/boopkit/dpi.c:194: undefined reference to `pcap_open_live'
/usr/bin/ld: /home/k8s/boopkit/dpi.c:200: undefined reference to `pcap_compile'
/usr/bin/ld: /home/k8s/boopkit/dpi.c:201: undefined reference to `pcap_geterr'
/usr/bin/ld: /home/k8s/boopkit/dpi.c:205: undefined reference to `pcap_setfilter'
/usr/bin/ld: /home/k8s/boopkit/dpi.c:206: undefined reference to `pcap_geterr'
/usr/bin/ld: /home/k8s/boopkit/dpi.c:215: undefined reference to `pcap_next'
/usr/bin/ld: /home/k8s/boopkit/dpi.c:258: undefined reference to `pcap_close'
collect2: error: ld returned 1 exit status
k8s@k8s:~/boopkit$ gcc -I/usr/local/include -g  -lbpf -lelf -lpcap -lpthread -static -o boopkit boopkit.c common.c dpi.c
/usr/bin/ld: /tmp/ccf99bzJ.o: in function `pr0be_safe__destroy':
/home/k8s/boopkit/pr0be.skel.safe.h:49: undefined reference to `bpf_object__destroy_skeleton'
/usr/bin/ld: /tmp/ccf99bzJ.o: in function `pr0be_safe__open_opts':
/home/k8s/boopkit/pr0be.skel.safe.h:69: undefined reference to `bpf_object__open_skeleton'
/usr/bin/ld: /tmp/ccf99bzJ.o: in function `pr0be_safe__load':
/home/k8s/boopkit/pr0be.skel.safe.h:89: undefined reference to `bpf_object__load_skeleton'
/usr/bin/ld: /tmp/ccf99bzJ.o: in function `pr0be_safe__attach':
/home/k8s/boopkit/pr0be.skel.safe.h:113: undefined reference to `bpf_object__attach_skeleton'
/usr/bin/ld: /tmp/ccf99bzJ.o: in function `pr0be_safe__create_skeleton':
/home/k8s/boopkit/pr0be.skel.safe.h:40147: undefined reference to `bpf_object__destroy_skeleton'
/usr/bin/ld: /tmp/ccf99bzJ.o: in function `pr0be_xdp__destroy':
/home/k8s/boopkit/pr0be.skel.xdp.h:22: undefined reference to `bpf_object__destroy_skeleton'
/usr/bin/ld: /tmp/ccf99bzJ.o: in function `main':
/home/k8s/boopkit/boopkit.c:331: undefined reference to `bpf_program__fd'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:332: undefined reference to `bpf_map__fd'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:332: undefined reference to `bpf_map_update_elem'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:339: undefined reference to `bpf_program__fd'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:340: undefined reference to `bpf_map__fd'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:340: undefined reference to `bpf_map_update_elem'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:351: undefined reference to `bpf_map__fd'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:351: undefined reference to `ring_buffer__new'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:365: undefined reference to `bpf_object__open'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:372: undefined reference to `bpf_object__load'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:378: undefined reference to `bpf_object__next_map'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:379: undefined reference to `bpf_object__next_program'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:380: undefined reference to `bpf_program__name'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:381: undefined reference to `bpf_program__section_name'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:383: undefined reference to `bpf_program__attach'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:379: undefined reference to `bpf_object__next_program'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:393: undefined reference to `bpf_object__next_map'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:394: undefined reference to `bpf_map__name'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:396: undefined reference to `bpf_map__fd'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:409: undefined reference to `ring_buffer__poll'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:418: undefined reference to `bpf_map_lookup_elem'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:439: undefined reference to `bpf_map_delete_elem'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:452: undefined reference to `bpf_map_delete_elem'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:463: undefined reference to `bpf_map_delete_elem'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:469: undefined reference to `bpf_map_delete_elem'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:417: undefined reference to `bpf_map_get_next_key'
/usr/bin/ld: /tmp/ccWjzs3C.o: in function `xcap':
/home/k8s/boopkit/dpi.c:188: undefined reference to `pcap_lookupnet'
/usr/bin/ld: /home/k8s/boopkit/dpi.c:194: undefined reference to `pcap_open_live'
/usr/bin/ld: /home/k8s/boopkit/dpi.c:200: undefined reference to `pcap_compile'
/usr/bin/ld: /home/k8s/boopkit/dpi.c:201: undefined reference to `pcap_geterr'
/usr/bin/ld: /home/k8s/boopkit/dpi.c:205: undefined reference to `pcap_setfilter'
/usr/bin/ld: /home/k8s/boopkit/dpi.c:206: undefined reference to `pcap_geterr'
/usr/bin/ld: /home/k8s/boopkit/dpi.c:215: undefined reference to `pcap_next'
/usr/bin/ld: /home/k8s/boopkit/dpi.c:258: undefined reference to `pcap_close'
collect2: error: ld returned 1 exit status

Then I compile it without -static and -Wl, the same error,I guess it need -Wl, ?

gcc -I/usr/local/include -g  -lbpf -lelf -lpcap -lpthread -o boopkit boopkit.c common.c dpi.c

/usr/bin/ld: /tmp/ccrZfGQk.o: in function `pr0be_safe__destroy':
/home/k8s/boopkit/pr0be.skel.safe.h:49: undefined reference to `bpf_object__destroy_skeleton'
/usr/bin/ld: /tmp/ccrZfGQk.o: in function `pr0be_safe__open_opts':
/home/k8s/boopkit/pr0be.skel.safe.h:69: undefined reference to `bpf_object__open_skeleton'
/usr/bin/ld: /tmp/ccrZfGQk.o: in function `pr0be_safe__load':
/home/k8s/boopkit/pr0be.skel.safe.h:89: undefined reference to `bpf_object__load_skeleton'
/usr/bin/ld: /tmp/ccrZfGQk.o: in function `pr0be_safe__attach':
/home/k8s/boopkit/pr0be.skel.safe.h:113: undefined reference to `bpf_object__attach_skeleton'
/usr/bin/ld: /tmp/ccrZfGQk.o: in function `pr0be_safe__create_skeleton':
/home/k8s/boopkit/pr0be.skel.safe.h:40147: undefined reference to `bpf_object__destroy_skeleton'
/usr/bin/ld: /tmp/ccrZfGQk.o: in function `pr0be_xdp__destroy':
/home/k8s/boopkit/pr0be.skel.xdp.h:22: undefined reference to `bpf_object__destroy_skeleton'
/usr/bin/ld: /tmp/ccrZfGQk.o: in function `main':
/home/k8s/boopkit/boopkit.c:331: undefined reference to `bpf_program__fd'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:332: undefined reference to `bpf_map__fd'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:332: undefined reference to `bpf_map_update_elem'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:339: undefined reference to `bpf_program__fd'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:340: undefined reference to `bpf_map__fd'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:340: undefined reference to `bpf_map_update_elem'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:351: undefined reference to `bpf_map__fd'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:351: undefined reference to `ring_buffer__new'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:365: undefined reference to `bpf_object__open'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:372: undefined reference to `bpf_object__load'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:378: undefined reference to `bpf_object__next_map'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:379: undefined reference to `bpf_object__next_program'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:380: undefined reference to `bpf_program__name'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:381: undefined reference to `bpf_program__section_name'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:383: undefined reference to `bpf_program__attach'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:379: undefined reference to `bpf_object__next_program'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:393: undefined reference to `bpf_object__next_map'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:394: undefined reference to `bpf_map__name'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:396: undefined reference to `bpf_map__fd'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:409: undefined reference to `ring_buffer__poll'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:418: undefined reference to `bpf_map_lookup_elem'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:439: undefined reference to `bpf_map_delete_elem'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:452: undefined reference to `bpf_map_delete_elem'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:463: undefined reference to `bpf_map_delete_elem'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:469: undefined reference to `bpf_map_delete_elem'
/usr/bin/ld: /home/k8s/boopkit/boopkit.c:417: undefined reference to `bpf_map_get_next_key'
/usr/bin/ld: /tmp/ccwv1g6x.o: in function `xcap':
/home/k8s/boopkit/dpi.c:188: undefined reference to `pcap_lookupnet'
/usr/bin/ld: /home/k8s/boopkit/dpi.c:194: undefined reference to `pcap_open_live'
/usr/bin/ld: /home/k8s/boopkit/dpi.c:200: undefined reference to `pcap_compile'
/usr/bin/ld: /home/k8s/boopkit/dpi.c:201: undefined reference to `pcap_geterr'
/usr/bin/ld: /home/k8s/boopkit/dpi.c:205: undefined reference to `pcap_setfilter'
/usr/bin/ld: /home/k8s/boopkit/dpi.c:206: undefined reference to `pcap_geterr'
/usr/bin/ld: /home/k8s/boopkit/dpi.c:215: undefined reference to `pcap_next'
/usr/bin/ld: /home/k8s/boopkit/dpi.c:258: undefined reference to `pcap_close'
collect2: error: ld returned 1 exit status

Last edited by archladyQ (2022-06-05 12:52:12)


ArchLinux,simple & powerfull,I love it.

Offline

#4 2022-06-05 13:00:11

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,232
Website

Re: /usr/bin/ld: cannot find : No such file ... When static compiling

Arch generally does not package static libraries.  The libbpf package does not have one.

Offline

#5 2022-06-05 13:12:12

archladyQ
Member
Registered: 2022-06-05
Posts: 4

Re: /usr/bin/ld: cannot find : No such file ... When static compiling

Allan wrote:

Arch generally does not package static libraries.  The libbpf package does not have one.


I've compile the libbpf libpcap libelf and libc static,and link ok.

[k8s@lib] $ pwd
/usr/lib
[k8s@lib] $ ls -l libelf.a libbpf.a libpcap.a libc.a
-rw-r--r-- 1 root root  570714 Jun  5 00:05 libbpf.a
-rw-r--r-- 1 root root 6147508 Jun  5 14:32 libc.a
-rw-r--r-- 1 root root  303918 Apr 26 16:36 libelf.a
-rw-r--r-- 1 root root 1830836 Jun  5 00:11 libpcap.a

Last edited by archladyQ (2022-06-05 13:17:09)


ArchLinux,simple & powerfull,I love it.

Offline

Board footer

Powered by FluxBB