ISC BIND 9.10.x - How to compile it for Linux, Solaris and Windows
Download BIND 9.10.x
http://www.isc.org/downloads/
Can try to search on their FTP ftp://ftp.isc.org/isc/
Mirrors:
http://ftp.riken.jp/net/bind
http://www.mirrorservice.org/sites/ftp.isc.org/isc/bind9
Linux and Solaris 64 bit
Copy and extract the compressed file bind-9.10.1-P1.tar.gz
cd /opt/mydns/bind910
tar -xvf bind-9.10.1-P1.tar.gz
cd bind-9.10.1-P1
mkdir linux
mkdir linux/bind9101p1
# mkdir solaris
But first, we have to compile 3rd party libraries: OpenSSL, Libxml2, Kerberos
All of them have to be Static and 64 bit
Put them at /opt/buildtools
- http://tuan.nguoianphu.com/OpenSSL_compile_for_Linux_Solaris_Windows
- http://tuan.nguoianphu.com/LibXML2_compile_for_Linux_Solaris_Windows
- http://tuan.nguoianphu.com/Kerberos_compile_for_Linux_Solaris_Windows
Create a new configure file config_bind.sh to compile BIND.
Put it in /opt/mydns/bind910/bind-9.10.1-P1
#!/bin/sh ##################################################################### # A configured script to compile ISC BIND in Solaris and Linux in 64 bit # Use 3rd party libraries: OpenSSL, Libxml2, Kerberos # vohungtuan@gmail.com Dec-16-2014 ##################################################################### rm="/bin/rm -f" $rm ./lib/bind/config.log $rm ./lib/bind/config.status $rm ./config.log $rm ./config.status if [ ."$PLATFORM" = . ]; then echo "Set PLATFORM env variable first. exiting" exit fi if [ "$PLATFORM" = "linux" -o $PLATFORM = "linux-gcc3" -o $PLATFORM = "linux-gcc4" ]; then # Use this if development # CFLAGS="-g -m64"; export CFLAGS # production build CFLAGS="-O2 -m64"; export CFLAGS fi if [ "$PLATFORM" = "solaris-2.x" ]; then # needs at least studio12 CC v 5.9 CFLAGS="-xO3 -m64"; export CFLAGS # Development # CFLAGS="-g -m64"; export CFLAGS # CFLAGS="-g"; export CFLAGS fi if [ "$PLATFORM" = "solaris-x86" ]; then # CFLAGS="-g -m64"; export CFLAGS CFLAGS="-xO3 -m64"; export CFLAGS fi STD_CDEFINES="-DUNIX -DEDUP -DGSSRH_MINI -DUPDSEC -DPUSH -DNTFYAL"; export STD_CDEFINES # 64 bit versions of 3rd party libraries: OpenSSL, Libxml2, Kerberos krb_dir=/opt/buildtools/kerberos/kerberos_64bit openssl_dir=/opt/buildtools/openssl/openssl_64bit libxml2_dir=/opt/buildtools/libxml2/linux-gcc3 sh ../configure --prefix=/opt/mydns/bind910/bind-9.10.1-P1/linux/bind9101p1 \ --enable-largefile \ --enable-fixed-rrset \ --enable-filter-aaaa \ --enable-threads \ --with-openssl=$openssl_dir \ --with-gssapi=$krb_dir \ --with-libxml2=$libxml2_dir
Edit these lines to match your machine's configuration
# 64 bit versions of 3rd party libraries: OpenSSL, Libxml2, Kerberos
krb_dir=/opt/buildtools/kerberos/kerberos_64bit
openssl_dir=/opt/buildtools/openssl/openssl_64bit
libxml2_dir=/opt/buildtools/libxml2/linux-gcc3
.....
--prefix=/opt/mydns/bind910/bind-9.10.1-P1/linux/bind9101p1
Compile the BIND source
export PLATFORM=linux-gc33
cd /opt/mydns/bind910/bind-9.10.1-P1
chmod +x config_bind.sh
cd linux
../config_bind.sh
make
make install
cd bind9101p1/sbin
./named -v
./named -V
Windows 64 bit
It's easy to build BIND with VS 2010 because the ISC team use it to develop BIND 9.9.x and 9.10.x.
Copy and extract the compressed file bind-9.10.1-P1.tar.gz to C:\bind
We have to compile 3rd party libraries: OpenSSL, Libxml2, Kerberos
Built them as static and 64 bit for Windows.
Put them at C:\buildtools
- http://tuan.nguoianphu.com/OpenSSL_compile_for_Linux_Solaris_Windows
- http://tuan.nguoianphu.com/LibXML2_compile_for_Linux_Solaris_Windows
- http://tuan.nguoianphu.com/Kerberos_compile_for_Linux_Solaris_Windows
However, there are some errors when compile the ISC BIND. The root cause comes from BIND configured file (OMG!).
So we must do these steps for the 3rd party libraries:
Openssl
COPY
C:\buildtools\openssl\openssl-1.0.1j\win64\include
TO
C:\buildtools\openssl\openssl-1.0.1j\win64\inc32
COPY the FILES inside
C:\buildtools\openssl\openssl-1.0.1j\win64\bin
AND the FILES inside
C:\buildtools\openssl\openssl-1.0.1j\win64\lib
TO
C:\buildtools\openssl\openssl-1.0.1j\win64\out32dll
Kerberos
COPY the FILES inside
C:\buildtools\kerberos\krb5-1.13\win64\lib
TO
C:\buildtools\kerberos\krb5-1.13\win64\lib\amd64
Libxml2
COPY the FILES inside
C:\buildtools\libxml2\libxml2-2.9.2\win64\lib
AND the FILES inside
C:\buildtools\libxml2\libxml2-2.9.2\win64\bin
TO
C:\buildtools\libxml2\libxml2-2.9.2\win64\win32\bin.msvc
Run configuration for source code
Go to C:\bindbind-9.10.1-P1\win32utils
There is a error in the Configure file, we have to hack it :(
Open the Configure and replace this line:
if (!grep { -f and -x } $vcredist_path) {
TO
if (grep { -f and -x } $vcredist_path) {
BIND 9.10.1-P1: Line 2272
If you use Visual Studio 2013 to compile BIND9, please also do this hack:
die "can't get _MSC_VER value: $compretn";
TO
# die "can't get _MSC_VER value: $compretn";
$msc_ver=1800
# MSVC 12.0 _MSC_VER == 1800 (VS 2013)
Skip these steps if you done when compiling Kerberos.
- We have to install Perl (Active Perl) and Python (Active Python).
- And the gawk tool.
Extract it to C:\gawk
- Install Cygwin to get or find these files:
grep.exe
mv.exe
rm.exe
cat.exe
sed.exe
Copy them to C:\gawk\bin
Open cmd and do these steps:
(make sure the above tools and Python can run in your cmd!)
SET PATH=%PATH%;C:\gawk\bin;C:\Python32
For using Visual Studio 2010 to compile BIND9
cd C:\bindbind-9.10.1-P1\win32utils
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" amd64
perl Configure x64 with-openssl=C:\buildtools\openssl\openssl-1.0.1j\win64 with-libxml2=C:\buildtools\libxml2\libxml2-2.9.2\win64 with-gssapi=C:\buildtools\kerberos\krb5-1.13\win64 with-vcredist="C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC"
OK, let's compile it!
msbuild /t:Clean,Build /p:Configuration=Release
For using Visual Studio 2013 to compile BIND9
cd C:\bindbind-9.10.1-P1\win32utils
call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64
set INCLUDE=C:\Program Files (x86)\Windows Kits\8.1\Include\um;C:\Program Files (x86)\Windows Kits\8.1\Include\shared;%INCLUDE%
set LIB=C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3um\x64;%LIB%
perl Configure x64 with-openssl=C:\buildtools\openssl\openssl-1.0.1j\win64 with-libxml2=C:\buildtools\libxml2\libxml2-2.9.2\win64 with-gssapi=C:\buildtools\kerberos\krb5-1.13\win64 with-vcredist="C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC"
OK, let's compile it!
msbuild /p:PlatformToolset="v120_xp" /p:Configuration="Release" /t:Clean,Build