pvpgn / pvpgn-server

Next generation of PvPGN server
https://pvpgn.pro
GNU General Public License v2.0
541 stars 155 forks source link

pvpgn fails to build with mysql support #442

Closed hashborgir closed 2 years ago

hashborgir commented 3 years ago

I configured like so and fails to build. It builds without mysql support just fine.

cmake -G "Unix Makefiles" -H./ -B./build -D WITH_MYSQL=true


/home/stoned/git/pvpgn-server/src/bnetd/sql_dbcreator.cpp:725:42: warning: ‘%s’ directive writing up to 1023 bytes into a region of size 1010 [-Wformat-overflow=]
725 |     std::sprintf(query, "INSERT INTO %s (%s) VALUES (%s)", table->name, _column, column->value);
|                                          ^~                             ~~~~~~~
/home/stoned/git/pvpgn-server/src/bnetd/sql_dbcreator.cpp:725:17: note: ‘sprintf’ output 26 or more bytes (assuming 1049) into a destination of size 1024
725 |     std::sprintf(query, "INSERT INTO %s (%s) VALUES (%s)", table->name, _column, column->value);
|     ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 72%] Building CXX object src/bnetd/CMakeFiles/bnetd.dir/sql_mysql.cpp.o
/home/stoned/git/pvpgn-server/src/bnetd/sql_mysql.cpp: In function ‘int pvpgn::bnetd::sql_mysql_init(const char*, const char*, const char*, const char*, const char*, const char*)’:
/home/stoned/git/pvpgn-server/src/bnetd/sql_mysql.cpp:175:4: error: ‘my_bool’ was not declared in this scope; did you mean ‘bool’?
175 |    my_bool  my_true = true;
|    ^~~~~~~
|    bool
/home/stoned/git/pvpgn-server/src/bnetd/sql_mysql.cpp:176:51: error: ‘my_true’ was not declared in this scope
176 |    if (mysql_options(mysql, MYSQL_OPT_RECONNECT, &my_true)){
|                                                   ^~~~~~~
make[2]: *** [src/bnetd/CMakeFiles/bnetd.dir/build.make:752: src/bnetd/CMakeFiles/bnetd.dir/sql_mysql.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:955: src/bnetd/CMakeFiles/bnetd.dir/all] Error 2
make: *** [Makefile:141: all] Error 2```
RElesgoe commented 3 years ago

The code in the master branch is not compatible with MySQL 8's client library. A fix is available in the develop branch.