Re: Problem compiling with MySql support

"Alejandro Guerrieri" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization Magicom
Message-ID <068801c48a3f$9c7543c0$0200a8c0@legolas>
Dear Stipe,

conftest.c:
--
#line 4467 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char mysql_init();

int main() {
mysql_init()
; return 0; }
--

First I ran a flat compile:

]# gcc conftest.c
/tmp/ccyfJ0bD.o(.text+0x11): In function `main':
: undefined reference to `mysql_init'
collect2: ld returned 1 exit status

(Silly me) I wasn't specifying the right libraries and paths. Then I've
tried running it as config.log showed (I removed the redirector "1>&5" to
get any output on the console).

gcc -o
nftest  -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -I/usr/include/libxml2   -rdynamic
conftest.c -lmysqlclient  -L'/usr/lib/mysql' -lmysqlclient -lz -lcrypt -lnsl
 -lm  -lresolv -lnsl -lm  -lpthread -L/usr/lib -lxml2 -lz -lm

And it compiled perfectly. I then ran ./conftest and it executed and
returned without complaining about anything (nor displaying anything).

Just for kicks, I've run ldd to find out the linkage:

]# ldd conftest
        libmysqlclient.so.10 => /usr/lib/mysql/libmysqlclient.so.10
(0x4001e000)
        libz.so.1 => /usr/lib/libz.so.1 (0x40056000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x40064000)
        libnsl.so.1 => /lib/libnsl.so.1 (0x40091000)
        libm.so.6 => /lib/tls/libm.so.6 (0x400a6000)
        libresolv.so.2 => /lib/libresolv.so.2 (0x400c8000)
        libpthread.so.0 => /lib/tls/libpthread.so.0 (0x400da000)
        libxml2.so.2 => /usr/lib/libxml2.so.2 (0x400e9000)
        libc.so.6 => /lib/tls/libc.so.6 (0x42000000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

I am also including my gcc/ld versions, just in case:

]# gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
Configured with:
../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info
 --enable-shared --enable-threads=posix --disable-checking --with-system-zli
b --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)

]# ld -v
GNU ld version 2.13.90.0.18 20030206


Regards,

----- Original Message ----- 
From: "Stipe Tolj" <[email protected]>
To: "Alejandro Guerrieri" <[email protected]>
Cc: <[email protected]>
Sent: Tuesday, August 24, 2004 7:13 PM
Subject: Re: Problem compiling with MySql support


> Alejandro Guerrieri wrote:
>
> > Stipe,
> >
> > Nop, I've checked, make-cleaned re-configured and tail-ed the config.log
and
> > it always ends there.
> >
> > Maybe I'm missing something, but I cannot seem to find conftest.c
anywhere
> > on the source tree.
> >
> > I've even searched the .tar.gz to check if it was accidentally deleted,
but
> > it's not there neither.
> >
> > I mean:
> >
> > gateway-1.3.2.tar.gz
> > Date: July 14 10:18
> > Size: 2,449,484
> >
> > It's a file that comes with the distribution or it's generated during
> > configure?
>
> yep, it's generated and deleted during configure run.
>
> Simply cut and paste the small snippet that is at the end of
> config.log and try to compile/link on your own.
>
> Stipe
>
> mailto:stolj_{at}_wapme.de
> -------------------------------------------------------------------
> Wapme Systems AG
>
> Vogelsanger Weg 80
> 40470 Düsseldorf, NRW, Germany
>
> phone: +49.211.74845.0
> fax: +49.211.74845.299
>
> mailto:info_{at}_wapme-systems.de
> http://www.wapme-systems.de/
> -------------------------------------------------------------------
>
> -----BEGIN PGP PUBLIC KEY BLOCK-----
> Version: GnuPG v1.2.2 (Cygwin)
>
> mIsEP6mcYwEEAMDnUiUwrbb+xwTFWN6TxF2+XZu7/alwJMeCwMBRvXtPZqfjpPhS
> OkBpU0F4TrVuugz1HINTSaJTYq10AzDQXp5NkyWgckqW79nPAWuOX0dicbJk+cN2
> nM2TI4KaxUDe6u8hghNEnH/i2lXsUu9apnP/iixzV81VC2je3uc9hZpnAAYptEVT
> dGlwZSBUb2xqIChUZWNobm9sb2d5IENlbnRlciAmIFJlc2VhcmNoIExhYikgPHRv
> bGpAd2FwbWUtc3lzdGVtcy5kZT6ItAQTAQIAHgUCP6mcYwIbAwYLCQgHAwIDFQID
> AxYCAQIeAQIXgAAKCRABV0w1BqPYRuSqA/wPzsQxao2YePENCtgRTrO86U6zg3sl
> OcS6CJFI4FZP5h/xD3GRsNH1+MPSvZlomDdpFnr547DGz/Kq9MXuQwVvlVig5yWZ
> K5dtKp1r5YLhxJQBhfirZbRFFnYmf19f18J8OoS28tuFVftDl1AIwJS3HLyBTv6H
> g2HyLAEKQIp30Q==
> =aYCI
> -----END PGP PUBLIC KEY BLOCK-----
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.