Get the latest source code from postfix.org, check the blog for the latest checked version we used. I’m compiling Postfix with several options to help me achieve the flexibility and the security needed. We require the MySQL support for mail box maintenance, 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 filtering options 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 for both Intel and PowerPC based macs:
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:
For Intel:
CFLAGS='-arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk' \
CCARGS='-DUSE_TLS -DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
-I/usr/local/include/sasl \
-DHAS_PCRE -I/usr/local/include \
-DHAS_SSL -I/usr/include/openssl \
-DHAS_MYSQL -I/usr/local/mysql/include/mysql' \
AUXLIBS='-L/usr/lib -lldap -L/usr/lib -llber -L/usr/local/lib \
-L/usr/local/lib -lpcre \
-lssl -lsasl2 -L/usr/local/mysql/lib/mysql \
-lmysqlclient -lz -lm'
For PowerPC:
CFLAGS='-arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk' \
CCARGS='-DUSE_TLS -DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
-I/usr/local/include/sasl \
-DHAS_PCRE -I/usr/local/include \
-DHAS_SSL -I/usr/include/openssl \
-DHAS_MYSQL -I/usr/local/mysql/include/mysql' \
AUXLIBS='-L/usr/lib -lldap -L/usr/lib -llber -L/usr/local/lib \
-L/usr/local/lib -lpcre \
-lssl -lsasl2 -L/usr/local/mysql/lib/mysql \
-lmysqlclient -lz -lm'
To compile and install Postfix for both Intel and PowerPC 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. 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 Courier Auth library



3:29 am
I used your tutorials to add MySQL support to Postfix on OS X Leopard and things work great. However, I’ve noticed that there’s a warning message that pops up a lot in my system.log file. It looks like this:
Jan 25 20:42:09 postfix/smtpd[4039]: SQL engine ‘mysql’ not supported
Jan 25 20:42:09 postfix/smtpd[4039]: auxpropfunc error no mechanism available
Jan 25 20:47:35 postfix/smtpd[4047]: can’t access srvtab file krb__get_srvtabname() is no longer supported.: No such file or directory
Aditionaly, it’s broken Postfix support for native OS X user name log ons. That’s understandable of course since the OS X postfix comes configured for that. Anyone else see the errors above? Any suggestions on how to fix it?
6:36 am
Under Leopard 10.5.1 on intel.
Upon running ’sudo make install’ for Postfix I receive the following error:
Under the [src/smtpd] section …
Undefined symbols:
“_sasl_set_path”, referenced from:
_xsasl_cyrus_server_init in libxsasl.a(xsasl_cyrus_server.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [smtpd] Error 1
make: *** [update] Error 1
SASL 2.1.22 built and installed without issue. All previous directions were followed exactly as documented here.
Any ideas?
9:03 pm
Just got something similar with Tiger.
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: Undefined symbols:
_sasl_set_path
collect2: ld returned 1 exit status
make: *** [smtpd] Error 1
make: *** [update] Error 1
9:07 pm
Please do not use postfix 2.5.0 as there are errors with this release. Please use 2.4.7, I’m working on it…
10:58 pm
I was going through this install (great site, by the way), and tried postfix 2.5.1, even though you said not to. The issue I found was that the mysql and sasl includes were in different places. For the first “make”, I had to change them to:
-I/usr/include/sasl \
and
-DHAS_MYSQL -I/usr/local/mysql/include’ \
The first is probably because sasl is built in, so going to /usr instead /usr/local. The second is probably how I built it, as mysql was built before I came to this site.
I was hoping to avoid rebuilding postfix, but the stock Leopard postfix doesn’t have mysql support compiled in.
2:01 am
and to follow up, I have 2.5.1 working, by change the include page for the SASL. Is it possible that 2.5.1 fixed the issues you were talking about?
Again, great site. This helped me out a lot.
9:44 am
Thanks for mentioning this, I’ll check it out and I will update the documentation accordingly.
4:10 am
Hi, great info on this site.
I have found that i needed to add
export PATH=$PATH:/usr/local/mysql/bin
to successfully build courierauth and postfix.
also i get the following error in my logs.
Jan 25 20:42:09 postfix/smtpd[4039]: SQL engine
9:57 am
Got this on os x 10.5.4:
/sources/httpd-2.2.9/srclib/apr/libtool –silent –mode=link gcc -g -O2 -L/usr/bin -o ab ab.lo /sources/httpd-2.2.9/srclib/pcre/libpcre.la /sources/httpd-2.2.9/srclib/apr-util/libaprutil-1.la -lexpat -liconv /sources/httpd-2.2.9/srclib/apr/libapr-1.la -lpthread -lssl -lcrypto
Undefined symbols:
“_BIO_set_callback_arg”, referenced from:
_start_connect in ab.o
“_BIO_get_callback_arg”, referenced from:
_ssl_print_cb in ab.o
“_SSL_CTX_set_info_callback”, referenced from:
_main in ab.o
“_BIO_set_callback”, referenced from:
_start_connect in ab.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [ab] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1
7:54 pm
This worked for me:
Mac Mini C2D/1,83Ghz, leopard 10.5.4, mysql 5.0.67 (Mysql.com .dmg, 32-bit. NOT x64. x64 version = postfix compile errors)
make -f Makefile.init makefiles CFLAGS=’-arch i386 -isysroot /Developer/SDKs/Mac
OSX10.4u.sdk’ CCARGS=’-DUSE_TLS -DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
-I/usr/include/sasl \-DHAS_PCRE -I/usr/local/include \
-DHAS_SSL -I/usr/include/openssl \-DHAS_MYSQL -I/usr/local/mysql/include’ AUXLIBS=’-L/usr/lib -lldap -L/usr/lib -l
lber -L/usr/local/lib \
-L/usr/local/lib -lpcre \
-lssl -lsasl2 -L/usr/local/mysql/lib \
-lmysqlclient -lz -lm’
2:18 am
Hi I have installed everything as outlined and everything is a success except here. after I type sudo make install I get this error at the end in terminal:
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 1 exit status
make: *** [master] Error 1
make: *** [update] Error 1
any suggestions is well appreciated
6:14 am
@Rodrigo, you did not compile your MySQL installation therefore things go wrong. If you did which version of MySQL did you install?
10:26 pm
Hi,
I used the MySQL 5.0.81 version. Everything went forth just fine.
The only difference I see from the links above is this:
-DHAS_MYSQL -I/usr/local/mysql/include
2:48 am
this is the ouput of mysql_config:
sh-3.2# mysql_config
Usage: /usr/local/mysql/bin/mysql_config [OPTIONS]
Options:
–cflags [-I/usr/local/mysql/include/mysql -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT]
–include [-I/usr/local/mysql/include/mysql]
–libs [-L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lm]
–libs_r [-L/usr/local/mysql/lib/mysql -lmysqlclient_r -lz -lm]
–socket [/tmp/mysql.sock]
–port [0]
–version [5.0.81]
–libmysqld-libs [-L/usr/local/mysql/lib/mysql -lmysqld -lz -lm]
sh-3.2#
6:47 am
I don’t know about the effect Berkeley as I don’t have that one installed.
Besides the include files, also the pointer to the libraries must be correct. In your case it should be as the original instructions. Did you compile both for the same architecture (32 vs 64 bits).
6:01 pm
I uninstalled berkeley but still get the same errors. But yes I did compile for the 32 bit architecture. I followed all the instructions very closely. Everything went forth fine without errors until I got to this part.
How can I modify the pointer to the libraries so that they are correct? Or do you suggest that I uninstall everything and try again?
Also, since my Mac os x 10.5 already had an old version of postfix. Do you recommend I place the original postfix folder in the trash and try to install the new one? or to leave postfix in the /etc folder and just install the new one version 2.5.6 over it?
6:26 pm
Also,
Please excuse me, maybe I just don’t understand the concept of pointers to libraries. This is what I think:
this is the pointers in my system:
6:49 pm
rodrigo, you don’t need to remove postfix. It will be overwritten after a succesfull installation.
Your output of mysql_config tells me where everything should be located:
9:42 pm
for the line that says AUXLIBS=
10:22 pm
Also, I searched google for similar users with similar problems and when I typed this command in terminal sh-3.2# locate libmysqlclient
I got a long list of lines that look like this:
/Users/rodrigo/src/mysql-5.0.45/libmysql/.libs/libmysqlclient.15.0.0.dylib
and towards the bottom fewer lines that look like this:
/usr/local/mysql/lib/mysql/libmysqlclient.15.dylib
and
/usr/local/mysql-5.0.51b-osx10.5-x86/lib/libmysqlclient.15.dylib
which I don’t understand since the version of mysql that I installed is 5.0.81-osx10.5-x86
so I suppose the previous installations didn’t get deleted and the pointers are linking to them instead of my newer installation????
thank you for your help.
8:34 pm
Rodrigo, /usr/local/mysql is a symlink to /usr/local/mysql-5.0.51b-osx10.5-x86/ they are basically the same. If you upgrade using the source install it does not rename the directory.
2:33 am
Okay, so it seems that like you said I should try and remove mysql and do a fresh install correct? Nothing else I can try to fix the
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 1 exit status
make: *** [master] Error 1
make: *** [update] Error 1
???
7:29 pm
@Rodrigo, I gave you all the solutions I know that should have worked. If the re-install does not do the trick I’m lost.
I would need access to your machine, if you would allow, to solve this.
11:26 pm
I don’t want for you to go through all that trouble. I will try to to uninstall everything and restart. If I can’t get it to work what how do I contact you?
Thanks
12:18 am
Hi Richard,
I wanted to ask you for some help on this issue, could you email me? thanks
12:56 am
after reinstalling everything now I get the message:
This program built for powerpc-apple-darwin9.0
Report bugs to
after the series of commands that I copied for Intel from above. I do have a 32 bit Intel System.
6:34 am
Rodrigo, email is send!