###

Berkeley DB Reference Guide:
  Building Berkeley DB for VxWorks systems

### Building for VxWorks AE

The build_vxworks directory in the Berkeley DB distribution contains component files for Tornado 3.1. The Berkeley DB distribution also contains workspace and project files for Tornado 2.X. See Building for VxWorks for information about Tornado 2.0/VxWorks 5.4 and Tornado 2.2/VxWorks 5.5.

The VxWorks AE component files are all within subdirectories, and all component files are named component.wpj.

File | Description
--- | ---
Berkeley DB/ | Berkeley DB component directory
dbdemo/dbdemo | Demo program component directory
db_*/db_* | Support utilities component directories

### Building With Tornado 3.1

This document assumes you already have a workspace set up and you want to add Berkeley DB as a component in that workspace. You may include this component in any domain deemed appropriate for your application.

To add the Berkeley DB component into your workspace, right-click on the "Components" and choose Add existing.... Enter the pathname to your Berkeley DB distribution in the form <pathname to your Berkeley DB distribution> /build_vxworks/Berkeley DB/. You will see component.wpj listed under the "Files". Choose that filename and click "Ok". You will now have a Berkeley DB component in your workspace.

There are essentially three options regarding protection domains and the Berkeley DB component. The first option is to add the Berkeley DB component directly into your application domain. You may choose to do this by downloading Berkeley DB into that domain on your target, or by adding the component to the domain itself and it will be built when the application domain is built. The disadvantage of this option is that no other application domain will have access to the Berkeley DB interfaces.

The second option is to add the Berkeley DB component directly into your vxKernel domain. The advantage is that any application using the Berkeley DB interface would have access to them and no changes would be necessary to the linkage path. The disadvantage is that all Berkeley DB code would run with system privileges.

The third option is to add a Berkeley DB shared library domain to your system. Then add or download the Berkeley DB component to that shared library domain. The advantage is that all application domains using the Berkeley DB interfaces can access a single copy of the library running in user mode. The disadvantages are that one must remember to add the Berkeley DB shared library domain to the linkage path of every application domain using Berkeley DB and that shared library domains may not link against one another, a consideration if the application using Berkeley DB is itself a shared library.

We believe the options outlined above are the most common methods that the Berkeley DB component will be used. We believe that the third option, creating a shared library domain, is the most useful option. Ultimately, the responsibility of choosing the correct mechanism for including the Berkeley DB component into the appropriate domain falls to the application developer.

The remainder of this document assumes that you already have a VxWorks AE target and a target server, both up and running. It also assumes that your VxWorks AE image is configured properly for your needs. It also assumes that you have an acceptable file system already available. See VxWorks FAQ for more information about file system requirements.

To build Berkeley DB, first, you need to set the build selection. To do this, right-click on the Berkeley DB component name and choose the Build settings... selection. If you look at the Active Build Specification drop down list, you will see several different builds, containing different configurations.

Build | Description
--- | ---
PENTIUM2gnu.debug | PII BSP with debugging
PENTIUM2gnu.release | PII BSP no debugging

You have to add a new build specification if you use a different BSP, want to add a build for the simulator or want to customize further. For instance, if you have the Power PC (PPC) BSP, you need to add a new build for the PPC tool chain. To do so, select the "Add..." button in the Build Settings window. A new window will appear giving you a list of all the BSPs you have available from which to choose. For your new build target, you need to decide whether it should be built for debugging. See the C/C++ compiler tab of the Pentium builds for ways to configure for each case. After you add this build, you still need to configure the include directories correctly, as described in the sections that follow.

If you are running with a different BSP, you should remove the build specifications that do not apply to your hardware. We recommend that you do this after you configure any new build specifications first.

If you are adding a new build you must set the include directories correctly. After you have added the new build in the "Build Settings" window, click on the C/C++ compiler tab. In the edit box, you need to add the pathname of the build_vxworks subdirectory of Berkeley DB, followed by the pathname of Berkeley DB. You should add these directories relative to the project directory, using the PRJ_DIR macro, which is the Berkeley DB subdirectory of build_vxworks. Then, click OK. The typical addition of include directories will look like:

>     -I$(PRJ_DIR)/.. -I$(PRJ_DIR)/../..

To build and download the Berkeley DB downloadable application for the first time requires several steps:

1. Select the build you are interested in using the Build Settings window. Click OK when done.

2. Select the Berkeley DB component and right-click. Choose the Clean Build selection.

3. Select the Berkeley DB component and right-click. Choose the Download... selection.

You need to repeat this procedure for all builds you are interested in building, as well as for all of the utility project builds you want to run.

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