Page 1 of 1

Attempt to create a MySQL module

Posted: Sun Oct 02, 2011 5:24 pm
by chevyman2002
I'm attempting to create a very basic MySQL module to connect to a database and update a value, nothing crazy. I'm having a hard time getting it compiled properly. It compiles with some warnings and then does the following when attempting to load.

Code: Select all

*** Notice -- unrealircd.conf:39: loadmodule src/modules/stats.so: failed to load: tmp/5B47F7D5.stats.so: undefined symbol: mysql_query
I have even copied an entire mysql/ folder with updated header files (including mysql.h) and placed #include <mysql/mysql.h> in the source file. Does anyone have any pointers for me? The only thing I can think of is to manually edit the Makefile(s) to add includes for the libraries and cflags.. The original code I used worked just fine as a standalone application, just doesn't want to work as an Unreal module.

Re: Attempt to create a MySQL module

Posted: Mon Oct 03, 2011 4:42 pm
by chevyman2002
I forgot to mention that I have also tried to use #include </usr/include/mysql/mysql.h> to no avail. I have experimented with orion services and they use MySQL as a backend with no included header files (pulls from the /usr/... location) and it works just fine. I can't figure out what I'm doing wrong. I also added $(mysql_config --libs) and $(mysql_config --cflags), respectively, to the main Makefile and it didn't seem to help (has since been reverted to its original state). Ideas?

Re: Attempt to create a MySQL module

Posted: Tue Oct 11, 2011 10:51 pm
by Jobe
You will also need to pass the correct linker flags to link with the MySQL client library as well. Which is where compiling an Unreal module which uses MySQL gets tricky.

Re: Attempt to create a MySQL module

Posted: Wed Oct 12, 2011 2:05 pm
by chevyman2002
Ya sorry, it has been a hellacious week and I just haven't been into this as much with everything going on. The following is the proper method for compiling with mysql support (thanks binki).

Code: Select all

make custommodule MODULEFILE=my_mysql_mod EXLIBS="$(mysql_config --libs) $(mysql_config --cflags)"