How do I cross compile this project to armv5 linux(like merlin router) on ubuntu 20?
egg1234 opened this issue · 2 comments
egg1234 commented
Thank you!
fs714 commented
The easy way is to build this project on your armv5 router:
- Install golang arm version on armv5 router from https://go.dev/dl/
- Install build tools by
sudo apt-get install build-essential
- Install required libs by
sudo apt-get install linux-libc-dev libpcap-dev libnetfilter-queue-dev libnetfilter-log-dev
- Build this project by
make
If you want to do cross compile, it is more complex. You can:
- Install gcc compiler with arm target set by
sudo apt-get install gcc-arm-linux-gnueabi
- Update build command in Makefile like
env GOOS=linux GOARCH=arm GOARM=5 CGO_ENABLED=1 CC=arm-linux-gnueabi-gcc go build -o bin/${BINARY} ${LDFLAGS}
- You also have to solve the dependency of C libs like
pcap
,nfnetlink
andnetfilter_log
for ARM
egg1234 commented
I see.
Thanks a lot!