README.cross_compile
changeset 0 2b3e5ec03512
equal deleted inserted replaced
-1:000000000000 0:2b3e5ec03512
       
     1 
       
     2 Cross-Compiling DTN2
       
     3 ====================
       
     4 
       
     5 (This file last updated June 14, 2006)
       
     6 
       
     7 The actual steps needed for cross compiling DTN2 will depend on the
       
     8 particular toolchain in use as well as the target architecture. This
       
     9 file defines steps for certain known-to-work configurations.
       
    10 
       
    11 Cross compilation toolchain installed on Linux
       
    12 ----------------------------------------------
       
    13 
       
    14 In this configuration, we assume that some cross-compilation toolchain
       
    15 was installed with all toolchain executables prefixed by the name of
       
    16 the target system. In this example, assume that the target system is
       
    17 arm-linux, so all tools are named arm-linux-<tool>, and are installed
       
    18 into a directory on the system called /opt/arm-linux-toolchain/bin.
       
    19 
       
    20 First set the path to include the installed toolchain directory:
       
    21 
       
    22 % export PATH=/opt/arm-linux-toolchain/bin:$PATH
       
    23 
       
    24 Then download and unpack sources for tcl and berkeley db. The
       
    25 following will compile and install them into /opt/arm-linux-libraries.
       
    26 Note that BerkeleyDB is not required, so if you don't want it, you can
       
    27 skip that step and pass --without-db to the DTN2 configure invocation.
       
    28 
       
    29 (In the unpacked tcl source dir)
       
    30 % cd unix
       
    31 % CC=arm-linux-gcc ./configure --prefix=/opt/arm-linux-libraries
       
    32 % make
       
    33 % make install
       
    34 
       
    35 If the build presents trouble, the following note from the
       
    36 comp.lang.tcl archive may be helpful:
       
    37 
       
    38    Re: multiple definition of `fixstrtod' while cross-compiling tcl
       
    39    From: Eric Hassold <hassold at evolane.fr>
       
    40    Date: Mon Dec 05 2005 - 22:33:38 CET
       
    41 
       
    42    Tcl configure script makes some pessimistic assumptions when
       
    43    cross-compiling (when AC_TRY_RUN can't run). One of them is guessing
       
    44    libc has no strtod when small test program can't be run. Some AC_TRY_RUN
       
    45    should actually be replaced by AC_TRY_LINK to provide better estimate.
       
    46 
       
    47    Anyway, as a work-around, you may force configure detection, defining
       
    48       export ac_cv_func_strtod=yes
       
    49    before running ./configure. You may also have to force
       
    50       export tcl_cv_strtod_buggy=1
       
    51    so that Tcl will define its own fixstrtod() symbol, which will call
       
    52    uclibc's strtod(). Works fine in our nightly built process, compiling
       
    53    Tcl for arm-linux/uclibc.
       
    54 
       
    55 (In the unpacked Berkeley DB source dir)
       
    56 % cd build_unix
       
    57 % ../dist/configure --prefix=/opt/arm-linux-libraries \
       
    58     --build=`uname -m` --host=arm-linux
       
    59 % make
       
    60 % make install
       
    61 
       
    62 The final step is to configure and build DTN2, again with the PATH set
       
    63 to include the cross-compilation toolchain and with tcl and Berkeley
       
    64 DB installed in /opt/arm-linux-libraries.
       
    65 
       
    66 % ./configure --build=`uname -m` --host=arm-linux \
       
    67   --with-db=/opt/arm-linux-libraries  --with-tcl=/opt/arm-linux-libraries 
       
    68 % make
       
    69