Dibbler - a portable DHCPv6  1.0.2RC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
  1. Compilation

Currently Dibbler supports several operating systems: Linux (2.4, 2.6, 3.0), Windows (NT4, 2000/XP/2003/Vista/Win7), Mac OS X, FreeBSD, NetBSD, OpenBSD and Solaris 11. Compilation process is system dependent, so it is described for various systems separately.

2.1 Posix compilation

To compile Dibbler or Posix complaint systems, extract sources, and type:

./configure
make client server relay requestor

to build client, server, relay and requestor. Although parser files are generated using flex and bison++ and those generated sources are included, so there is no need to generate them. To generate it if someone wants to generate it by hand instead of using those supplied versions, here are appropriate commands:

make parser

to generate client, server and relay parsers.

There occassionaly might be problem with compilation, when different flex version is installed in the system. Proper FlexLexer.h is provided in the SrvCfgMgr and ClntCfgMgr directories.

2.2 Linux Compilation

Please follow POSIX complilation guidelines (2.1 Posix compilation).

2.3 Mac OS X Compilation

Please follow POSIX complilation guidelines (2.1 Posix compilation).

2.4 FreeBSD/NetBSD/OpenBSD Compilation

Please follow POSIX complilation guidelines (2.1 Posix compilation).

2.5 Solaris 11 Compilation

Oracle Solaris 11 support is experimental. Please follow POSIX compilation guidelines (2.1 Posix compilation).

2.6 Autoconf and automake

Starting with 0.8.1RC1, Dibbler uses autotools. Usually developers do not have to use it. However, if you add new file, you need to modify Makefile.am. Also, if you added a new feature or dependency, you need to modify configure.ac. In such case, following procedure should be used to regenerate required build system files:

make maintainer-clean
autoreconf --install --force

Make maintainer-clean should remove all files generated by automake and autoconf. autoreconf should regenerate them. –force is used just in case if there are any files left and local version of automake or autoconf is older than the version that was used to generate existing files.

2.7 Windows XP/2003/Vista/Win7 compilation

To compile Dibbler under modern Windows systems, MS Visual Studio 2008 was used. Project files are provided in the SVN and source archives.

Please open solution file Port-win32/dibbler-win32.vs2008.sln in your Visual Studio 2008, then click Build solution in the Build menu.

Previously, Dibbler was built in Visual Studio 2003 and 2005. Project and solution files for those older versions may still be present in Port-win32 directory, but they may disappear anytime. Please upgrade to VS 2008 version.

2.8 Windows NT4/2000 compilation

Those 2 old Windows operating systems are only partially supported. Note that even Microsoft does not support IPv6 on those systems.

2.9 Flex and bison++ under Windows

Flex and bison++ tools are not required to successfully build Dibbler. They are only required, if changes are made to the parsers. Lexer and Parser files (ClntCfgMgr/ClntLexer.*, ClntCfgMgr/ClntParser.*, SrvCfgMgr/SrvLexer.*, SrvCfgMgr/SrvParser.*, RelCfgMgr/RelLexer.* and RelCfgMgr/RelParser.*) are generated by author and located in SVN and archives. There is no need to generate them. However, if you insist on doing so, there is an flex and bison binary included in port-win32. Take note that several modifications are required:

To generate ClntParser.cpp and ClntLexer.cpp files, you can use parser.bat. After generation, in file ClntLexer.cpp replace:

class istream;

with:

#include <iostream>
using namespace std;

lines. flex binary included is slightly modified. It generates

 #include "FlexLexer.h"

instead of

 #include <FlexLexer.h>

You should add .\ to include path if you have problem with missing FlexLexer.h. Also note that FlexLexer.h is modified (std:: added in several places,

<fstream.h>

is replaced with

<fstream>

etc.)

%% In file ClntParser.cpp, substitute line (around 1860):
%% ++yyvsp = yylval; with: *++yyvsp = ::yylval;
%% This trick is supposed to fix numerous parser problems.

Keep in mind that author is in no way a flex/bison guru and found this method in a painful trial-and-error way. Also, it is strongly recommended to get latest version of Flex/bison++ for Windows.

2.10 DEB and RPM Packages

Older Dibbler version allowed to generate RPM (RadHat, Fedora Core, Mandrake, PLD and lots of other distributions) and DEB (Debian, Knoppix and other) packages. They were not maintained at all, so this obsolete capability was dropped when build system was rewritten to use autotools.

There is a debian/ branch in GIT repo that contains older version of the debian scripts. It is NOT maintained. Please use scripts from the Debian repo directly: http://packages.debian.org/source/sid/dibbler and download dibbler_X.Y.Z-debian.tar.gz. Debian packages are maintained by Bartosz Fenski (mailto:fenio(at)debian(dot)org) and Michal Zubryk (mailto:michalz(at)zsl(dot)gda(dot)pl).

2.11 Cross-compilation for OpenWRT

Dibbler is also part of the OpenWRT Linux distribution intended to address broad range of embedded devices, like LinkSys routers and access points.

2.12 Ebuild script for Gentoo Linux

There is also ebuild script prepared for Gentoo users. It is located in the Port-linux/gentoo directory. Dibbler is also part of the Gentoo Linux distribution so make sure that you verify which version is the latest - provided by Gentoo or in the Dibbler sources.

Ebuild for Gentoo was created long time ago by author and then submitted to Gentoo community. Author no longer maintains it, but occasionally retrieves latest version from Gentoo repositories.

2.13 Dibbler in Linux distributions

Dibbler is available in several distributions:

  • Debian GNU/Linux – use standard tools (apt-get, aptitude) to install dibbler-client, dibbler-server, dibbler-relay or dibbler-doc packages (e.g. apt-get install dibbler-client)
  • Gentoo Linux – use emerge to install dibbler (e.g. emerge dibbler).
  • OpenWRT
  • Ubuntu Linux
  • PLD GNU/Linux – use standard PLD's poldek tool to install dibbler package.

2.14 Compilation environment

When compilation is being performed in non-standard envrionment, it is a good idea to examine and modify Makefile.inc file. Compiler name, compilation and link options, used libraries and debugging options can be modified there.

2.15 Changing default values

Custom builds might be prepared with different than default compilation options. Here is a list of features, which can be customised:

  • Default log level – please modify LOGMODE_DEFAULT define in Mish/Logger.h+.
  • Todo:

2.16 Modular features

In the 0.5.0 release, so called modular features were introduced. Those modules features are replaced by parameters passed to ./configure script in 0.8.1RC1. See output of

./configure --help

for a list of available parameters.

Currently the following features can be enabled (–enable-feature) or disabled (–disable-feature):

  • –enable-debug - This will change compilation flags, so the binaries will include debugging symbols and are easier to debug. This disables -O2 flag and enables -O0 (no optimization) and adds -g (include debugging symbols).
  • –enable-efence - This will link the code with electric fence, a popular memory debugger. Do not use it, unless you are a developer or were explicitely asked to enable it. Make sure that you have efence library installed in your system.
  • –enable-bind-reuse - When creating sockets, it is possible to configure socket options to allow binding the same address/port many times (SO_REUSEADDR flag passed to setsockopt). In certain cases this is convenient, so it is enabled by default.
  • –enable-dst-addr-check - When server receives a packet on a socket, it checks whether the destination address matches the address the socket is bound to. On some systems when there are 2 sockets - one bound to multicast address and second bound to unicast address - the packet is received twice. This check can drop the packet when received over the wrong interface. Disabled by default. Please enable this if you are receiving every packet twice.
  • –enable-resolvconf - Dibbler client may update /etc/resolv.conf to add, change or remove entries for DNS servers and domain names. There may be other processes in your system (e.g. pppd) that may do the same. In some cases this may cause the /etc/resolv.conf to become currupted. To manage such modifications, a tool called resolvconf was developed. If enable-resolvconf is passed, then dibbler will try to use that tool to update /etc/resolv.conf file. If resolvconf is not present if your PATH or support for it has been disabled, dibbler will update /etc/resolv.conf on its own.
  • –enable-dns-update - Dibbler server and client supports FQDN option that informs the client about its hostname. Together with IPv6 address that information can be added to the DNS using DNS Update mechanism. If you are not planning on using that feature, you may disable DNS Updates as it requires additional library called poslib. Disabling DNS Update will make the code smaller. Server will be able to assign FQDNs and client will be able to receive it, but either will be able to update DNS server.
  • –enable-auth - Dibbler implements its own custom authentication and authorization. It is described in section 4.15 of Dibbler User's Guide. If you are not planning on using it and are concerned about binary size, you may consider disabling it.
  • –enable-link-state - Dibbler client running on Linux is able to detect link state changes and act based on those changes, i.e. send CONFIRM messages after reconnecting. There is a slight overhard related to this. If you are not interested in detecting link changes, you may choose to not link this feature into your binary.
  • –enable-remote-autoconf - Dibbler implements remote autoconf mechanism described in (currently expired) draft draft-mrugalski-remote-dhcpv6-01. Enable this functionality only if you read that draft, understand it and plan to use it.

2.17 Cross-compilation

Since 0.6.1 version, dibbler supports cross-compilation. It was possible in previous versions, but with considerable amount of work.

Following description has been provided by Petr Pisar. Thanks!

In general, a toolchain has to be specified.

For autotools compilation driven (e.g. poslib), you need to call the configure script with –chost and –cbuild parameters describing toolchains used for compilation of binaries for platform where dibbler is supposted to run and for platform where compilation will be proceeded. configure should derive names of compiler for C (CC), C++ (CXX), name of binutils (e.g. strip) etc. automatically.

If you don't use autotools (like dibbler partially) or you want your own compilers, you need to export this variables manually (CC, CXX). If you want specify compiler for producing local binaries, use CC_FOR_BUILD and CXX_FOR_BUILD.

Next, if you want to optimize the binaries or to use some non-standard paths to header files or libraries, you need to export variables CFLAGS and LDFLAGS for C language and CXXFLAGS and LDFLAGS for C++. These variables apply for compilation for target platform. If you want tweak compilation of binaries for local building machine, use CFLAGS_FOR_BUILD, LDFLAGS_FOR_BUILD and CXXFLAGS_FOR_BUILD.

If you have all cross-compiled libraries under one directory (lets say image of root file system), you can use gcc argument –sysroot which allows to specify alternate directory tree, where all headers and libraries live.

Finally, you should tell to make by DESTDIR variable, where you want to install dibbler.

For example, the following command can be used to cross-compile dibbler for mipsel-softfloat-linux-gnu on i586-pc-linux-gnu having MIPS system installed under /var/tftp/mips32el-linux-gnu and all tool-chain utilities in PATH:

CBUILD=i586-pc-linux-gnu \
CC=mipsel-softfloat-linux-gnu-gcc \
CXX=mipsel-softfloat-linux-gnu-g++ \
CFLAGS='-march=4kc -msoft-float -Os -pipe -fomit-frame-pointer
--sysroot=/var/tftp/mips32el-linux-gnu' \
CXXFLAGS='-march=4kc -msoft-float -Os -pipe -fomit-frame-pointer
--sysroot=/var/tftp/mips32el-linux-gnu' \
LDFLAGS=--sysroot=/var/tftp/mips32el-linux-gnu \
CHOST=mipsel-softfloat-linux-gnu \
CC_FOR_BUILD=i586-pc-linux-gnu-gcc \
CFLAGS_FOR_BUILD='-march=k6-2 -O2 -pipe -fomit-frame-pointer' \
CXXFLAGS_FOR_BUILD='-march=k6-2 -O2 -pipe -fomit-frame-pointer' \
CXX_FOR_BUILD=i586-pc-linux-gnu-g++ \
LDFLAGS_FOR_BUILD= \
make -j1