Timo Sirainen wrote the following on 12.10.2012 14:34:
On 12.10.2012, at 10.02, dove...@freakout.de wrote:
According to Timo Sirainen:
Simply specifying -I or -L paths doesn't link with libmysql. What exactly did
you use for CPPFLAGS/LDFLAGS/configure?
ok - i specified: CFLAGS="-I/opt/zlib/include -I/opt/ssl/include
-I/opt/mysql/include"
LDFLAGS="-L/opt/zlib/lib -L/opt/ssl/lib -L/opt/mysql/lib
-lmysqlclient"
-lmysqlclient shouldn't be in LDFLAGS.
if i omit "-lmysqlclient" (seems to be the reason for the hassle) i get:
libtool: link: gcc4 -std=gnu99 -g -I/opt/zlib/include -I/opt/ssl/include
-I/opt/mysql/include -Wall -W -Wmissing-prototypes -Wmissing-declarations
-Wpointer-arith -Wchar-subscripts -Wformat=2 -Wbad-function-cast
-fno-builtin-strftime -Wstrict-aliasing=2 -I/opt/ssl/include -o .libs/auth
auth.o auth-cache.o auth-client-connection.o
auth-master-connection.o auth-postfix-connection.o mech-otp-skey-common.o
mech-plain-common.o auth-penalty.o auth-request.o auth-request-handler.o
auth-settings.o auth-stream.o auth-worker-client.o auth-worker-server.o
db-checkpassword.o db-dict.o db-sql.o db-passwd-file.o main.o mech.o
mech-anonymous.o mech-plain.o mech-login.o
mech-cram-md5.o mech-digest-md5.o mech-external.o mech-gssapi.o mech-ntlm.o
mech-otp.o mech-scram-sha1.o mech-skey.o mech-rpa.o mech-apop.o mech-winbind.o
passdb.o passdb-blocking.o passdb-bsdauth.o passdb-cache.o
passdb-checkpassword.o passdb-dict.o passdb-passwd.o passdb-passwd-file.o
passdb-pam.o passdb-shadow.o passdb-sia.o
passdb-vpopmail.o passdb-sql.o passdb-static.o passdb-template.o userdb.o
userdb-blocking.o userdb-checkpassword.o userdb-dict.o userdb-nss.o
userdb-passwd.o userdb-passwd-file.o userdb-prefetch.o userdb-static.o
userdb-vpopmail.o userdb-sql.o userdb-template.o db-ldap.o passdb-ldap.o
userdb-ldap.o -Wl,--export-dynamic -L/opt
/zlib/lib -L/opt/ssl/lib -L/opt/mysql/lib libpassword.a ../lib-ntlm/libntlm.a
../lib-otp/libotp.a ../../src/lib-sql/.libs/libsql.a
../../src/lib-dovecot/.libs/libdovecot.so -lcrypt -ldl -Wl,-rpath
-Wl,/opt/dovecot/lib
../../src/lib-sql/.libs/libsql.a(driver-mysql.o): In function
`driver_mysql_connect':
/usr/src/rpm/BUILD/dovecot-2.1.10/src/lib-sql/driver-mysql.c:83: undefined
reference to `mysql_options'
... tons of other undefined reference to mysqlclient
/usr/src/rpm/BUILD/dovecot-2.1.10/src/lib-sql/driver-mysql.c:470: undefined
reference to `mysql_error'
collect2: error: ld returned 1 exit status
I'm not sure why it's doing that. It really shouldn't. You could try
SQL_LIBS=-lmysqlclient or AUTH_LIBS=-lmysqlclient or MYSQL_LIBS=-lmysqlclient
if one of them helps.
Axel, please let us know whether one of these works:
"SQL_LIBS=-lmysqlclient or AUTH_LIBS=-lmysqlclient or
MYSQL_LIBS=-lmysqlclient".
Since Dovecot 1.x all the way up to 2.1.10 I had trouble with this and
only by putting -lmysqlclient in LDFLAGS as described before Dovecot
compiles without error (Ubuntu Server 8.04 & 10.04, mySQL in a
non-standart location).