我正在尝试使用 gcc++9.3 和 FreeBsd 12.1 编译我的程序,并在过程结束时给我这个错误
root@royal-server:/usr/src/sursa/Server/source/game/src # gmake -j20
linking ../game
/usr/bin/ld: error: /usr/local/lib/mysql/libmysqlclient.a(client.c.o) is incompatible with elf_i386_fbsd
/usr/bin/ld: error: /usr/local/lib/mysql/libmysqlclient.a(libmysql.c.o) is incompatible with elf_i386_fbsd
/usr/bin/ld: error: /usr/local/lib/mysql/libmysqlclient.a(adler32.o) is incompatible with elf_i386_fbsd
/usr/bin/ld: error: /usr/local/lib/mysql/libmysqlclient.a(crc32.o) is incompatible with elf_i386_fbsd
/usr/bin/ld: error: /usr/local/lib/mysql/libmysqlclient.a(deflate.o) is incompatible with elf_i386_fbsd
/usr/bin/ld: error: /usr/local/lib/mysql/libmysqlclient.a(inflate.o) is incompatible with elf_i386_fbsd
/usr/bin/ld: error: /usr/local/lib/mysql/libmysqlclient.a(trees.o) is incompatible with elf_i386_fbsd
/usr/bin/ld: error: /usr/local/lib/mysql/libmysqlclient.a(zutil.o) is incompatible with elf_i386_fbsd
/usr/bin/ld: error: /usr/local/lib/mysql/libmysqlclient.a(inffast.o) is incompatible with elf_i386_fbsd
/usr/bin/ld: error: /usr/local/lib/mysql/libmysqlclient.a(inftrees.o) is incompatible with elf_i386_fbsd
c++: error: linker command failed with exit code 1 (use -v to see invocation)
gmake: *** [Makefile:228: ../game] Error 1
root@royal-server:/usr/src/sursa/Server/source/game/src #
这是Makefile文件上的补丁。
# mysql
INCDIR += -I/usr/src/sursa/Server/extern/mysql/mysql
LIBDIR += -L/usr/local/lib/mysql
LIBS += -lmysqlclient -lz -pthread -lm -lssl -lcrypto
### END
我很抱歉在近四年后才发现这个问题......
答案:您正在尝试在 64 位(AMD64)机器上编译 32 位(i386)文件。