Based on the prefix for your MySQL installation (--prefix=/usr/local/mysql
'), you're not using the right paths.  You need to set the -I<directory> to
be where your mysql.h file is, and the -L<directory> to be where your
libmysqlclient.so (or .a if compiling static) file is.  I'd recommend trying
the following values

MYSQLFLAGS = -I/usr/local/mysql/include/mysql
MYSQLLIBS = -L/usr/local/mysql/lib/mysql -lmysqlclient

That may not be quite right - check for the locations of the above-mentioned
files and adjust if need be.

Good luck!

    -=| Ben

----- Original Message -----
From: "Steve Cogorno" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, September 07, 2002 12:19 AM
Subject: Can't link with C API


> >Description:
> I must be missing something terribly obvious, but I cannot get
> my client program to link. I get messages like this:
> ild: (undefined symbol) mysql_free_result -- referenced in the text
segment of dbinterface.o
>
> The reference manual says to make sure the -lmysqlclient and -L
> <path> settings are provided to the linker, which they are.  I've
> moved these around. I've tried setting the compile to static instead
> of dynamic link.  None of these seems to help.
>
> I'm using the SUNWspro/CC compiler.  I've tried switching to gcc,
> but I get the same result.
>
> I know that the linkers is finding the MySQL libraries because I can
> see the libmysqlclient.a file being opened when I trace the process
> with truss.
>
> I appreciate any advice you can provide!
>
> Here's the make file:
>
> CC = cc
>
> CFLAGS = -Dsvr4 -g
>
> MYSQLFLAGS =  -I /work/doctools/mysql/include
> MYSQLLIBS = -L /work/doctools/mysql-3.23.52/lib -lmysqlclient
>
> INCFLAGS = -I /usr/local/include
>
>
> all: TEST
>
> clean:
> rm *o TEST
>
> TEST: dbinterface.o TEST.o
> $(CC) $(CFLAGS) $(INCFLAGS) $(MYSQLLIBS) dbinterface.o TEST.o  -o TEST
>
> TEST.o: TEST.c
> $(CC) $(CFLAGS) $(INCFLAGS) $(MYSQLFLAGS) -c TEST.c -o TEST.o
>
> dbinterface.o: dbinterface.c
> $(CC) $(CFLAGS) $(INCFLAGS) $(MYSQLFLAGS) -c dbinterface.c  -o
dbinterface.o
> 9
>
>
> >How-To-Repeat:
>
> >Fix:
>
>
> >Submitter-Id: <submitter ID>
> >Originator:
> >Organization:
>   Steve Cogorno
> >
> >MySQL support: none
> >Synopsis: Can't link to API
> >Severity: serious
> >Priority: medium
> >Category: mysql
> >Class: support
> >Release: mysql-3.23.52-max (Official MySQL-max binary)
> >Server: ./mysqladmin  Ver 8.23 Distrib 3.23.52, for sun-solaris2.8 on
sparc
> Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
> This software comes with ABSOLUTELY NO WARRANTY. This is free software,
> and you are welcome to modify and redistribute it under the GPL license
>
> Server version 3.23.52-max
> Protocol version 10
> Connection Localhost via UNIX socket
> UNIX socket /tmp/mysql.sock
> Uptime: 4 hours 46 min 41 sec
>
> Threads: 1  Questions: 452  Slow queries: 0  Opens: 675  Flush tables: 1
Open tables: 2 Queries per second avg: 0.026
> >Environment:
> Compiled: Sun CC 5.0
> System: SunOS village 5.9 Generic sun4u sparc SUNW,Ultra-60
> Architecture: sun4
>
> Some paths:  /usr/bin/perl /usr/ccs/bin/make
/net/suntools/export/tools/sparc/bin/gmake
/net/suntools/export/tools/sparc/bin/gcc
/ws/on81-tools/SUNWspro/SC5.0/bin//cc
> GCC: Reading specs from
/net/newsuntools.sfbay/export/tools/sparc/lib/gcc-lib/sparc-sun-solaris2.7/2
.95/specs
> gcc version 2.95 19990728 (release)
> Compilation info: CC='gcc'  CFLAGS='-O3 -fno-omit-frame-pointer'
CXX='gcc'

CXXFLAGS='-O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -
fno-rtti'  LDFLAGS=''
> LIBC:
> -rw-r--r--   1 root     bin      1828460 Apr  6 12:46 /lib/libc.a
> lrwxrwxrwx   1 root     root          11 Jun 18 18:13 /lib/libc.so ->
./libc.so.1
> -rwxr-xr-x   1 root     bin       855484 Apr  6 12:46 /lib/libc.so.1
> -rw-r--r--   1 root     bin      1828460 Apr  6 12:46 /usr/lib/libc.a
> lrwxrwxrwx   1 root     root          11 Jun 18 18:13 /usr/lib/libc.so ->
./libc.so.1
> -rwxr-xr-x   1 root     bin       855484 Apr  6 12:46 /usr/lib/libc.so.1
> Configure command: ./configure --prefix=/usr/local/mysql
'--with-comment=Official MySQL-max
binary' --with-extra-charsets=complex --with-server-suffix=-max --enable-thr
ead-safe-client --enable-local-infile --enable-assembler --disable-shared --
with-berkeley-db --with-innodb CC=gcc 'CFLAGS=-O3 -fno-omit-frame-pointer'
'CXXFLAGS=-O3 -fno-omit-frame-pointer -felide-constructors -fno-exceptions -
fno-rtti' CXX=gcc
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to