- Berkeley DB Reference Guide:
- Building Berkeley DB for Windows systems
|
|
Building for Win32
The build_win32 directory in the Berkeley DB distribution contains
project files for Microsoft Visual C++:
Project File | Description |
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 any Win32 platform:
Windows/XP, Windows/2000, Windows/NT, Windows/98 and Windows/95.
The build_win64 directory contains project files for Microsoft
Visual C++ to target Windows on 64-bit CPUs:
Building Berkeley DB with Visual C++ .NET for Win32
- Choose File -> Open Solution. Look in the
build_win32 directory for compatible workspace files, select
Berkeley_DB.dsw, and press Open.
- You will be prompted to convert the project files to Visual C++ 7.0
project format. Select "Yes to All".
- Set your include directories. Choose Tools -> Options
-> Projects -> VC++ Directories. Under the "Show
directories for" pulldown, select "Include files". Add the full
pathnames for the build_win32 subdirectory of Berkeley DB.
Then click OK.
- Choose the project configuration from the drop-down menu on the .NET
tool bar (Debug, Release, Debug Static or Release Static).
- To build, right-click on build_all and select Build. 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).
Building Berkeley DB with Visual C++ 6.0 for Win32
- Choose File -> Open Workspace. Look in the
build_win32 directory for Workspaces, select
Berkeley_DB.dsw, and press Open.
- Set your include directories. Choose Tools -> Options
-> Directories. Under the "Show directories for" pulldown,
select "Include files". Add the full pathnames for the
build_win32 subdirectory of Berkeley DB. Then click OK.
- Choose the desired project configuration by going to Build
-> Set Active Configuration and select the appropriate option
to the build_all project (Debug, Release, Debug Static or Release
Static). Then click OK.
- To build, select Build -> Build build_all.exe. 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, you should normally use compile
options "Debug Multithreaded DLL" and link against
build_win32/Debug/libdb43d.lib. If you
want to link against a static (non-DLL) version of the library, use
the "Debug Multithreaded" compile options and link against
build_win32/Debug_static/libdb43sd.lib.
You can also build using a release version of the libraries and tools,
which will be placed in
build_win32/Release/libdb43.lib. The
static version will be in
build_win32/Release_static/libdb43s.lib.
You will also need to add the build_win32 directory to the
list of include directories of your application's project.
Each release of Berkeley DB is built and tested with this procedure using
Microsoft Visual C++ 6.0, Standard Version and Microsoft Visual C++
.NET, Standard Version.
Building Berkeley DB for 64-bit Windows
You can follow the same steps on either the Itanium itself or to
cross-compile on an x86 box.
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 Build Env (Debug). Selecting that will open
a command window with the environment set up for Itanium development.
Then, in the build_win64 directory in the Berkeley DB distribution,
run:
msdev /useenv BerkeleyDB.dsw /make "build_all - Debug"
You should now have Itanium binaries in the "Debug" directory.
To build a release, open the "Retail" window instead of the "Debug"
window, and run:
msdev /useenv BerkeleyDB.dsw /make "build_all - Release"
There may be some warnings during build, but we don't believe any of
them are real bugs.
Building Berkeley DB with Cygwin
To build Berkeley DB with Cygwin, follow the instructions in
Building for UNIX.
Building the C++ API
C++ support is built automatically on Win32.
Building the Java API
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.
Building Java with Visual C++ .NET
- Set your include directories. Choose Tools -> Options
-> Projects -> VC++ Directories. Under the "Show
directories for" pulldown, select "Include files". Add the full
pathnames for the java/include and
java/include/win32 directories. Then click OK. These are
the directories needed when including jni.h.
- Set the executable files directories. Choose Tools ->
Options -> Projects -> VC++ Directories. Under the "Show
directories for" pulldown, select "Executable files". Add the full
pathname for the java/bin directory, then click OK. This is
the directory needed to find javac.
- Set the build type to Release or Debug in the drop-down on the .NET
tool bar.
- To build, right-click on db_java and select Build. This builds the
Java support library for Berkeley DB and compiles all the java files,
placing the resulting db.jar and dbexamples.jar
files in the build_win32/Release or
build_win32/Debug subdirectory of Berkeley DB.
Building Java with Visual C++ 6.0
- Set the include directories. Choose Tools -> Options
-> Directories. Under the "Show directories for" pulldown,
select "Include files". Add the full pathnames for the
java/include and java/include/win32 directories.
These are the directories needed when including jni.h.
- Set the executable files directories. Choose Tools ->
Options -> Directories. Under the "Show directories for"
pulldown, select "Executable files". Add the full pathname for the
java/bin directory. This is the directory needed to find
javac.
- Go to Build -> Set Active Configuration and select
either the Debug or Release version of the db_java project. Then
press OK.
- To build, select Build -> Build
libdb_java43.dll. This builds the Java support
library for Berkeley DB and compiles all the java files, placing the
resulting db.jar and dbexamples.jar files in the
build_win32/Release or build_win32/Debug
subdirectory of Berkeley DB.
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:
java com.sleepycat.examples.db.AccessExample
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.
Building the Tcl API
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.
Building Tcl with Visual C++ .NET
- Set the include directories. Choose Tools -> Options
-> Projects -> VC++ Directories. Under the "Show
directories for" pulldown, select "Include files". Add the full
pathname for tcl/include, then click OK. This is the
directory that contains tcl.h.
- Set the library files directory. Choose Tools ->
Options -> Projects -> VC++ Directories. Under the "Show
directories for" pulldown, select "Library files". Add the full
pathname for the tcl/lib directory, then click OK. This is
the directory needed to find
tcl84g.lib (or whatever the
library is named in your distribution).
- Set the build type to Release or Debug in the drop-down on the .NET
tool bar.
- To build, right-click on db_tcl and select Build. This builds the Tcl
support library for Berkeley DB, placing the result into
build_win32/Debug/libdb_tcl4M4MINORd.dll or
build_win32/Release/libdb_tcl43.dll.
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.
Building Tcl with Visual C++ 6.0
- Set the include directories. Choose Tools -> Options
-> Directories. Under the "Show directories for" pulldown,
select "Include files". Add the full pathname for
tcl/include, then click OK. This is the directory that
contains tcl.h.
- Set the library files directory. Choose Tools ->
Options -> Directories. Under the "Show directories for"
pulldown, select "Library files". Add the full pathname for the
tcl/lib directory, then click OK. This is the directory
needed to find tcl84g.lib (or
whatever the library is named in your distribution).
- Go to Build -> Set Active Configuration and select
either the Debug or Release version of the db_tcl project. Then press
OK.
- To build, select Build -> Build
libdb_tcl43.dll. This builds the Tcl support
library for Berkeley DB, placing the result into
build_win32/Debug/libdb_tcl4M4MINORd.dll or
build_win32/Release/libdb_tcl43.dll.
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.
Distributing DLLs
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-2004 Sleepycat Software, Inc. - All rights reserved.