egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Yes, Mysql.mod again :/

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Modules & Programming
View previous topic :: View next topic  
Author Message
Aimar`
Voice


Joined: 29 Aug 2007
Posts: 8

PostPosted: Wed Aug 29, 2007 1:10 pm    Post subject: Yes, Mysql.mod again :/ Reply with quote

Hey guys, actually i read alot threads here about that mod, found way to fix mysql.h etc etc

got it compiled but with errors which makes it un-usefully ... when i try to use any binded mysql command in tcl my bot crashes with only that
•6:41PM• * NoF (aimar@xxx) Quit (Remote host closed the connection)

Nothin @ party line with bot ;/


Here is error code:
Code:
make[2]: Entering directory`/home/aimar/eggdrop1.6.16/src/mod/mysql.mod'
gcc -pipe -fPIC -g -O2 -Wall -I. -I../../.. -I../../.. -I../../../src/mod -DHAVE_CONFIG_H   `mysql_config --cflags` -DMAKING_MODS -c .././mysql.mod/mysql.c
/bin/sh: line 1: mysql_config: command not found
In file included from ../mysql.mod/mysql_mod.h:32,
                 from ../mysql.mod/mysql.c:24:
../../../src/mod/module.h:190:1: warning: "list_delete" redefined
In file included from ../mysql.mod/mysql.c:24:
../mysql.mod/mysql_mod.h:31:1: warning: this is the location of the previous definition
../mysql.mod/mysql.c: In function `tcl_mysql_connect':
../mysql.mod/mysql.c:171: warning: passing arg 2 of `Tcl_AppendToObj' discards qualifiers from pointer target type
../mysql.mod/mysql.c: In function `tcl_mysql_query':
../mysql.mod/mysql.c:212: warning: passing arg 2 of `Tcl_AppendToObj' discards qualifiers from pointer target type
mv mysql.o ../
gcc -pipe -shared -nostartfiles -o ../../../mysql.so ../mysql.o -L/usr/lib -ltcl -lm -ldl -lnsl   `mysql_config --libs`
/bin/sh: line 1: mysql_config: command not found
touch ../../../mysql.so
make[2]: Leaving directory`/home/aimar/eggdrop1.6.16/src/mod/mysql.mod'



Any idea? plz help me asap it's really urgent
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Wed Aug 29, 2007 3:24 pm    Post subject: Reply with quote

/bin/sh: line 1: mysql_config: command not found
Back to top
View user's profile Send private message
Aimar`
Voice


Joined: 29 Aug 2007
Posts: 8

PostPosted: Wed Aug 29, 2007 5:28 pm    Post subject: Reply with quote

saw that too... but what that means?

command not found, so what i need? include additional libraries? or what?
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Wed Aug 29, 2007 9:28 pm    Post subject: Reply with quote

Presumably it's an executable that comes with mysql, and it's not in your path. Figure out where it lives on your system and add the path to your environment (which, if you don't know how, is beyond the scope of this forum and I can only suggest googling help for your particular operating system.)
Back to top
View user's profile Send private message
Aimar`
Voice


Joined: 29 Aug 2007
Posts: 8

PostPosted: Mon Sep 03, 2007 5:29 am    Post subject: Reply with quote

ok, found mysql_config, included it in mysql.h and now it looks like that:

include lines in mysql_mod.h:
Code:
#define list_delete egg_list_delete
#include "src/mod/module.h"
#undef list_delete
#include </usr/local/mysql/include/mysql/mysql.h>
#include </usr/local/mysql/bin/mysql_config>


Errors code
Code:
gcc -pipe -fPIC -g -O2 -Wall -I. -I../../.. -I../../.. -I../../../src/mod -DHAVE_CONFIG_H   `mysql_config --cflags` -DMAKING_MODS -c .././mysql.mod/mysql.c
/bin/sh: line 1: mysql_config: command not found
In file included from ../mysql.mod/mysql_mod.h:32,
                 from ../mysql.mod/mysql.c:24:
../../../src/mod/module.h:190:1: warning: "list_delete" redefined
In file included from ../mysql.mod/mysql.c:24:
../mysql.mod/mysql_mod.h:31:1: warning: this is the location of the previous definition
In file included from ../mysql.mod/mysql_mod.h:35,
                 from ../mysql.mod/mysql.c:24:
/usr/local/mysql/bin/mysql_config:1:2: invalid preprocessing directive #!
/usr/local/mysql/bin/mysql_config:2:3: invalid preprocessing directive #Copyright
/usr/local/mysql/bin/mysql_config:4:3: invalid preprocessing directive #This
/usr/local/mysql/bin/mysql_config:5:3: invalid preprocessing directive #it
/usr/local/mysql/bin/mysql_config:6:3: invalid preprocessing directive #the
/usr/local/mysql/bin/mysql_config:7:3: invalid preprocessing directive #(
/usr/local/mysql/bin/mysql_config:9:3: invalid preprocessing directive #This
/usr/local/mysql/bin/mysql_config:10:3: invalid preprocessing directive #but
/usr/local/mysql/bin/mysql_config:11:3: invalid preprocessing directive #MERCHANTABILITY
/usr/local/mysql/bin/mysql_config:12:3: invalid preprocessing directive #GNU
/usr/local/mysql/bin/mysql_config:14:3: invalid preprocessing directive #You
/usr/local/mysql/bin/mysql_config:15:3: invalid preprocessing directive #along
/usr/local/mysql/bin/mysql_config:16:3: invalid preprocessing directive #Foundation
/usr/local/mysql/bin/mysql_config:18:3: invalid preprocessing directive #This
/usr/local/mysql/bin/mysql_config:19:3: invalid preprocessing directive #when
In file included from ../mysql.mod/mysql_mod.h:35,
                 from ../mysql.mod/mysql.c:24:
/usr/local/mysql/bin/mysql_config:22: warning: return type defaults to `int'
/usr/local/mysql/bin/mysql_config: In function `which':
/usr/local/mysql/bin/mysql_config:23: `IFS' undeclared (first use in this function)
/usr/local/mysql/bin/mysql_config:23: (Each undeclared identifier is reported only once
/usr/local/mysql/bin/mysql_config:23: for each function it appears in.)
/usr/local/mysql/bin/mysql_config:23: `save_ifs' undeclared (first use in this function)
/usr/local/mysql/bin/mysql_config:24: parse error before "for"
/usr/local/mysql/bin/mysql_config:41:3: invalid preprocessing directive #If
/usr/local/mysql/bin/mysql_config:42:3: invalid preprocessing directive #we
/usr/local/mysql/bin/mysql_config:43:3: invalid preprocessing directive #This
/usr/local/mysql/bin/mysql_config:44:3: invalid preprocessing directive #version
/usr/local/mysql/bin/mysql_config:55: `then' undeclared (first use in this function)
/usr/local/mysql/bin/mysql_config:65:12: missing binary operator
/usr/local/mysql/bin/mysql_config:109:42: missing terminating ' character
/usr/local/mysql/bin/mysql_config:65:1: unterminated #if
../mysql.mod/mysql.c:39: `mysql_start' undeclared (first use in this function)
../mysql.mod/mysql.c:39: initializer element is not constant
../mysql.mod/mysql.c:39: (near initialization for `mysql_table[0]')
../mysql.mod/mysql.c: In function `tcl_mysql_connect':
../mysql.mod/mysql.c:171: warning: passing arg 2 of `Tcl_AppendToObj' discards qualifiers from pointer target type
../mysql.mod/mysql.c: In function `tcl_mysql_query':
../mysql.mod/mysql.c:212: warning: passing arg 2 of `Tcl_AppendToObj' discards qualifiers from pointer target type
../mysql.mod/mysql.c: In function `which':
../mysql.mod/mysql.c:392: parse error at end of input
make[3]: *** [../mysql.o] Error 1
make[3]: Leaving Directory `/home/aimar/eggdrop1.6.16/src/mod/mysql.mod'
make[2]: *** [mysql.mod_so] Error 2
make[2]: Leaving Directory  `/home/aimar/eggdrop1.6.16/src/mod'
make[1]: *** [modules] Error 2
make[1]: Leaving Directory  `/home/aimar/eggdrop1.6.16'
make: *** [doofus] Error 2


/bin/sh: line 1: mysql_config: command not found

but few lines lower it uses it:
/usr/local/mysql/bin/mysql_config:19:3: invalid preprocessing directive #when
In file included from ../mysql.mod/mysql_mod.h:35,
from ../mysql.mod/mysql.c:24:

How to fix these weird errors?
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2853

PostPosted: Mon Sep 03, 2007 9:17 am    Post subject: Reply with quote

Quick reply:
mysql_config is a bash-script designed to generate compiler-flags and such, and is most certainly not intended to be included using c preprocessing directives.
What you need todo, is update your path environment variable to include the location of mysql_config.


Further info (if you are interrested in the actual mechanics at work):
Taking a look at the output of your earlier post:
Quote:
gcc -pipe -fPIC -g -O2 -Wall -I. -I../../.. -I../../.. -I../../../src/mod -DHAVE_CONFIG_H `mysql_config --cflags` -DMAKING_MODS -c .././mysql.mod/mysql.c

gcc is told to compile mysql.c. We have flags to tell gcc to use moderate optimization of code (-O2), aswell as multiple directives for include-paths (-I, where to look for .h-files to be included). There's also a few other directives, along with this:
Code:
`mysql_config --cflags`

`` are shell-special characters, and behave pretty much like [] does in tcl, that is, execute whatever is inside, and replace the whole piece with whatever the command returns.
What then, is the output from mysql_config --cflags?
Code:
[nml375@linux ~]$ mysql_config  --cflags
-I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing
[nml375@linux ~]$

Output is taken from my system, and will most likely be slightly different on your system, but simply put, it contains additional compiler flags, specifying how you should compile mysql.c in order to work with the local mysql-libraries installed on the system.

In the end, on my system the final command run would be this:
Code:
gcc -pipe -fPIC -g -O2 -Wall -I. -I../../.. -I../../.. -I../../../src/mod -DHAVE_CONFIG_H   -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -DMAKING_MODS -c .././mysql.mod/mysql.c

_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Aimar`
Voice


Joined: 29 Aug 2007
Posts: 8

PostPosted: Wed Sep 05, 2007 3:36 pm    Post subject: Reply with quote

Ok, so way to fix it is just an adding these compiler flags... but what if i get this:

Code:
aimar@p17:~$ `mysql_config` --cflags
-bash: mysql_config: command not found
-bash: --cflags: command not found
aimar@p17:~$ locate mysql_config
/usr/local/mysql/bin/mysql_config
/usr/local/mysql/man/man1/mysql_config.1
aimar@p17:~$ /usr/local/mysql/bin/mysql_config --cflags
-I/usr/local/mysql/include/mysql
aimar@p17:~$ /usr/local/mysql/man/man1/mysql_config.1 --cflags
-bash: /usr/local/mysql/man/man1/mysql_config.1: Brak dostępu (No Access)
aimar@p17:~$ `/usr/local/mysql/bin/mysql_config --cflags`
-bash: -I/usr/local/mysql/include/mysql: Nie ma takiego pliku ani katalogu (No file or dir like this exist there)
aimar@p17:~$


important is this:
aimar@p17:~$ /usr/local/mysql/bin/mysql_config --cflags
-I/usr/local/mysql/include/mysql


No additional flags here ;/
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2853

PostPosted: Wed Sep 05, 2007 3:56 pm    Post subject: Reply with quote

Short answer, not the recommended solution:
Just add /usr/local/mysql/bin to your path setting.. just as simple as that. Doing it any other way is pretty much asking for trouble...

As for your results:
Code:
aimar@p17:~$ `mysql_config` --cflags
-bash: mysql_config: command not found
-bash: --cflags: command not found

mysql_config is not located within your searchpath, and hence it is not found. Since the output is nothing, `mysql_config`is replaced with nothing, and the resulting commandline is --cflags. --cflags is not a command, and you get an error saying it was not found.

Code:
aimar@p17:~$ locate mysql_config
/usr/local/mysql/bin/mysql_config
/usr/local/mysql/man/man1/mysql_config.1

You have located both the executable (mysql_config), and the manpage (mysql_config.1). Congrats. Now make proper use of them...

Code:
aimar@p17:~$ /usr/local/mysql/bin/mysql_config --cflags
-I/usr/local/mysql/include/mysql

So, mysql_config tells you that header-files for libmyqsl are located at /usr/local/mysql/include/mysql. When properly set up, this line would automatically be inserted into the gcc commandline when compiling that module...

Code:
aimar@p17:~$ /usr/local/mysql/man/man1/mysql_config.1 --cflags
-bash: /usr/local/mysql/man/man1/mysql_config.1: Brak dostępu (No Access)

mysql_config.1 is a manpage, it's not executable. Don't try to run it...

Code:
aimar@p17:~$ `/usr/local/mysql/bin/mysql_config --cflags`
-bash: -I/usr/local/mysql/include/mysql: Nie ma takiego pliku ani katalogu (No file or dir like this exist there)

You run mysql_config --cflags with a proper path, and substitute all of it with the resulting code (-I/usr/local/mysql/include/mysql) and then try to execute that as a command. Not the way it's intended to be used...
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Aimar`
Voice


Joined: 29 Aug 2007
Posts: 8

PostPosted: Wed Sep 05, 2007 5:28 pm    Post subject: Reply with quote

Quote:
Code:

aimar@p17:~$ /usr/local/mysql/bin/mysql_config --cflags
-I/usr/local/mysql/include/mysql


So, mysql_config tells you that header-files for libmyqsl are located at /usr/local/mysql/include/mysql. When properly set up, this line would automatically be inserted into the gcc commandline when compiling that module...


Okies Smile
Now the line from makefile looks like that:
Code:
../mysql.o:
   $(CC) $(CFLAGS) $(CPPFLAGS) -I/usr/local/mysql/include/mysql -DMAKING_MODS -c $(srcdir)/mysql.c
   @rm -f ../mysql.o
   mv mysql.o ../


Where i placed "-I/usr/local/mysql/include/mysql" before was `mysql_config --cflags`

So ... i did it by way which u leaded me? :>

Doing make in eggdrop now and get this:
Code:
gcc -pipe -fPIC -g -O2 -Wall -I. -I../../.. -I../../.. -I../../../src/mod -DHAVE_CONFIG_H   -I/usr/local/mysql/include/mysql -DMAKING_MODS -c .././mysql.mod/mysql.c
In file included from ../mysql.mod/mysql_mod.h:32,
                 from ../mysql.mod/mysql.c:24:
../../../src/mod/module.h:190:1: warning: "list_delete" redefined
In file included from ../mysql.mod/mysql.c:24:
../mysql.mod/mysql_mod.h:31:1: warning: this is the location of the previous definition
In file included from ../mysql.mod/mysql_mod.h:35,
                 from ../mysql.mod/mysql.c:24:


Lower is same [censored] as before (these preprociessing directives lines)

Shoot me if i'm doing smth wrong again :p
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2853

PostPosted: Wed Sep 05, 2007 6:50 pm    Post subject: Reply with quote

Can I say this any more clearer? Don't edit your makefile, get your path environment variable properly set!

Since you've pretty much messed around with most of the files, and seem unable to undo your previous mistakes (such as including the mysql_config executable using a preprocessing directive), I suggest you delete the source for that module entirely, get a fresh copy, unpack it, get your path set properly, do not touch any file whatsoever, and start all over...
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Aimar`
Voice


Joined: 29 Aug 2007
Posts: 8

PostPosted: Thu Sep 06, 2007 10:00 am    Post subject: Reply with quote

Ok, as u know from yesterday env path to mysql_config is set correctly, mod compiled with some warnings ... but now i'm in point from which i started...

after i do any connection to mysql from bot it just die... but by diffrent way than in first post in this thread (•6:41PM• * NoF (aimar@xxx) Quit (Remote host closed the connection) )


Now it is (Connection closed) .. not remote host closed...

Logs from compiling:
Code:
make[2]: Wchodzę katalog `/home/aimar/eggdrop1.6.16/src/mod/mysql.mod'
gcc -pipe -fPIC -g -O2 -Wall -I. -I../../.. -I../../.. -I../../../src/mod -DHAVE_CONFIG_H   `mysql_config --cflags` -DMAKING_MODS -c .././mysql.mod/mysql.c
In file included from /home/aimar/eggdrop1.6.16/src/mod/mysql.mod/mysql_mod.h:32,
                 from ../mysql.mod/mysql.c:24:
../../../src/mod/module.h:190:1: warning: "list_delete" redefined
In file included from ../mysql.mod/mysql.c:24:
/home/aimar/eggdrop1.6.16/src/mod/mysql.mod/mysql_mod.h:31:1: warning: this is the location of the previous definition
../mysql.mod/mysql.c: In function `tcl_mysql_connect':
../mysql.mod/mysql.c:171: warning: passing arg 2 of `Tcl_AppendToObj' discards qualifiers from pointer target type
../mysql.mod/mysql.c: In function `tcl_mysql_query':
../mysql.mod/mysql.c:212: warning: passing arg 2 of `Tcl_AppendToObj' discards qualifiers from pointer target type
mv mysql.o ../
gcc -pipe -shared -nostartfiles -o ../../../mysql.so ../mysql.o -L/usr/lib -ltcl -lm -ldl -lnsl   `mysql_config --libs`
touch ../../../mysql.so



So just warnings, but cuz of them can't connect to db :/
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Modules & Programming All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber