0

I want to compile for my program and I am stuck here , I am usig freebsd 12.1 and gcc++6.4 + gnu gmake -j20 comand

Curent path

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

Error in putty

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 #

I edited the typo and now i am geeting this

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 #
  • Are you sure that `mysqlclient` can be found at `/usr/local/lib/mysq` ? – Ripi2 May 24 '20 at 01:27
  • Yes , and olso I have it on /usr/src/Sursa/Server/extern/mysql/lib –  May 24 '20 at 01:29
  • https://gyazo.com/124095963e45ebc91e58490ad637fafa –  May 24 '20 at 01:31
  • A `.a` lib is for Windows (Mingw uses it). Libs in Linux are `.so` – Ripi2 May 24 '20 at 01:37
  • how can i make it .so for Freebsd 12.1? –  May 24 '20 at 01:43
  • You must download and install the proper version for your Freebsd, not for Windows – Ripi2 May 24 '20 at 01:44
  • from where ? wich pkg it s ? –  May 24 '20 at 01:47
  • @Ripi2 Your comment is wrong. `.a` files are object archives, used on many Unix-like systems. – arrowd May 24 '20 at 09:09
  • @arrowd You' re totally right. For starters [read this](https://stackoverflow.com/questions/12237282/whats-the-difference-between-so-la-and-a-library-files). When I saw the picture in the OP's comment I inmediately thought of Window's MinGW library naming. – Ripi2 May 24 '20 at 17:11

1 Answers1

0

You have a typo in LIBDIR += -L/usr/local/lib/mysq - missing l.

Make sure you have mysql57-client package installed. If not, run pkg install mysql57-client.

Also, /usr/src dir is usually used to store FreeBSD source code. It is not a best idea to use it to store your own code.

arrowd
  • 33,231
  • 8
  • 79
  • 110
  • what is a typo ? .. and how can I fix it ? –  May 24 '20 at 16:31
  • @Metin2Problem "typo" = "typographic error". You missed `l` at the end of `mysq` – Ripi2 May 24 '20 at 17:13
  • @Ripi2 I installed mysq 5.7 and i am getting ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' –  May 24 '20 at 17:28
  • @Metin2Problem A different error requires a different question in this site. – Ripi2 May 24 '20 at 17:29
  • @Ripi2 see the update . new error after solving the typo –  May 24 '20 at 17:32
  • @Metin2Problem No, don't do that. Edit again and reverese to previous version. The point of this site is not a chat, but a place for future readers may found a solution for their issues. If you change things like you did then the goal is lost by ofuscation. – Ripi2 May 24 '20 at 17:35
  • @Metin2Problem And if the solution for your original issue was solved by this answer then [accept it](https://stackoverflow.com/help/someone-answers) – Ripi2 May 24 '20 at 17:38