This problem happens if you are trying to make mysqlserver, so you can run ChatScriptMysql within a Linux 2 server.
If you have a UBUNTU linux machine, it will work if you have mysql installed.
If you have AWS Amazon Linux 2 AMI (HVM), it will not work. This is how to fix it.
How to replicate it:
in SRC directory,
rm *.o
make clean mysqlserver
For the AWS linux, it throws this error:
/usr/bin/ld: cannot find -lmysqlclient
collect2: error: ld returned 1 exit status
make: *** [binary] Error 1
After much R&D, this is how to solve it.
make sure you have mysql loaded
This will probably do the trick: sudo yum install mysql
then run this command to find where the files actually reside
/sbin/ldconfig -p | grep libmysqlclient | cut -d\> -f2
this gave me this:
/usr/lib64/mysql/libmysqlclient.so.18
Now, run this
ld -lmysqlclient —verbose
this will tell you where it searches for this file
example:
attempt to open /usr/x86_64-amazon-linux/lib64/libmysqlclient.so failed
attempt to open /usr/x86_64-amazon-linux/lib64/libmysqlclient.a failed
attempt to open /usr/lib64/libmysqlclient.so failed
attempt to open /usr/lib64/libmysqlclient.a failed
attempt to open /usr/local/lib64/libmysqlclient.so failed
attempt to open /usr/local/lib64/libmysqlclient.a failed
attempt to open /lib64/libmysqlclient.so failed
attempt to open /lib64/libmysqlclient.a failed
attempt to open /usr/x86_64-amazon-linux/lib/libmysqlclient.so failed
attempt to open /usr/x86_64-amazon-linux/lib/libmysqlclient.a failed
attempt to open /usr/local/lib/libmysqlclient.so failed
attempt to open /usr/local/lib/libmysqlclient.a failed
attempt to open /lib/libmysqlclient.so failed
attempt to open /lib/libmysqlclient.a failed
attempt to open /usr/lib/libmysqlclient.so failed
so, I take this location, /usr/lib/libmysqlclient.so and create a link to where it actually resides, which is here:
/usr/lib64/mysql/libmysqlclient.so.18
(it looks in this location and there is a link pointer to where it actually resides.)
You can repoint this by running this:
sudo ln -s /usr/lib64/mysql/libmysqlclient.so.18 /usr/lib/libmysqlclient.so
(To reverse this change, do this: sudo unlink /usr/lib/libmysqlclient.so )
Then go back to SRC and try again:
rm *.o
make clean mysqlserver
and it worked on my end.
SHORTCUT
To fix this, try this command after you execute this: sudo yum install mysql
sudo ln -s /usr/lib64/mysql/libmysqlclient.so.18 /usr/lib/libmysqlclient.so
Hope this helps!