davidcoles / xvs

XDP Virtual Server
GNU General Public License v2.0
5 stars 1 forks source link

Whie compiling the using Makefile ./balancer.go:85:17: undefined: xvs.Client2 make[1]: *** [Makefile:20: build] Error 1 make[1]: Leaving directory '/home/ubuntu/Documents/eBPF/xvs/balancer' make: *** [Makefile:18: example] Error 2 #1

Closed NobinPegasus closed 8 months ago

NobinPegasus commented 9 months ago
ubuntu@ubunu2004:~/Documents/eBPF/xvs$ make example
clang -S \
    -target bpf \
    -D FLOW_STATE_TYPE=BPF_MAP_TYPE_LRU_PERCPU_HASH \
    -D FLOW_STATE_SIZE=1000000   \
    -D FLOW_SHARE_SIZE=1000000   \
    -D FLOW_QUEUE_SIZE=10000 \
    -D __BPF_TRACING__ \
    -I/home/ubuntu/Documents/eBPF/xvs/libbpf/src \
    -Wall \
    -Wno-pointer-sign \
    -Wno-compare-distinct-pointer-types \
    -g -O2 -emit-llvm -c -o bpf/bpf.ll bpf/bpf.c    
bpf/bpf.c:1000:21: warning: variable 'icmp' set but not used [-Wunused-but-set-variable]
 1000 |     struct icmphdr *icmp = NULL;
      |                     ^
1 warning generated.
llc -march=bpf -filetype=obj -o bpf/bpf.o bpf/bpf.ll
rm bpf/bpf.ll
gzip -9 bpf/bpf.o
gzip: bpf/bpf.o.gz already exists; do you wish to overwrite (y or n)? y
cd balancer && make
make[1]: Entering directory '/home/ubuntu/Documents/eBPF/xvs/balancer'
go build -race
# github.com/davidcoles/xvs/xdp
In file included from ../xdp/xdp.go:23:
/home/ubuntu/Documents/eBPF/xvs/balancer/libbpf/src/bpf.h:556:60: warning: ‘struct bpf_link_info’ declared inside parameter list will not be visible outside of this definition or declaration
  556 | LIBBPF_API int bpf_link_get_info_by_fd(int link_fd, struct bpf_link_info *info, __u32 *info_len);
      |                                                            ^~~~~~~~~~~~~
In file included from ../xdp/xdp.go:24:
/home/ubuntu/Documents/eBPF/xvs/balancer/libbpf/src/libbpf.h:70:54: warning: ‘enum bpf_link_type’ declared inside parameter list will not be visible outside of this definition or declaration
   70 | LIBBPF_API const char *libbpf_bpf_link_type_str(enum bpf_link_type t);
      |                                                      ^~~~~~~~~~~~~
# github.com/davidcoles/xvs/xdp
In file included from xdp.c:1:
/home/ubuntu/Documents/eBPF/xvs/balancer/libbpf/src/bpf.h:556:60: warning: ‘struct bpf_link_info’ declared inside parameter list will not be visible outside of this definition or declaration
  556 | LIBBPF_API int bpf_link_get_info_by_fd(int link_fd, struct bpf_link_info *info, __u32 *info_len);
      |                                                            ^~~~~~~~~~~~~
In file included from xdp.c:2:
/home/ubuntu/Documents/eBPF/xvs/balancer/libbpf/src/libbpf.h:70:54: warning: ‘enum bpf_link_type’ declared inside parameter list will not be visible outside of this definition or declaration
   70 | LIBBPF_API const char *libbpf_bpf_link_type_str(enum bpf_link_type t);
      |                                                      ^~~~~~~~~~~~~
# github.com/davidcoles/xvs/balancer
./balancer.go:85:17: undefined: xvs.Client2
make[1]: *** [Makefile:20: build] Error 1
make[1]: Leaving directory '/home/ubuntu/Documents/eBPF/xvs/balancer'
make: *** [Makefile:18: example] Error 2
davidcoles commented 9 months ago

Hello! Thanks for spotting this. I was refactoring some code and forgot to update the example - I've fixed that now.

Try pulling down the latest version and see if that runs correctly.

Please let me know how you get on and if the balancer example works correctly on your setup.

NobinPegasus commented 9 months ago

It throws a new error now.

pegasus@pegasus:~/Documents/eBPF/xvs$ make example
test -f bpf/bpf.o.gz || make bpf/bpf.o.gz
cd balancer && make
make[1]: Entering directory '/home/pegasus/Documents/eBPF/xvs/balancer'
go build -race
# github.com/davidcoles/xvs/bpf
store_tcp.c:1: error: unterminated #ifdef
    1 | #ifdef __BPF__ // Skip all of this with CGO
      | 
make[1]: *** [Makefile:20: build] Error 1
make[1]: Leaving directory '/home/pegasus/Documents/eBPF/xvs/balancer'
make: *** [Makefile:17: example] Error 2
davidcoles commented 9 months ago

Oh, interesting - I don;t get that. Where does "store_tcp.c" come from? What compiler (and version/architecture) are you using?

davidcoles commented 9 months ago

Can you maybe try building from a fresh checkout? eg.:

root@balancer:/tmp# git clone https://github.com/davidcoles/xvs.git
Cloning into 'xvs'...
remote: Enumerating objects: 220, done.
remote: Counting objects: 100% (220/220), done.
remote: Compressing objects: 100% (142/142), done.
remote: Total 220 (delta 132), reused 156 (delta 72), pack-reused 0
Receiving objects: 100% (220/220), 279.54 KiB | 5.48 MiB/s, done.
Resolving deltas: 100% (132/132), done.
root@balancer:/tmp# cd xvs/
root@balancer:/tmp/xvs# make example
test -f bpf/bpf.o.gz || make bpf/bpf.o.gz
cd balancer && make
make[1]: Entering directory '/tmp/xvs/balancer'
git clone -b v1.3.0 https://github.com/libbpf/libbpf
Cloning into 'libbpf'...
remote: Enumerating objects: 11831, done.
remote: Counting objects: 100% (3041/3041), done.
remote: Compressing objects: 100% (708/708), done.
remote: Total 11831 (delta 2304), reused 2392 (delta 2272), pack-reused 8790
Receiving objects: 100% (11831/11831), 9.08 MiB | 28.78 MiB/s, done.
Resolving deltas: 100% (7962/7962), done.
Note: switching to '20c0a9e3d7e7d4aeb283eae982543c9cacc29477'.

< ... many libbpf build steps removed for brevity ... >

  CC       sharedobjs/elf.o
  CC       libbpf.so.1.3.0
make[2]: Leaving directory '/tmp/xvs/balancer/libbpf/src'
go build -race
# github.com/davidcoles/xvs/xdp
In file included from ../xdp/xdp.go:23:
/tmp/xvs/balancer/libbpf/src/bpf.h:556:60: warning: ‘struct bpf_link_info’ declared inside parameter list will not be visible outside of this definition or declaration
  556 | LIBBPF_API int bpf_link_get_info_by_fd(int link_fd, struct bpf_link_info *info, __u32 *info_len);
      |                                                            ^~~~~~~~~~~~~
In file included from ../xdp/xdp.go:24:
/tmp/xvs/balancer/libbpf/src/libbpf.h:70:54: warning: ‘enum bpf_link_type’ declared inside parameter list will not be visible outside of this definition or declaration
   70 | LIBBPF_API const char *libbpf_bpf_link_type_str(enum bpf_link_type t);
      |                                                      ^~~~~~~~~~~~~
# github.com/davidcoles/xvs/xdp
In file included from xdp.c:1:
/tmp/xvs/balancer/libbpf/src/bpf.h:556:60: warning: ‘struct bpf_link_info’ declared inside parameter list will not be visible outside of this definition or declaration
  556 | LIBBPF_API int bpf_link_get_info_by_fd(int link_fd, struct bpf_link_info *info, __u32 *info_len);
      |                                                            ^~~~~~~~~~~~~
In file included from xdp.c:2:
/tmp/xvs/balancer/libbpf/src/libbpf.h:70:54: warning: ‘enum bpf_link_type’ declared inside parameter list will not be visible outside of this definition or declaration
   70 | LIBBPF_API const char *libbpf_bpf_link_type_str(enum bpf_link_type t);
      |                                                      ^~~~~~~~~~~~~
make[1]: Leaving directory '/tmp/xvs/balancer'
root@balancer:/tmp/xvs#

Thanks.

davidcoles commented 8 months ago

HI there. I'll close this issue down in a couple of days if we can't reproduce the problem now. Thanks.