Bacula Enterprise Edition Documentation text image transdoc
Search

Main


Bacula Porting Notes

This document is intended mostly for developers who wish to port Bacula to a system that is not officially supported.

It is hoped that Bacula clients will eventually run on every imaginable system that needs backing up (perhaps even a Palm). It is also hoped that the Bacula Directory and Storage daemons will run on every system capable of supporting them.


Porting Requirements

In General, the following holds true:

  • Bacula has been compiled and run on Linux RedHat, FreeBSD, and Solaris systems.
  • In addition, clients exist on Win32, and Irix
  • It requires GNU C++ to compile. You can try with other compilers, but you are on your own. The Irix client is built with the Irix complier, but, in general, you will need GNU.
  • Your compiler must provide support for 64 bit signed and unsigned integers.
  • You will need a recent copy of the autoconf tools loaded on your system (version 2.13 or later). The autoconf tools are used to build the configuration program, but are not part of the Bacula source distribution.
  • There are certain third party packages that Bacula needs. Except for MySQL, they can all be found in the depkgs and depkgs1 releases.
  • To build the Win32 binaries, we use Microsoft VC++ standard 2003. Please see the instructions in bacula-source/src/win32/README.win32 for more details. If you want to use VC++ Express, please see README.vc8. Our build is done under the most recent version of Cygwin, but Cygwin is not used in the Bacula binaries that are produced. Unfortunately, we do not have the resources to help you build your own version of the Win32 FD, so you are pretty much on your own. You can ask the bacula-devel list for help, but please don't expect much.
  • Bacula requires a good implementation of pthreads to work.
  • The source code has been written with portability in mind and is mostly POSIX compatible. Thus porting to any POSIX compatible operating system should be relatively easy.


Steps to Take for Porting

  • The first step is to ensure that you have version 2.13 or later of the autoconf tools loaded. You can skip this step, but making changes to the configuration program will be difficult or impossible.
  • The run a ./configure command in the main source directory and examine the output. It should look something like the following:

    Configuration on Mon Oct 28 11:42:27 CET 2002:
      Host:                        i686-pc-linux-gnu -- redhat 7.3
      Bacula version:              1.27 (26 October 2002)
      Source code location:        .
      Install binaries:            /sbin
      Install config files:        /etc/bacula
      C Compiler:                  gcc
      C++ Compiler:                c++
      Compiler flags:              -g -O2
      Linker flags:
      Libraries:                   -lpthread
      Statically Linked Tools:     no
      Database found:              no
      Database type:               Internal
      Database lib:
      Job Output Email:            root@localhost
      Traceback Email:             root@localhost
      SMTP Host Address:           localhost
      Director Port                9101
      File daemon Port             9102
      Storage daemon Port          9103
      Working directory            /etc/bacula/working
      SQL binaries Directory
      Large file support:          yes
      readline support:            yes
      cweb support:                yes /home/kern/bacula/depkgs/cweb
      TCP Wrappers support:        no
      ZLIB support:                yes
      enable-smartalloc:           yes
      enable-gnome:                no
      gmp support:                 yes
    

    The details depend on your system. The first thing to check is that it properly identified your host on the Host: line. The first part (added in version 1.27) is the GNU four part identification of your system. The part after the - is your system and the system version. Generally, if your system is not yet supported, you must correct these.

  • If the ./configure does not function properly, you must determine the cause and fix it. Generally, it will be because some required system routine is not available on your machine.
  • To correct problems with detection of your system type or with routines and libraries, you must edit the file <bacula-src>/autoconf/configure.in. This is the source from which configure is built. In general, most of the changes for your system will be made in autoconf/aclocal.m4 in the routine BA_CHECK_OPSYS or in the routine BA_CHECK_OPSYS_DISTNAME. I have already added the necessary code for most systems, but if yours shows up as unknown you will need to make changes. Then as mentioned above, you will need to set a number of system dependent items in configure.in in the case statement at approximately line 1050 (depending on the Bacula release).
  • The items to in the case statement that corresponds to your system are the following:

    • DISTVER - set to the version of your operating system. Typically some form of uname obtains it.
    • TAPEDRIVE - the default tape drive. Not too important as the user can set it as an option.
    • PSCMD - set to the ps command that will provide the PID in the first field and the program name in the second field. If this is not set properly, the bacula stop script will most likely not be able to stop Bacula in all cases.
    • hostname - command to return the base host name (non-qualified) of your system. This is generally the machine name. Not too important as the user can correct this in his configuration file.
    • CFLAGS - set any special compiler flags needed. Many systems need a special flag to make pthreads work. See cygwin for an example.
    • LDFLAGS - set any special loader flags. See cygwin for an example.
    • PTHREAD_LIB - set for any special pthreads flags needed during linking. See freebsd as an example.
    • lld - set so that a long long int will be properly edited in a printf() call.
    • llu - set so that a long long unsigned will be properly edited in a printf() call.
    • PFILES - set to add any files that you may define is your platform subdirectory. These files are used for installation of automatic system startup of Bacula daemons.

  • To rebuild a new version of configure from a changed autoconf/configure.in you enter make configure in the top level Bacula source directory. You must have done a ./configure prior to trying to rebuild the configure script or it will get into an infinite loop.
  • If the make configure gets into an infinite loop, ctl-c it, then do ./configure (no options are necessary) and retry the make configure, which should now work.
  • To rebuild configure you will need to have autoconf version 2.57-3 or higher loaded. Older versions of autoconf will complain about unknown or bad options, and won't work.
  • After you have a working configure script, you may need to make a few system dependent changes to the way Bacula works. Generally, these are done in src/baconfig.h. You can find a few examples of system dependent changes toward the end of this file. For example, on Irix systems, there is no definition for socklen_t, so it is made in this file. If your system has structure alignment requirements, check the definition of BALIGN in this file. Currently, all Bacula allocated memory is aligned on a double boundary.
  • If you are having problems with Bacula's type definitions, you might look at src/bc_types.h where all the types such as uint32_t, uint64_t, etc. that Bacula uses are defined.