Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to compile xdp-loader in mips arch? #401

Open
bofengxiaoshuai opened this issue Mar 6, 2024 · 6 comments
Open

how to compile xdp-loader in mips arch? #401

bofengxiaoshuai opened this issue Mar 6, 2024 · 6 comments

Comments

@bofengxiaoshuai
Copy link

hello,I want to know how to compile xdp-loader in mips arch? I mean I want to run xdp-loader program in cpu with mips arch,thanks a lot

@tohojo
Copy link
Member

tohojo commented Mar 6, 2024 via email

@bofengxiaoshuai
Copy link
Author

bofengxiaoshuai commented Mar 6, 2024

bofengxiaoshuai @.***> writes:
hello,I want to know how to compile xdp-loader in mips arch? I mean I want to run xdp-loader program in cpu with mips arch,thanks a lot
Well, theoretically, the same way you would compile any other program for that arch. I have no idea if there's anything that will break for such a compile, but if there is, patches are very welcome. However, I'm not sure how useful xdp-loader actually is on MIPS; the kernel support for BPF on that arch is quite limited. Haven't played with it myself, though, so YMMV.

Thank you very much for your answers.
I try to fix it,it's all steps I do,hope you can give me some advise, thanks!

1、I see lines 60-71 of the configure script file:

: ${PKG_CONFIG:=pkg-config}
: ${CC=gcc}
: ${LD=ld}
: ${OBJCOPY=objcopy}
: ${CLANG=clang}
: ${LLC=llc}
: ${M4=m4}
: ${EMACS=emacs}
: ${BPFTOOL=bpftool}
: ${READELF=readelf}
: ${ARCH_INCLUDES=}
: ${ARCH_NAME=}

2、then I modify it to:

: ${PKG_CONFIG:=pkg-config}	
: ${CC=mips64el-linux-gcc}
: ${LD=mips64el-linux-ld}
: ${OBJCOPY=mips64el-linux-objcopy}
: ${CLANG=clang}
: ${LLC=llc}
: ${M4=m4}
: ${EMACS=emacs}
: ${BPFTOOL=bpftool}

3、then ./configure,below is output:

root@ubuntu:~/xdp-tools# ./configure
Found clang binary 'clang' with version 19 (from 'Ubuntu clang version 19.0.0 (++20240222053038+26d71d9ed56c-1~exp1~20240222173217.940)')
/usr/sbin/bpftool
using /usr/lib/linux-tools/5.15.0-67-generic/bpftool v5.15.85
libbpf support: submodule v1.2.0
  perf_buffer__consume support: yes (submodule)
  btf__load_from_kernel_by_id support: yes (submodule)
  btf__type_cnt support: yes (submodule)
  bpf_object__next_map support: yes (submodule)
  bpf_object__next_program support: yes (submodule)
  bpf_program__insn_cnt support: yes (submodule)
  bpf_program__type support: yes (submodule)
  bpf_program__flags support: yes (submodule)
  bpf_program__expected_attach_type support: yes (submodule)
  bpf_map_create support: yes (submodule)
  perf_buffer__new_raw support: yes (submodule)
  bpf_xdp_attach support: yes (submodule)
  bpf_map__set_autocreate support: yes (submodule)
  bpf_prog_test_run_opts support: yes (submodule)
  bpf_xdp_query support: yes (submodule)
zlib support: yes
ELF support: yes
pcap support: yes
secure_getenv support: yes
cap-ng support: no
root@ubuntu:~/xdp-tools# 

4、then I make

root@ubuntu:~/xdp-tools/xdp-loader# make
	CC       xdp-loader
In file included from ../lib/libbpf/src/root/usr/include/bpf/bpf.h:26:0,
				 from xdp-loader.c:11:
../lib/../headers/linux/bpf.h:12:30: fatal error: linux/bpf_common.h: No such file or directory
 #include <linux/bpf_common.h>
							  ^
compilation terminated.
make: *** [../lib/common.mk:107:xdp-loader] 错误 1
root@ubuntu:~/xdp-tools/xdp-loader# 

@tohojo
Copy link
Member

tohojo commented Mar 7, 2024 via email

@bofengxiaoshuai
Copy link
Author

You don't need to edit the file, you can just set these when running configure: CC=mips64el-linux-gcc LD=mips64el-linux-ld OBJCOPY=mips64el-linux-objcopy READELF=mips64el-linux-readelf ARCH_NAME=mips ./configure (or export all of them before running configure).


thank you so much for your answer,thanks you for telling me the way to assign the MACRO.
Now I have a question:

 : ${PKG_CONFIG:=pkg-config}
 : ${CC=mips64el-linux-gcc}
 : ${LD=mips64el-linux-ld}
 : ${OBJCOPY=mips64el-linux-objcopy}
 : ${CLANG=clang}
 : ${LLC=llc}
 : ${M4=m4}
 : ${EMACS=emacs}
 : ${BPFTOOL=bpftool}
 : ${READELF=mips64el-linux-readelf}
 : ${ARCH_INCLUDES=}
 : ${ARCH_NAME=mips}`

I want to know which parameter need to assign,
now I have already assigned 4,I don’t know whether it‘s enough.
and if I want to build for mips arch,
what value should assigned for INCLUDES and ARCH_NAME ?

@tohojo
Copy link
Member

tohojo commented Mar 8, 2024 via email

@bofengxiaoshuai
Copy link
Author

bofengxiaoshuai @.***> writes:

You don't need to edit the file, you can just set these when running configure: CC=mips64el-linux-gcc LD=mips64el-linux-ld OBJCOPY=mips64el-linux-objcopy READELF=mips64el-linux-readelf ARCH_NAME=mips ./configure (or export all of them before running configure). ------------------------------------------------------------------------------------------------------------ thank you so much for your answer,thanks you for telling me the way to assign the MACRO. Now I have a question: : ${PKG_CONFIG:=pkg-config} : ${CC=mips64el-linux-gcc} : ${LD=mips64el-linux-ld} : ${OBJCOPY=mips64el-linux-objcopy} : ${CLANG=clang} : ${LLC=llc} : ${M4=m4} : ${EMACS=emacs} : ${BPFTOOL=bpftool} : ${READELF=mips64el-linux-readelf} : ${ARCH_INCLUDES=} : ${ARCH_NAME=mips}` I want to know which parameter need to assign, now I have already assigned 4,I don’t know whether it‘s enough. and if I want to build for mips arch, what value should assigned for INCLUDES and ARCH_NAME ?
No idea. I don't actually have much experience cross-compiling for MIPS, so I'm afraid you'll have to find an actual expert to answer this :)

OK,I see, Thank you so much for answer my questions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants