problem with mysql c API and c

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • alexkon1250@yahoo.gr

    #1

    problem with mysql c API and c

    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_serve r.c -o mysql_ins_serve r -I /usr/local/mysql/include/
    -L /usr/local/mysql/lib/ -lmysqlclient -lz

    i get:


    /usr/lib/libc_nonshared. a(elf-init.oS)(.gnu.l inkonce.t.__i68 6.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.__i68 6.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_fa il_local'
    /usr/lib/gcc-lib/i486-linux/3.3.5/../../../libz.a(inflate. o)(.text+0x1de1 ):
    In function `.L553':
    : undefined reference to `__stack_chk_fa il_local'
    collect2: ld returned 1 exit status
    /usr/lib/libc_nonshared. a(elf-init.oS)(.gnu.l inkonce.t.__i68 6.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.__i68 6.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_fa il_local'
    /usr/lib/gcc-lib/i486-linux/3.3.5/../../../libz.a(inflate. o)(.text+0x1de1 ):
    In function `.L553':
    : undefined reference to `__stack_chk_fa il_local'
    collect2: ld returned 1 exit status

    Does anyone have any clue? any help appreciated.

  • Flash Gordon

    #2
    Re: problem with mysql c API and c

    alexkon1250@yah oo.gr wrote:[color=blue]
    > i have a problem when i try to compile a C program that connects wth a
    > MySQL database.[/color]

    MySQL if off topic here. You would be better off on a mysql mailing list
    or group.
    [color=blue]
    > when i execute in Linux Debian the follwoing :
    > gcc mysql_ins_serve r.c -o mysql_ins_serve r -I /usr/local/mysql/include/
    > -L /usr/local/mysql/lib/ -lmysqlclient -lz
    >
    > i get:
    >
    >
    > /usr/lib/libc_nonshared. a(elf-init.oS)(.gnu.l inkonce.t.__i68 6.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.__i68 6.get_pc_thunk. bx+0x0):
    > first defined here
    > /usr/lib/gcc-lib/i486-linux/3.3.5/../../../libz.a(inflate. o)(.text+0x485) :[/color]

    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>
    [color=blue]
    > Does anyone have any clue? any help appreciated.[/color]

    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:

    Comment

    • Joe Estock

      #3
      Re: problem with mysql c API and c

      alexkon1250@yah oo.gr wrote:[color=blue]
      > 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_serve r.c -o mysql_ins_serve r -I /usr/local/mysql/include/
      > -L /usr/local/mysql/lib/ -lmysqlclient -lz
      >
      > i get:
      >
      >[/color]

      [snip link-time errors]
      [color=blue]
      >
      > Does anyone have any clue? any help appreciated.
      >[/color]

      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

      Comment

      • danielsonchris
        New Member
        • Apr 2006
        • 1

        #4
        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

        Comment

        • danielsonchris@gmail.com

          #5
          Re: problem with mysql c API and c

          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

          Comment

          • Keith Thompson

            #6
            Re: problem with mysql c API and c

            danielsonchris@ gmail.com writes:[color=blue]
            > 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.[/color]

            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_Keit h) kst-u@mib.org <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.

            Comment

            • Default User

              #7
              Re: problem with mysql c API and c

              danielsonchris@ gmail.com wrote:
              [color=blue]
              > Make sure you have a recent version of GCC and binutils.[/color]

              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.

              Comment

              Working...