This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

using libmysql with a eggdrop module

Old posts that have not been replied to for several years.
Locked
t
techie

using libmysql with a eggdrop module

Post by techie »

i did try to compile a eggdrop module with the mysql lib,
but it justs crashes.

this is the makefile:

Code: Select all

# Makefile for src/mod/woobie.mod/
# $Id: Makefile,v 1.9 2000/07/09 14:10:49 fabian Exp $

srcdir = .


doofus:
	@echo ""
	@echo "Let's try this from the right directory..."
	@echo ""
	@cd ../../../ && make

static: ../sheep.o

modules: ../../../sheep.$(MOD_EXT)

../sheep.o:
	$(CC) -I/usr/local/include $(CFLAGS) $(CPPFLAGS) -DMAKING_MODS -c $(srcdir)/sheep.c
	@rm -f ../sheep.o
	mv sheep.o ../

../../../sheep.$(MOD_EXT): ../sheep.o
	$(LD) -lmysqlclient -L/usr/local/lib/mysql/ -o ../../../sheep.$(MOD_EXT) ../sheep.o
	$(STRIP) ../../../sheep.$(MOD_EXT)

depend:
	$(CC) $(CFLAGS) $(CPPFLAGS) -MM $(srcdir)/woobie.c > .depend

clean:
	@rm -f .depend *.o *.$(MOD_EXT) *~
distclean: clean

#safety hash
../sheep.o: .././woobie.mod/woobie.c ../../../src/mod/module.h \
 ../../../src/main.h ../../../src/lang.h ../../../src/eggdrop.h \
 ../../../src/flags.h ../../../src/proto.h ../../../lush.h \
 ../../../src/misc_file.h ../../../src/cmdt.h ../../../src/tclegg.h \
 ../../../src/tclhash.h ../../../src/chan.h ../../../src/users.h \
 ../../../src/compat/compat.h ../../../src/compat/inet_aton.h \
 ../../../src/compat/snprintf.h ../../../src/compat/memset.h \
 ../../../src/compat/memcpy.h ../../../src/compat/strcasecmp.h \
 ../../../src/mod/modvals.h ../../../src/tandem.h
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

$(LD) -lmysqlclient -L/usr/local/lib/mysql/ -o ../../../sheep.$(MOD_EXT) ../sheep.o
Have you added /usr/local/lib/mysql to the LD_LIBRARY_PATH environment variable?

In .bash_profile add the command:

export LD_LIBRARY_PATH=/usr/local/lib/mysql
t
techie

yes

Post by techie »

i added it now..
same thing happend...

<tech> .tcl loadmodule cocacola
<TNet> [13:17] * Last context: tclhash.c/677 [Tcl proc: *dcc:tcl, param: $_dcc1 $_dcc2 $_dcc3]
<TNet> [13:17] * Please REPORT this BUG!
<TNet> [13:17] * Check doc/BUG-REPORT on how to do so.
<TNet> [13:17] * Wrote DEBUG
<TNet> [13:17] * SEGMENT VIOLATION -- CRASHING!
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Use gdb to figure out the exact cause of the error as suggested in the other thread.
t
techie

blah

Post by techie »

could u help me?

ive tryed, but couldnt get it to work
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

1. Change to your bot's dir.

2. Type "ls" and look for a core file.

3. Type "gdb eggdrop corefilename" (where corefilename is the name of the core file)

4. In gdb, if it says "(no debugging symbols found)..." then you do not have debugging enabled. Read the INSTALL file to find out how to enable debugging.

5. Type "where" in gdb to find out where the bot crashed.

If this is too hard, then try debugging your code with "putlog". You can see which putlogs succeed and which fail. Then you can narrow down where your module is crashing.
t
techie

hmm

Post by techie »

whats a core file? the .so file?
M
Mo-Ize

Post by Mo-Ize »

usualy the core file name is simply "core"; but you must have compiled your eggdrop doing "make debug".
I bet there are nice introductions to gdb on the web.
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

No it's a filed called "core" or "core.pid" like I said above. If you don't have it, then you don't have debugging turned on.

Either recompile eggdrop with debugging, or add your own putlogs for debugging.
Locked