linux系统没有gcc,需要交叉编译,并且应用链接的库文件可能和当期系统不匹配,需要静态编译,脚本如下:
root@jdm:/sched# cat Makefile
CURR_PATH = $(shell pwd)
CC = /opt/gcc-4.4.7-7215-n64-loongson/usr/bin/mips64el-redhat-linux-gcc
KERNEL_PATH = /linux-3.10.84_rt_LS_2J1a_20200904
obj-y := sched3.o
hello:sched3.o
$(CC) -static -o sched3 sched3.o -L /opt/gcc-4.4.7-7215-n64-loongson/usr/mips64el-redhat-linux/sysroot/lib64/ -lpthread
hello.o:hello.c
$(CC) -c sched3.c
clean:
@$(RM) *.o sched3