### Berkeley DB Reference Guide: Building Berkeley DB XML for Windows systems |

### Building Berkeley DB XML for Windows

If you are working with the release of Berkeley DB XML that includes prebuilt binaries you do not need to build Berkeley DB XML, and you can proceed directly to Building Berkeley DB XML Examples for Windows. If you are working with the source release of Berkeley DB XML, or need to rebuild with different compiler options, or need to rebuild with a different compiler, then follow the build instructions below.

### Building Berkeley DB XML

The build_win32 directory in the Berkeley DB XML source distribution contains project files for Microsoft Visual C++:

Project File | Description
--- | ---
Berkeley_DB_XML.dsw | Visual C++ 6.0 workspace
*.dsp | Visual C++ 6.0 projects

These project files can be used to build Berkeley DB XML for any Win32 platform: Windows/XP, Windows/2000, Windows/NT, Windows/98 and Windows/95.

Berkeley DB XML makes use of some third-party libraries. Each of these packages is freely available and distributable under an Open Source license. To build Berkeley DB XML, you will need the following third-party libraries:

Berkeley DB
  Berkeley DB is a general purpose database toolkit.

  This release of Berkeley DB XML requires Sleepycat Software's Berkeley DB 4.1.25 release or higher. We recommend Berkeley DB 4.2.52. The project files expect to find Berkeley DB in the Berkeley DB XML lib/db-4.2.52 directory.

Pathan
  Pathan implements the XPath 1.0 language specification.

  This release of Berkeley DB XML requires DecisionSoft's Pathan 1.2 release 2 release or higher. The project files expect to find Pathan in the Berkeley DB XML lib/libpathan-1.2 directory.

Xerces-C++
  Xerces-C++ is the Apache implementation of DOM for C++.

  This release of Berkeley DB XML requires the Xerces C++ 2.4.0 release or newer. The project files expect to find Xerces in the Berkeley DB XML lib/xerces-c-src2_4_0 directory. To build Pathan from source, you need to have a source release of Xerces, not just a binary release. It is simplest to download xerces-c-src2_4_0.zip and unpack it into the lib directory.

  Note that Xerces C++ tarballs may fail to compile on Windows due to format problems with the Visual Studio project files.

### Building with Microsoft Visual C++ 6.0

To build all libraries from source, open the file build_win32/Berkeley_DB_XML.dsw. Next, select Active Project Configuration under the Build pull-down menu. For a debug version of the libraries and tools, select all -- Win32 Debug. Results from this build are put into build_win32/Debug. For a release version, select all -- Win32 Release; results are put into build_win32/Release. Finally, to build, select the Build menu option under the Build pull-down menu.

### Building with Microsoft Visual C++ .NET

To open build_win32/Berkeley_DB_XML.dsw in Visual C++ .NET choose Open Solution from the File menu. Then choose Compatible Workspace Files under Files of type. After you select the workspace, you will be prompted to upgrade the project files. Choose Yes to All. If the third party packages are not located within the lib/ directory then Visual C++ .NET will complain that the project files for those packages are corrupted. Ignore these complaints.

Next, select Configuration Manager under the Build pull-down menu. For a debug version of the libraries and tools, select Debug. Results from this build are put into build_win32/Debug. For a release version, select Release; results are put into build_win32/Release. Finally, to build, select the Build all menu option under the Build pull-down menu.

### Building with third-party libraries in other directories

Berkeley DB XML can be built with third-party libraries that are not located in the Berkeley DB XML lib/ directory. In Visual C++ open the Tools/Options tabbed dialog for adding directories. Add the include and library paths for the third-party libraries located elsewhere. To do this, select Options... from the Tools pull-down menu. In Visual C++ 6.0, a tabbed dialog should appear. Choose the Directories tab in the dialog, and for the Platform, select Win32. In Visual C++ .NET, a different window appears. Choose Projects, then VC++ Directories.

In either case, use Include files under Show directories for to add include directories, and Library files for library paths.

For Berkeley DB add the include path db-<version>, db-<version>/build_win32. Also add the library paths db-<version>/build_win32/Debug and db-<version>/build_win32/Release.

For the binary release of Xerces add the include path xerces-c-<version>/include and for the source or CVS release add xerces-c-<version>/src. Then for the binary release of Xerces add the library path xerces-c-<version>/lib, and for the source or CVS release add the appropriate build directory for your compiler, eg. xerces-c-<version>/build/win32/vc6/debug and xerces-c-<version>/build/win32/vc6/release.

The dbxml_java project includes a Custom Build Step that includes the path to the Berkeley DB .jar file three times. These must be changed to db-<version>/build_win32/debug/db.jar for the Debug configuration, and to db-<version>/build_win32/release/db.jar for the Release configuration.

### Building the Java API

The DB XML Java API is not built automatically. The following instructions assume that you have installed the Sun Java Development Kit in d:/java. Of course, if you installed elsewhere or have different Java software, you will need to adjust the pathnames accordingly.

Use the previous instructions for Visual C++ to open the Tools/Options window for adding these include directories: d:/java/include and d:/java/include/win32. These are the directories needed when including jni.h. Now, before clicking OK, choose Executable files under Show directories for. Add d:/java/bin. That directory is needed to find javac. Now select OK. Ensure that you have the CLASSPATH environment variable defined. At a minimum it should have the value ".", the current directory.

To build the DB XML Java API select Active Project Configuration under the Build pull-down menu. Choose dbxml_java -- Win32 Release. To build, select Build dbxml_java.dll under the Build pull-down menu. This builds the Java support library for Berkeley DB XML and compiles all the java files, placing the resulting dbxml.jar file in the build_win32/Release subdirectory of Berkeley DB XML.

In Visual C++ .NET, set the build type to Release in the drop down list on the toolbar, then right-click on dbxml_java and choose Build.

To make use of the Berkeley DB XML Java API set your environment variable CLASSPATH to include the full pathname of the dbxml.jar file, as well as the db.jar file from Berkeley DB, and your environment variable PATH to include the build_win32/Release subdirectory. On Windows, remember that files or directories in the CLASSPATH and PATH variables must be separated by semicolons (unlike UNIX).

### Building the Tcl API

Tcl support is not built automatically. See Loading Berkeley DB XML with Tcl for information on sites from which you can download Tcl and which Tcl versions are compatible with Berkeley DB XML.

The Tcl library must be built as the same build type as the Berkeley DB library (both Release or both Debug). We found that the binary release of Tcl can be used with the Release configuration of Berkeley DB, but you will need to need to build Tcl from sources for the Debug configuration.

These notes assume that Tcl is installed as d:/tcl, but you can change that if you want. If you run using a version of Tcl different from the one currently being used by Sleepycat Software, you will need to change the name of the Tcl library used in the build (for example, tcl84g.lib) to the appropriate name. See Projects->Settings->Link in the dbxml_tcl subproject.

Use the previous instructions for Visual C++ to open the Tools/Options window for adding include directories. In addition to the directories specified previously, add d:/tcl/include. This is the directory that contains tcl.h. Then, in that same window, choose Library Files under Show directories for. Add d:/tcl/lib (or whatever directory contains tcl84g.lib in your distribution) to the list. Now, select OK.

In Visual C++ 6.0, select Active Project Configuration under the Build pull-down menu. Choose dbxml_tcl -- Win32 Release. To build, select Build libdbxml_tcl12.dll under the Build pull-down menu. This builds the Tcl support library for Berkeley DB, placing the result into build_win32/Release/libdbxml_tcl12.dll. Selecting an Active Configuration of dbxml_tcl -- Win32 Debug will build a debug version, placing the result into build_win32/Debug/libdbxml_tcl12d.dll.

In Visual C++ .NET, choose the build type (Debug or Release) from the drop down list on the toolbar, then right-click on dbxml_tcl and choose Build.

### Reporting problems

If you have trouble with any of these commands, please send email to the support addresses found in the Sleepycat Software contact information. In that email, please include the following information:

- The version of Berkeley DB XML you are trying to build.
- The name and version of the C++ compiler you are using.
- The name and version of the operating system you are using.
- A cut and paste of any error messages generated by the compiler.

Copyright (c) 1996-2003 Sleepycat Software, Inc. - All rights reserved.