| 1 |
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
| 2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
| 4 |
<head> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| 6 |
<title>Cross-Compiling on Unix</title> |
| 7 |
<link rel="stylesheet" href="gettingStarted.css" type="text/css" /> |
| 8 |
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> |
| 9 |
<link rel="start" href="index.html" title="Berkeley DB Installation and Build Guide" /> |
| 10 |
<link rel="up" href="build_unix.html" title="Chapter 7. Building Berkeley DB for UNIX/POSIX" /> |
| 11 |
<link rel="prev" href="build_unix_flags.html" title="Changing compile or load options" /> |
| 12 |
<link rel="next" href="build_unix_install.html" title="Installing Berkeley DB" /> |
| 13 |
</head> |
| 14 |
<body> |
| 15 |
<div xmlns="" class="navheader"> |
| 16 |
<div class="libver"> |
| 17 |
<p>Library Version 11.2.5.3</p> |
| 18 |
</div> |
| 19 |
<table width="100%" summary="Navigation header"> |
| 20 |
<tr> |
| 21 |
<th colspan="3" align="center">Cross-Compiling on Unix</th> |
| 22 |
</tr> |
| 23 |
<tr> |
| 24 |
<td width="20%" align="left"><a accesskey="p" href="build_unix_flags.html">Prev</a> </td> |
| 25 |
<th width="60%" align="center">Chapter 7. |
| 26 |
Building Berkeley DB for UNIX/POSIX |
| 27 |
</th> |
| 28 |
<td width="20%" align="right"> <a accesskey="n" href="build_unix_install.html">Next</a></td> |
| 29 |
</tr> |
| 30 |
</table> |
| 31 |
<hr /> |
| 32 |
</div> |
| 33 |
<div class="sect1" lang="en" xml:lang="en"> |
| 34 |
<div class="titlepage"> |
| 35 |
<div> |
| 36 |
<div> |
| 37 |
<h2 class="title" style="clear: both"><a id="cross_compile_unix"></a>Cross-Compiling on Unix</h2> |
| 38 |
</div> |
| 39 |
</div> |
| 40 |
</div> |
| 41 |
<p> |
| 42 |
The purpose of cross-compiling is to build a Berkeley DB library on |
| 43 |
one platform that is to be used on a different platform. This |
| 44 |
section demonstrates how to build a library compatible with the ARM |
| 45 |
platform from a 32-bit x86 Linux platform. You will need to adjust |
| 46 |
the build tools and options to match your particular platforms. |
| 47 |
</p> |
| 48 |
<div class="orderedlist"> |
| 49 |
<ol type="1"> |
| 50 |
<li> |
| 51 |
<p> |
| 52 |
Download, install, and test a toolchain that can build the |
| 53 |
desired target binaries. In this example, we use the |
| 54 |
<code class="literal">arm-linux-gnueabi-gcc</code> package. |
| 55 |
</p> |
| 56 |
</li> |
| 57 |
<li> |
| 58 |
<p> |
| 59 |
Decide on your configuration options, and set up your |
| 60 |
environment to use the appropriate compiler and compiler |
| 61 |
tools. It is often easiest to set this up as a small shell |
| 62 |
script. For example: |
| 63 |
</p> |
| 64 |
<pre class="programlisting">#!/bin/sh -f |
| 65 |
env \ |
| 66 |
CC=/usr/bin/arm-linux-gnueabi-gcc \ |
| 67 |
STRIP=/usr/bin/arm-linux-gnueabi-strip \ |
| 68 |
../dist/configure \ |
| 69 |
--build=i686-pc-linux-gnu \ |
| 70 |
--host=arm-linux-gnueabi \ |
| 71 |
--enable-java \ |
| 72 |
--enable-sql \ |
| 73 |
--enable-jdbc \ |
| 74 |
--enable-smallbuild \ |
| 75 |
--enable-shared \ |
| 76 |
--enable-stripped_messages \ |
| 77 |
--prefix=$HOME/ARM-linux/install \ |
| 78 |
$* </pre> |
| 79 |
<p> |
| 80 |
The <code class="literal">--build</code> flag indicates the system on |
| 81 |
which you are compiling and the <code class="literal">--host</code> |
| 82 |
flag indicates the target platform. Adjust or omit the |
| 83 |
<code class="literal">--enable</code> and <code class="literal">--prefix</code> |
| 84 |
flag settings as dictated by your own needs. |
| 85 |
</p> |
| 86 |
</li> |
| 87 |
<li> |
| 88 |
<p> |
| 89 |
Unpack your Berkeley DB distribution and go to the |
| 90 |
<code class="literal">build_unix</code> directory. Alternatively, you |
| 91 |
may create a more appropriately-named directory at the same |
| 92 |
level and build in it. For example, |
| 93 |
<code class="literal">build_arm</code>. |
| 94 |
</p> |
| 95 |
</li> |
| 96 |
<li> |
| 97 |
<p> |
| 98 |
In your build directory, configure by executing your |
| 99 |
script, then <code class="literal">make</code> and |
| 100 |
<code class="literal">make install</code>. Review any compiler |
| 101 |
warnings and fix if necessary, repeating the |
| 102 |
<code class="literal">configure</code> and <code class="literal">make</code> |
| 103 |
steps until you are satisfied. The resulting libraries and |
| 104 |
executables can then be transferred to your target system. |
| 105 |
</p> |
| 106 |
</li> |
| 107 |
</ol> |
| 108 |
</div> |
| 109 |
</div> |
| 110 |
<div class="navfooter"> |
| 111 |
<hr /> |
| 112 |
<table width="100%" summary="Navigation footer"> |
| 113 |
<tr> |
| 114 |
<td width="40%" align="left"><a accesskey="p" href="build_unix_flags.html">Prev</a> </td> |
| 115 |
<td width="20%" align="center"> |
| 116 |
<a accesskey="u" href="build_unix.html">Up</a> |
| 117 |
</td> |
| 118 |
<td width="40%" align="right"> <a accesskey="n" href="build_unix_install.html">Next</a></td> |
| 119 |
</tr> |
| 120 |
<tr> |
| 121 |
<td width="40%" align="left" valign="top">Changing compile or load options </td> |
| 122 |
<td width="20%" align="center"> |
| 123 |
<a accesskey="h" href="index.html">Home</a> |
| 124 |
</td> |
| 125 |
<td width="40%" align="right" valign="top"> Installing Berkeley DB</td> |
| 126 |
</tr> |
| 127 |
</table> |
| 128 |
</div> |
| 129 |
</body> |
| 130 |
</html> |