PDA

View Full Version : Segfault with libcod/mysql



serthy
29th July 2016, 14:03
Hey,

I got a CoD2 installation kind of running from IzNoGoDs tutorial with libcod/mysql.
Im using the linux 1.3 cracked lnxded file and compiled libcod myself on Ubuntu 14.04.4, x64.
Also I got a running mysql-server on this machine, and can connect to the server and the mysql server fromother pc's as well (also through external IP's)

When I try to run mysql, I'll get a segfault right after mysql_query()


init()
{
wait 5;

level.mysqlHandle = mysql_reuse_connection();

if( !isDefined( level.mysqlHandle ) )
{
hostname = "1.2.3.4";
username = "bla";
password = "*******";
database = "games_cod2";
port = 3306;

mysqlHandle = mysql_init();
mysqlResult = mysql_real_connect( mysqlHandle , hostname , username , password , database , port );

if( !mysqlResult )
{
iprintln( "errno 1 = " + mysql_errno( mysqlHandle ) );
iprintln( "errno 2 = " + mysql_errno( mysqlHandle ) );

mysql_close( mysqlHandle );

return;
}

level.mysqlHandle = mysqlHandle;
}

iprintln( "mysqlHandle: " + level.mysqlHandle );

queryString = "INSERT INTO table3 ( lol ) VALUES ( 'LOLoLOL' )";

querryErrorExists = mysql_query( level.mysqlHandle , queryString );

wait 1; // I DO NOT GET HERE

if( querryErrorExists )
{
iprintln( "error in mysql_query" );

return;
}

// skipped rest


the last lines in the terminal:


WARNING: Non-localized Game Message string is not allowed to have letters in it. Must be changed over to a localized string: "mysqlHandle: 168752976"
./s.sh: line 23: 19809 Segmentation fault (core dumped) LD_PRELOAD="./libcod/bin/libcod2_1_3.so" $cod $args


The table exists, and it also inserts the record in it as expected.

Am I missing something?

(If you need more infos, pls tell me how, its like my first time on lnx)

serthy
29th July 2016, 14:08
Well, it seems to be I'm missing some backticks here and there.

"INSERT INTO `table3` ( `lol` ) VALUES ( `LOLoLOL` )"
I used regular single quotes before, without success. maybe my innocent mind was polluted by some windows formatting in SSMS. *insert Kappa-meme here*

IzNoGoD
29th July 2016, 18:54
Next time display the actual error, it helps a lot

serthy
29th July 2016, 21:10
Next time display the actual error, it helps a lot

This was all I got in the terminal.
Where is the full error located at? Maybe I've overlooked something

Whiskas
29th July 2016, 22:03
This was all I got in the terminal.
Where is the full error located at? Maybe I've overlooked something

dmesg command(linux) contains interesting informations.