problem with mysql c API and c

A

alexkon1250

i have a problem when i try to compile a C program that connects wth a
MySQL database.

when i execute in Linux Debian the follwoing :
gcc mysql_ins_server.c -o mysql_ins_server -I /usr/local/mysql/include/
-L /usr/local/mysql/lib/ -lmysqlclient -lz

i get:


/usr/lib/libc_nonshared.a(elf-init.oS)(.gnu.linkonce.t.__i686.get_pc_thunk.bx+0x0):
In function `__i686.get_pc_thunk.bx':
: multiple definition of `__i686.get_pc_thunk.bx'
/usr/lib/gcc-lib/i486-linux/3.3.5/../../../libz.a(compress.o)(.text.__i686.get_pc_thunk.bx+0x0):
first defined here
/usr/lib/gcc-lib/i486-linux/3.3.5/../../../libz.a(inflate.o)(.text+0x485):
In function `inflateSync':
: undefined reference to `__stack_chk_fail_local'
/usr/lib/gcc-lib/i486-linux/3.3.5/../../../libz.a(inflate.o)(.text+0x1de1):
In function `.L553':
: undefined reference to `__stack_chk_fail_local'
collect2: ld returned 1 exit status
/usr/lib/libc_nonshared.a(elf-init.oS)(.gnu.linkonce.t.__i686.get_pc_thunk.bx+0x0):
In function `__i686.get_pc_thunk.bx':
: multiple definition of `__i686.get_pc_thunk.bx'
/usr/lib/gcc-lib/i486-linux/3.3.5/../../../libz.a(compress.o)(.text.__i686.get_pc_thunk.bx+0x0):
first defined here
/usr/lib/gcc-lib/i486-linux/3.3.5/../../../libz.a(inflate.o)(.text+0x485):
In function `inflateSync':
: undefined reference to `__stack_chk_fail_local'
/usr/lib/gcc-lib/i486-linux/3.3.5/../../../libz.a(inflate.o)(.text+0x1de1):
In function `.L553':
: undefined reference to `__stack_chk_fail_local'
collect2: ld returned 1 exit status

Does anyone have any clue? any help appreciated.
 
F

Flash Gordon

i have a problem when i try to compile a C program that connects wth a
MySQL database.

MySQL if off topic here. You would be better off on a mysql mailing list
or group.
when i execute in Linux Debian the follwoing :
gcc mysql_ins_server.c -o mysql_ins_server -I /usr/local/mysql/include/
-L /usr/local/mysql/lib/ -lmysqlclient -lz

i get:


/usr/lib/libc_nonshared.a(elf-init.oS)(.gnu.linkonce.t.__i686.get_pc_thunk.bx+0x0):
In function `__i686.get_pc_thunk.bx':
: multiple definition of `__i686.get_pc_thunk.bx'
/usr/lib/gcc-lib/i486-linux/3.3.5/../../../libz.a(compress.o)(.text.__i686.get_pc_thunk.bx+0x0):
first defined here
/usr/lib/gcc-lib/i486-linux/3.3.5/../../../libz.a(inflate.o)(.text+0x485):

OK, so you have a symbol defined more than once. Don't do that. As to
why, that I have absolutely no idea. Try deleting line 42 of your source
file and see it that help. If not, try blanking block 42 of your hard disk.

Does anyone have any clue? any help appreciated.

Seriously, how do you expect anyone to know what you have done wrong
without seeing what you have done? Don't post your code here though,
since we don't deal with third party libraries, only with standard C.
 
J

Joe Estock

i have a problem when i try to compile a C program that connects wth a
MySQL database.

when i execute in Linux Debian the follwoing :
gcc mysql_ins_server.c -o mysql_ins_server -I /usr/local/mysql/include/
-L /usr/local/mysql/lib/ -lmysqlclient -lz

i get:

[snip link-time errors]
Does anyone have any clue? any help appreciated.

This is highly off-topic for comp.lang.c (as I'm sure you well know from
the other reply by Flash), however what follows is even more-so OT but
the reasoning is because I just so happen to work with the MySQL API in c.

<OT>
I too am running Debian. You should use mysql_config --cflags and
mysql_config --libs in order to specifiy the location of the headers and
linker options. This ensures that everything that needs to be there will
get there correctly. Just FYI most scripts for other libraries are named
libraryname-config and they both accept the same arguments.

For example:

gcc main.c -o sqltest `mysql_config --cflags` `mysql_config --libs`
</OT>

Unfortunately I do not know of a group specific to MySQL therefore I
cannot set follow-up's to that group. A search on google might be of
better help.

Hope that helps,

Joe
 
D

danielsonchris

Make sure you have a recent version of GCC and binutils. I just ran
into the same problem with python 2.4.3. It had nothing to do with the
code base. The linker was broken and an update of my binutils fixed the
issue.
Kind regards,
Chris
 
K

Keith Thompson

Make sure you have a recent version of GCC and binutils. I just ran
into the same problem with python 2.4.3. It had nothing to do with the
code base. The linker was broken and an update of my binutils fixed the
issue.

Since you didn't provide any context, we have no idea what you're
talking about. The article to which you're replying isn't even on my
news server (it probably expired).

Read <http://cfaj.freeshell.org/google/>.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top