problem with mysql c API and c

Discussion in 'C Programming' started by alexkon1250@yahoo.gr, Apr 5, 2006.

  1. Guest

    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.
    , Apr 5, 2006
    #1
    1. Advertising

  2. Flash Gordon Guest

    wrote:
    > 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.

    <snip>

    > 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.
    --
    Flash Gordon, living in interesting times.
    Web site - http://home.flash-gordon.me.uk/
    comp.lang.c posting guidelines and intro:
    http://clc-wiki.net/wiki/Intro_to_clc
    Flash Gordon, Apr 5, 2006
    #2
    1. Advertising

  3. Joe Estock Guest

    wrote:
    > 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
    Joe Estock, Apr 6, 2006
    #3
  4. Guest

    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
    , Apr 21, 2006
    #4
  5. writes:
    > 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/>.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    We must do something. This is something. Therefore, we must do this.
    Keith Thompson, Apr 21, 2006
    #5
  6. Default User Guest

    wrote:

    > Make sure you have a recent version of GCC and binutils.


    Make sure you read the information below.



    Brian

    --
    Please quote enough of the previous message for context. To do so from
    Google, click "show options" and use the Reply shown in the expanded
    header.
    Default User, Apr 21, 2006
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    430
  2. kilian

    [Mysql Api] Problem with tables listing

    kilian, Jun 8, 2005, in forum: C Programming
    Replies:
    5
    Views:
    260
    kilian
    Jun 12, 2005
  3. Jeffrey H. Coffield
    Replies:
    1
    Views:
    1,829
  4. Roedy Green
    Replies:
    0
    Views:
    1,462
    Roedy Green
    Jul 23, 2009
  5. dave
    Replies:
    4
    Views:
    1,353
    Steve Holden
    Nov 18, 2010
Loading...

Share This Page