我在 amd64 主机里面编译好了,编译出的执行文件在 amd64 可以运行。但是随身 Wi-Fi 是 arm64 的,需要交叉编译才可以。
里面有个 makefile 如下:
Makefile
OUTDIR=build
CC = gcc
CFLAGS = $(shell pkg-config --cflags glib-2.0 gio-2.0)
LIBS = $(shell pkg-config --libs glib-2.0 gio-2.0) -lpthread
main: main.c mongoose.c
$(CC) -o $(OUTDIR)/main main.c mongoose.c $(CFLAGS) $(LIBS)
这个随身 Wi-Fi 的系统信息如下:
root@udx710-module:/ # uname -a
Linux udx710-module 4.14.98 #1 SMP PREEMPT Thu Jul 27 01:59:03 UTC 2023 aarch64 GNU/Linux
root@udx710-module:/ # uname -r
4.14.98
oot@udx710-module:/ # /lib/libc-2.27.so
GNU C Library (GNU libc) stable release version 2.27.
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 7.2.1 20171011.
libc ABIs: UNIQUE
For bug reporting instructions, please see:
.
我应该如何修改 makefile ,使用交叉编译的工具链编译出 arm64 的执行文件呢?