This page contains general instructions on building Berkeley DB for specific windows platforms using specific compilers. The Windows FAQ also contains helpful information.
The build_win32 directory in the Berkeley DB distribution contains project files for Microsoft Visual C++:
|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, Windows 98/ME and 64-bit Windows XP/2003.
This is very similar to the building with Visual Studio 2005, but some menu options have been rearranged:
The results of your build will be placed in a subdirectory of build_win32 named after the configuration you chose (for examples, build_win32\Release or build_win32\Debug).
When building your application during development, you should normally use compile options "Debug Multithreaded DLL" and link against build_win32\Debug\libdb44d.lib. You can also build using a release version of the Berkeley DB libraries and tools, which will be placed in build_win32\Release\libdb44.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_win32 directory to the list of include directories of your application's project, or copy the Berkeley DB include files to another location.
By default on Windows, Berkeley DB supports internationalized filenames by treating all directory paths and filenames passed to Berkeley DB methods as UTF-8 encoded strings. All paths are internally converted to wide character strings and passed to the wide character variants of Windows system calls.
This allows applications to create and open databases with names that cannot be represented with ASCII names while maintaining compatibility with applications that work purely with ASCII paths.
Windows 98 and ME do not support Unicode paths directly. To build for those versions of Windows, either follow the above instructions, choosing the "Debug ASCII" or "Release ASCII" build targets, or follow the instructions at Microsoft's web site.
The ASCII builds will also work on Windows NT/2K/XP and 2003, but will not translate paths to wide character strings.
The following procedure can be used on either to build natively on a 64-bit system or to cross-compile from a 32-bit system.
You will need latest Platform SDK from Microsoft, available from Microsoft's web site. You only need the "Core SDK" from there.
Once that is installed, you should have an entry in your Start Menu called Microsoft Platform SDK (date) -> Open Build Environment Window -> Windows Server 2003 64-bit Build Environment -> Set Win Svr 2003 x64 Build Env (Debug). Selecting that will open a command window with the environment set up for 64-bit Windows development targeting AMD64-compatible CPUs.
Depending on how your computer is configured, you may need to run the vcvars32.bat or script to set up the environment to build from the command line with Visual Studio.
Then, in the build_win32 directory in the Berkeley DB distribution, run this for Visual Studio .NET:
Choose "Yes To All" in the dialog box that appears, then close Visual Studio, then run:devenv Berkeley_DB.dsw
For Visual Studio 6, just run this instead:devenv Berkeley_DB.sln /build "Debug AMD64" /project "build_all" /useenv
You should now have AMD64 binaries in the "Debug_AMD64" directory.msdev Berkeley_DB.dsw /make "build_all - Debug AMD64" /useenv
To build a release, open the "Retail" window instead of the "Debug" window, and change Debug to Release in the above commands. To build for Itanium, change AMD64 and x64 to IA64.
To build Berkeley DB with Cygwin, follow the instructions in Building for UNIX.
C++ support is built automatically on Windows.
Java support 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.
To run Java code, set your environment variable CLASSPATH to include the full pathname of these jar files, 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). Then, try running the following command as a test:
If you want to run Java code using a Debug build, substitute 'Debug' for 'Release' in the instructions above. Make sure you use the Debug JAR file with the Debug DLL and the Release JAR with the Release DLL.
Tcl support is not built automatically. See Loading Berkeley DB with Tcl for information on sites from which you can download Tcl and which Tcl versions are compatible with Berkeley DB. These notes assume that Tcl is installed as d:\tcl, but you can change that if you want.
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 build Tcl from sources for the Debug configuration. Before building Tcl, you will need to modify its makefile to make sure that you are building a debug version, including thread support. This is because the set of DLLs linked into the Tcl executable must match the corresponding set of DLLs used by Berkeley DB.
If you use a version different from Tcl 8.4.x you will need to change the name of the Tcl library used in the build (for example, tcl84g.lib) to the appropriate name. To do this, right click on db_tcl, go to Properties -> Linker -> Input -> Additional dependencies and change tcl84g.lib to match the Tcl version you are using.
If you use a version different from Tcl 8.4.x you will need to change the name of the Tcl library used in the build (for example, tcl84g.lib) to the appropriate name. To do this, choose Project -> Settings -> db_tcl and change the Tcl library listed in the Object/Library modules tcl84g.lib to match the Tcl version you are using.
When distributing applications linked against the DLL (not static) version of the library, the DLL files you need will be found in the build_win32\Release subdirectory, or build_win32\Debug if you distribute a debug version. You may also need to redistribute DLL files needed for the compiler's runtime. For Visual C++ 6.0, these files are msvcrt.dll and msvcp60.dll if you built with a Release configuration, or msvcrtd.dll and msvcp60d.dll if you are using a Debug configuration. Generally, these runtime DLL files can be installed in the same directory that will contain your installed Berkeley DB DLLs. This directory may need to be added to your System PATH environment variable. Check your compiler's license and documentation for specifics on redistributing runtime DLLs.
Copyright (c) 1996-2005 Sleepycat Software, Inc. - All rights reserved.