Tuesday, January 3, 2012

Directadmin: Compile exim from source

If you have problem with exim such as: can not receive email ,error log return: internal problem in domain_filter router ,you should complile it from source is OK.


In this how-to, we'll outline how to install a fresh exim binary for your system. For compatibilities reasons, we'll make this a non-static binary, as since it's compiled right on your own system, you won't have any library issues.

We'll use exim 4.76 for this example.  Change all occurances of 4.76 to the version you want to use.
wget http://files.directadmin.com/services/custombuild/exim-4.76.tar.gz
tar xvzf exim-4.76.tar.gz
cd exim-4.76/Local
wget http://www.directadmin.com/Makefile
perl -pi -e 's/^EXTRALIBS/#EXTRALIBS/' Makefile
perl -pi -e 's/HAVE_ICONV=yes/HAVE_ICONV=no/' Makefile
cd ..
make
make install
This will give you a new /usr/sbin/exim-4.76-1 binary which won't be what you want.. you'll need to rename it to /usr/sbin/exim:
cp -f /usr/sbin/exim-4.76-1 /usr/sbin/exim
chmod 4755 /usr/sbin/exim

Remember to restart exim after you're finished.



**Note: If you can't download the exim-4.76.tar.gz from the above link, just go to www.exim.org and find a different link there.  It's the original source, unmodified by us, you can get it anywhere.


You may need to edit the Local/Makefile and remove the iconv section near the top:  HAVE_ICONV=no
if you see this error
rfc2047.o: In function `rfc2047_decode2':
rfc2047.c:(.text+0x395): undefined reference to `libiconv_open'
rfc2047.c:(.text+0x45a): undefined reference to `libiconv'
rfc2047.c:(.text+0x539): undefined reference to `libiconv_close'


For all OS's, you'll also need db4 dev, so type the following on debian
apt-get install libdb4.8-dev libperl-dev libsasl2-dev
or rpm systems:
yum install db4-devel cyrus-sasl-devel
or FreeBSD:
pkg_add -r cyrus-sasl2




If you get perl errors during the compile, you may need to edit the Local/Makefile, and set the values for:
PERL_CC, PERL_CCOPTS, and PERL_LIBS.

You can generate the values for those options with the following code:
 echo "PERL_CC=`/usr/bin/perl -MConfig -e 'print $Config{cc}'`"
echo "PERL_CCOPTS=`/usr/bin/perl -MExtUtils::Embed -e ccopts`"
echo "PERL_LIBS=`/usr/bin/perl -MExtUtils::Embed -e ldopts`"
Sample values for FreeBSD 7:
PERL_CC=cc
PERL_CCOPTS= -DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.8/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include  -I/usr/local/lib/perl5/5.8.8/mach/CORE
PERL_LIBS=  -Wl,-R/usr/local/lib/perl5/5.8.8/mach/CORE  -Wl,-E -L/usr/local/lib /usr/local/lib/perl5/5.8.8/mach/auto/DynaLoader/DynaLoader.a -L/usr/local/lib/perl5/5.8.8/mach/CORE -lperl -lm -lcrypt -lutil
Sample values for Debian 4:
PERL_CC=cc
PERL_CCOPTS= -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -I/usr/lib/perl/5.8/CORE
PERL_LIBS=-Wl,-E  -L/usr/local/lib /usr/lib/perl/5.8/auto/DynaLoader/DynaLoader.a -L/usr/lib/perl/5.8/CORE -ldl -lm -lpthread -lc -lcrypt
On debian, if you're missing any requird modules, without actually installing "exim4", you can use:
apt-get build-dep exim4
to install all dependancies that exim needs to compile, without installing the apt-get version of exim itself.

Debian 5 requires the libperl5.10 module. If you don't have it:
apt-get install libperl5.10
The above code will resolve the error:
exim: error while loading shared libraries: libperl.so.5.10: cannot open shared object file: No such file or directory

DirectAdmin

No comments:

Post a Comment

Thanks for your join,we will be reply to you asap.