[Dovecot] Compiling with SQL support
Bill Cole
dovecot-20061108 at billmail.scconsult.com
Sun Dec 9 18:41:21 EET 2007
At 9:08 PM +1100 12/9/07, Mark Smith wrote:
>Hello all,
>
>I am currently having a slight problem (ok well more likely me just
>not doing it right), with compiling Dovecot with MySQL support. The
>version is 1.0.8. I have tried running configure with --with-sql and
>--with-sql-drivers, but this however still does not compile MySQL
>support, I do no wish to install MySQL on this server, as I am using
>a network SQL server, but I do have the compiled source available on
>this server. I have tried running:
>
>gcc -shared -fPIC -DHAVE_CONFIG_H -DBUILD_MYSQL \
>-I../.. -I../lib -I../lib-settings -I/data/mysql/include/mysql \
>driver-mysql.c -o driver_mysql.so -lmysqlclient
>
>inside the /src/lib-sql, but this just returns an error that
>mysqlclient cannot be found.
This is really a gcc question that can be answered by reading the
output from 'man gcc' which includes the following relevant info
(I've added pointers for the crucial lines):
-llibrary
-l library
Search the library named library when linking. (The second alter-
native with the library as a separate argument is only for POSIX
compliance and is not recommended.)
It makes a difference where in the command you write this option;
the linker searches and processes libraries and object files in the
order they are specified. Thus, foo.o -lz bar.o searches library z
after file foo.o but before bar.o. If bar.o refers to functions in
z, those functions may not be loaded.
-------> The linker searches a standard list of directories for the library,
-------> which is actually a file named liblibrary.a. The linker then uses
-------> this file as if it had been specified precisely by name.
-------> The directories searched include several standard system directo-
-------> ries plus any that you specify with -L.
Normally the files found this way are library files---archive files
whose members are object files. The linker handles an archive file
by scanning through it for members which define symbols that have
so far been referenced but not defined. But if the file that is
found is an ordinary object file, it is linked in the usual fash-
ion. The only difference between using an -l option and specifying
a file name is that -l surrounds library with lib and .a and
searches several directories.
--
Bill Cole
bill at scconsult.com
More information about the dovecot
mailing list