Get the latest source code from www.postfix.org, check the blog for the latest tested version. I’m compiling Postfix with several options to help me achieve the flexibility and the security needed. We require the MySQL support for virtual mail box support, SASL for authentication and the SSL options to enable TLS support. Recently I found that PCRE support is also required if you want to use the complex filters in Postfix.
First you need to install the PCRE library (Perl Compatible Regular Expressions), to enable fancy filtering in Postfix. Download the source code from the site. You can compile and install it by running the following commands:
make
sudo make install
Unpack the Postfix source into a directory, use the Terminal and ‘cd’ into the directory where you unpacked it. Issue the following commands as a normal user:
CCARGS='-DUSE_TLS -DUSE_SASL_AUTH \
-DDEF_SERVER_SASL_TYPE=\"dovecot\" \
-DHAS_PCRE -I/usr/local/include \
-DHAS_SSL -I/usr/include/openssl \
-DHAS_MYSQL -I/usr/local/mysql/include/mysql' \
AUXLIBS='-L/usr/lib -llber -L/usr/local/lib \
-L/usr/local/lib -lpcre \
-lssl -L/usr/local/mysql/lib/mysql \
-lmysqlclient -lz -lm'
To compile and install Postfix run:
For the questions that are asked at the end of the compilation accept the default values.
Please note that for the dependencies on directories I’m assuming you’ve got MySQL installed from my previous instructions in 32 bits. If not please check the location of the MySQL files mentioned in the configuration. You can find out which configuration on your system is active by running the command ‘mysql_config’.
Next step: Building the Dovecot server in 32 bits on Leopard



7:03 am
I am getting the below error while compiling dict_mysql.c
** error mysql.h not found
Since the rest of the make looks for functions, make install is getting aborted. Are there any fix for the same ? Thanks.
7:15 am
Raja did you compile the MySQL as instructed in the earlier pages ?
http://diymacserver.com/installing-mysql/compiling-mysql-51x-in-32-bits-mode-on-leopard/
Besides the binary install you need to compile it to get the proper shared libraries.
7:51 am
Richard, thanks for the assistance, I figured out that the libraries in 10.5 did not actually exist in /usr/local/mysql/include/mysql but rather in /usr/local/mysql/include and so the above error cleared. But then I am again stuck with _dict_db_open in libutil.a(dict_db.o).
7:55 am
Update, the error is:
Undefined symbols:
“_db_version”, referenced from:
_dict_db_open in libutil.a(dict_db.o)
“_db_create”, referenced from:
_dict_db_open in libutil.a(dict_db.o)
ld: symbol(s) not found
collect2: ld returned in 1 exit status
make: *** [master] Error 1
make: *** [update] Error 1
9:45 am
The include files should be in /usr/local/mysql/include/mysql and the libs should be in /usr/local/mysql/lib/mysql. Please compile MySQL to make it work. The errors you are getting are becuase you did not compile MySQL as instructed
12:05 pm
Richard, I have compiled the MySQL as noted in your steps, but still I do get the same error.
2:11 am
Hi,
I just wanted to mention that I tried to follow this tutorial awhile ago unsuccessfully, I could not install postfix. I got similar errors as above but even with Richard’s help I couldn’t fix the problem.
I did as Richard suggested and reinstalled my whole system with the Mac os X discs. I then followed the tutorial, in some of the earlier parts I had to sign in as the root user in order to install Mysql properly, for some reason using the SU command didn’t let me install Mysql.
Well, as a normal user I followed this postfix tutorial and it went fine without any flaws. So if anyone is going through the problems I went through (because I had many instances of Mysql installed before) I suggest do what I did as a last resort, a complete clean install will set the mysql libs links properly as Richard always emphasizes.