我该如何解决?错误:找不到库-lmysqlclient

时间:2020-05-24 01:21:55

标签: c++ c++11 gcc shared-libraries freebsd

我想为我的程序进行编译,我被困在这里,我使用的是freebsd 12.1和gcc ++ 6.4 + gnu gmake -j20 comand

当前路径

# mysql
INCDIR += -I../../../extern/mysql
LIBDIR += -L/usr/local/lib/mysq
LIBS   += -lmysqlclient -lz -pthread -lm -lssl -lcrypto
### END

油灰错误

root@vps:/usr/src/Sursa/Server/source/game/src # gmake -j20
linking ../game
ld: error: unable to find library -lmysqlclient
c++: error: linker command failed with exit code 1 (use -v to see invocation)
gmake: *** [Makefile:228: ../game] Error 1
root@vps:/usr/src/Sursa/Server/source/game/src #
root@vps:/usr/src/Sursa/Server/source/game/src #

我编辑了错字,现在我正在接受

root@vps:/usr/src/Sursa/Server/source/game/src # gmake -j20
linking ../game
ld: error: /usr/local/lib/mysql/libmysqlclient.a(client.c.o) is incompatible with elf_i386_fbsd
ld: error: /usr/local/lib/mysql/libmysqlclient.a(libmysql.c.o) is incompatible with elf_i386_fbsd
ld: error: /usr/local/lib/mysql/libmysqlclient.a(crypt_genhash_impl.cc.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@vps:/usr/src/Sursa/Server/source/game/src #

1 个答案:

答案 0 :(得分:0)

您在LIBDIR += -L/usr/local/lib/mysq中有一个错字-缺少l

确保已安装mysql57-client软件包。如果没有,请运行pkg install mysql57-client

另外,/usr/src目录通常用于存储FreeBSD源代码。用它来存储您自己的代码不是一个好主意。