Chapter 28.  Building Berkeley DB for Windows

Table of Contents

Building Berkeley DB for 32 bit Windows
Visual C++ .NET 2008
Visual C++ .NET 2005
Visual C++ .NET or Visual C++ .NET 2003
Visual C++ 6.0
Build results
Building Berkeley DB for 64-bit Windows
x64 build with Visual Studio 2005 or newer
x64 build with Visual Studio .NET 2003 or earlier
Building Berkeley DB with Cygwin
Building the C++ API
Building the C++ STL API
Building the Java API
Building Java with Visual C++ .NET or above
Building Java with Visual C++ 6.0
Building the C# API
Building C# with Visual Studio 2005
Building the Tcl API
Building Tcl with Visual C++ .NET or above
Building Tcl with Visual C++ 6.0
Distributing DLLs
Building a small memory footprint library
Running the test suite under Windows
Building the software needed by the tests
Running the test suite under Windows
Windows notes
Windows FAQ

This chapter contains general instructions on building Berkeley DB for specific windows platforms using specific compilers. The Windows FAQ also contains helpful information.

The build_windows directory in the Berkeley DB distribution contains project files for Microsoft Visual Studio:

Project File Description
Berkeley_DB.sln Visual Studio 2005 (8.0) workspace
*.vcproj Visual Studio 2005 (8.0) projects
Berkeley_DB.dsw Visual C++ 6.0 workspace
*.dsp Visual C++ 6.0 projects

These project files can be used to build Berkeley DB for the following platforms: Windows NT/2K/XP/2003/Vista, and 64-bit Windows XP/2003/Vista.

Building Berkeley DB for 32 bit Windows

Visual C++ .NET 2008

  1. Choose File -> Open -> Project/Solution.... In the build_windows directory, select Berkeley_DB.sln and click Open.
  2. The Visual Studio Conversion Wizard will open automatically. Click the Finish button.
  3. On the next screen click the Close button.
  4. Choose the desired project configuration from the drop-down menu on the tool bar (either Debug or Release).
  5. Choose the desired platform configuration from the drop-down menu on the tool bar (usually Win32 or x64).
  6. To build, right-click on the Berkeley_DB solution and select Build Solution.

Visual C++ .NET 2005

  1. Choose File -> Open -> Project/Solution.... In the build_windows directory, select Berkeley_DB.sln and click Open
  2. Choose the desired project configuration from the drop-down menu on the tool bar (either Debug or Release).
  3. Choose the desired platform configuration from the drop-down menu on the tool bar (usually Win32 or x64).
  4. To build, right-click on the Berkeley_DB solution and select Build Solution.

Visual C++ .NET or Visual C++ .NET 2003

NOTE: Although Visual Studio .NET uses solution files (.sln), the solution file shipped with Berkeley DB is not compatible with Visual Studio .NET. You need to upgrade from the Visual C++ 6.0 workspace to build with Visual C++ .NET or Visual C++ .NET 2003.

  1. Choose File -> Open Solution. Look in the build_windows directory for workspace files, select Berkeley_DB.dsw, and press Open.
  2. You will be prompted to convert the project files to current Visual C++ format. Select "Yes to All".
  3. Choose the project configuration from the drop-down menu on the .NET tool bar (Debug or Release).
  4. To build, right-click on build_all and select Build.

Visual C++ 6.0

  1. Choose File -> Open Workspace. Look in the build_windows directory for Workspaces, select Berkeley_DB.dsw, and press Open.
  2. Choose the desired project configuration by going to Build -> Set Active Configuration and select the appropriate option to the build_all project (Debug or Release). Then click OK.
  3. To build, press F7.

Build results

The results of your build will be placed in one of the following Berkeley DB subdirectories, depending on the configuration that you chose:

build_windows\Win32\Debug
build_windows\Win32\Release
build_windows\Win32\Debug_static
build_windows\Win32\Release_static

When building your application during development, you should normally use compile options "Debug Multithreaded DLL" and link against build_windows\Debug\libdb48d.lib. You can also build using a release version of the Berkeley DB libraries and tools, which will be placed in build_windows\Win32\Release\libdb48.lib. When linking against the release build, you should compile your code with the "Release Multithreaded DLL" compile option. You will also need to add the build_windows directory to the list of include directories of your application's project, or copy the Berkeley DB include files to another location.