我已将 make 文件修改为
linux:
$(CC) mongoose.c -shared -fPIC -fpic -m32 -o $(LIB) $(LINFLAGS)
$(CC) mongoose.c main.c -m32 -o $(PROG) $(LINFLAGS)
但是当我在 Mongoose 上运行 ld 时,我得到了。我收到警告说它与 i386 不兼容
ld mongoose
ld: warning: i386 architecture of input file `mongoose' is incompatible with i386:x86-64 output
最佳答案
ld 正在尝试从 x86-32 目标文件创建 x86-64 可执行文件,但很不高兴,因为这没有意义。使用 GCC 而不是 ld 进行链接,同时在链接处传递 -m32,它将使用正确的标志调用链接器来链接 x86-32 二进制文件。
关于为 32 位编译 mongoose,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6522309/