Alejandro Guerrieri wrote:
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
hmmmmmm, sorry, that's all I could offer from remote.
Everything looks fine from here.
I guess you should try to dig into the configure[.in] process yourself or consult one of your local gurus.
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-----