Timo Sirainen wrote the following on 12.10.2012 14:50:
On 12.10.2012, at 10.45, Tamsy wrote:
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). If you run configure without adding the -lmysqlclient, what do you get with:
egrep -i 'mysql|auth_libs|sql_libs' Makefile
I guess the problem is that I shouldn't have copy&pasted the mysql detection code from php, and configure somehow passes successfully without actually setting any MYSQL_LIBS..
Just ran configure without adding the -lmysqlclient (CPPFLAGS='-I/opt/mysql/include/mysql' LDFLAGS='-L/opt/mysql/lib/mysql -lz -lcrypt -lnsl -lm' ./configure --with-mysql....
egrep -i 'mysql|auth_libs|sql_libs' Makefile
says:
AUTH_LIBS = CPPFLAGS = -I/opt/mysql/include/mysql LDFLAGS = $(NOPLUGIN_LDFLAGS) -L/opt/mysql/lib/mysql -lz -lcrypt -lnsl -lm MYSQL_CFLAGS = MYSQL_CONFIG = NO MYSQL_LIBS = PGSQL_LIBS = SQL_LIBS = sql_drivers = mysql scan-build -o scan-reports ../configure --with-ldap=auto --with-pgsql=auto --with-mysql=auto --with-sqlite=auto --with-solr=auto --with-gssapi=auto --with-libwrap=auto; \
configure runs without error but make ends with:
<snip>
../../src/lib-sql/.libs/libsql.a(driver-mysql.o): In function
driver_mysql_result_get_error': /usr/local/src/dovecot-2.1.10/src/lib-sql/driver-mysql.c:469: undefined reference to
mysql_errno'
/usr/local/src/dovecot-2.1.10/src/lib-sql/driver-mysql.c:470: undefined
reference to mysql_error' ../../src/lib-sql/.libs/libsql.a(driver-mysql.o): In function
driver_mysql_result_get_field_value_binary':
/usr/local/src/dovecot-2.1.10/src/lib-sql/driver-mysql.c:436: undefined
reference to mysql_fetch_lengths' ../../src/lib-sql/.libs/libsql.a(driver-mysql.o): In function
driver_mysql_result_fetch_fields':
/usr/local/src/dovecot-2.1.10/src/lib-sql/driver-mysql.c:383: undefined
reference to mysql_num_fields' /usr/local/src/dovecot-2.1.10/src/lib-sql/driver-mysql.c:384: undefined reference to
mysql_fetch_fields'
../../src/lib-sql/.libs/libsql.a(driver-mysql.o): In function
driver_mysql_result_next_row': /usr/local/src/dovecot-2.1.10/src/lib-sql/driver-mysql.c:366: undefined reference to
mysql_fetch_row'
/usr/local/src/dovecot-2.1.10/src/lib-sql/driver-mysql.c:370: undefined
reference to mysql_errno' ../../src/lib-sql/.libs/libsql.a(driver-mysql.o): In function
driver_mysql_result_free':
/usr/local/src/dovecot-2.1.10/src/lib-sql/driver-mysql.c:351: undefined
reference to mysql_free_result' ../../src/lib-sql/.libs/libsql.a(driver-mysql.o): In function
driver_mysql_do_query':
/usr/local/src/dovecot-2.1.10/src/lib-sql/driver-mysql.c:233: undefined
reference to mysql_query' /usr/local/src/dovecot-2.1.10/src/lib-sql/driver-mysql.c:237: undefined reference to
mysql_errno'
../../src/lib-sql/.libs/libsql.a(driver-mysql.o): In function
driver_mysql_query_s': /usr/local/src/dovecot-2.1.10/src/lib-sql/driver-mysql.c:315: undefined reference to
mysql_affected_rows'
/usr/local/src/dovecot-2.1.10/src/lib-sql/driver-mysql.c:316: undefined
reference to mysql_store_result' /usr/local/src/dovecot-2.1.10/src/lib-sql/driver-mysql.c:321: undefined reference to
mysql_next_result'
/usr/local/src/dovecot-2.1.10/src/lib-sql/driver-mysql.c:332: undefined
reference to mysql_free_result' /usr/local/src/dovecot-2.1.10/src/lib-sql/driver-mysql.c:327: undefined reference to
mysql_errno'
../../src/lib-sql/.libs/libsql.a(driver-mysql.o): In function
driver_mysql_exec': /usr/local/src/dovecot-2.1.10/src/lib-sql/driver-mysql.c:284: undefined reference to
mysql_error'
../../src/lib-sql/.libs/libsql.a(driver-mysql.o): In function
driver_mysql_escape_string': /usr/local/src/dovecot-2.1.10/src/lib-sql/driver-mysql.c:274: undefined reference to
mysql_real_escape_string'
/usr/local/src/dovecot-2.1.10/src/lib-sql/driver-mysql.c:268: undefined
reference to mysql_escape_string' ../../src/lib-sql/.libs/libsql.a(driver-mysql.o): In function
driver_mysql_connect':
/usr/local/src/dovecot-2.1.10/src/lib-sql/driver-mysql.c:83: undefined
reference to mysql_options' /usr/local/src/dovecot-2.1.10/src/lib-sql/driver-mysql.c:87: undefined reference to
mysql_options'
/usr/local/src/dovecot-2.1.10/src/lib-sql/driver-mysql.c:92: undefined
reference to mysql_ssl_set' /usr/local/src/dovecot-2.1.10/src/lib-sql/driver-mysql.c:110: undefined reference to
mysql_real_connect'
/usr/local/src/dovecot-2.1.10/src/lib-sql/driver-mysql.c:123: undefined
reference to mysql_error' ../../src/lib-sql/.libs/libsql.a(driver-mysql.o): In function
driver_mysql_deinit_v':
/usr/local/src/dovecot-2.1.10/src/lib-sql/driver-mysql.c:226: undefined
reference to mysql_close' ../../src/lib-sql/.libs/libsql.a(driver-mysql.o): In function
driver_mysql_parse_connect_string':
/usr/local/src/dovecot-2.1.10/src/lib-sql/driver-mysql.c:198: undefined
reference to mysql_init' collect2: ld returned 1 exit status make[3]: *** [auth] Error 1 make[3]: Leaving directory
/usr/local/src/dovecot-2.1.10/src/auth'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory /usr/local/src/dovecot-2.1.10/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory
/usr/local/src/dovecot-2.1.10'
make: *** [all] Error 2