Travis CI - 无法在 makefile 中 运行 `c` 可执行文件

Travis CI - Unable to run an `c` executable in makefile

我有以下 Makefile,它编译、创建可执行文件然后执行它。

CC=gcc
CFLAGS=-I.
DEPS = hellomake.h
OBJ = hellomake.o hellofunc.o

%.o: %.c $(DEPS)
    $(CC) -c -o $@ $< $(CFLAGS)

hellomake: $(OBJ)
    $(CC) -o $@ $^ $(CFLAGS)
    ./hellomake

它在我的本地机器上完美运行,当它在 Travis 中构建时出现以下错误。

gcc -o hellomake hellomake.o hellofunc.o -I. hellomake.o: file not recognized: File format not recognized collect2: ld returned 1 exit status make: *** [hellomake] Error 1

您的 hellofunc.o 来自不同的系统(尝试 file hellofunc.o)。删除它然后重新编译它。

你交叉编译了吗?你有一个安装在不同机器上的主目录吗?也许解压缩其他人在不同架构上制作的档案?