Richard
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. When done 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 -lresolv -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 64 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’.



Comments
3:28 pm
I try to build Postfix (32-bit) with a 32-bit MySQL installation.
I had to change some library paths (e.g. /usr/local/mysql/lib/mysql to /usr/local/mysql/lib) but I still get an error when running sudo make install:
ld: warning: in /usr/local/mysql/lib/libmysqlclient.dylib, file is not of required architecture
On these pages you always refer to a 64-bit installation of MySQL but that shouldn’t be necessary, right?
3:58 pm
@Micke, there is still a difference in architectures: meaning a mix of 64 and 32 bits software which causes the problem. If you’ve installed mysql by first installing the binary version and then compile it everything should be going as documented and no changes are necessary.
7:59 am
Ok, I have now found that the MySQL installation is in fact 64-bit. At least that’s what the preference pane says in the title bar.
But when I try to compile Postfix in 64 bits I get the following error:
cc -arch x86_64 -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 -DBIND_8_COMPAT -DNO_NETINFO -DRESOLVE_H_NEEDS_ARPA_NAMESER_COMPAT_H -DNO_KQUEUE -g -O -I. -I../../include -DMACOSX -o error error.o ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a -L/usr/lib -llber -lresolv -L/usr/local/lib -L/usr/local/lib -lpcre -lssl -L/usr/local/mysql/lib -lmysqlclient -lz -lm -flat_namespace
ld: warning: in /usr/local/mysql/lib/libmysqlclient.dylib, file is not of required architecture
Undefined symbols:
“_mysql_free_result”, referenced from:
_dict_mysql_lookup in libglobal.a(dict_mysql.o)
_dict_mysql_lookup in libglobal.a(dict_mysql.o)
11:41 am
I answer myself now; it works if you follow the instructions…
I have been able to build all components.