---
name: "cross-compile"
section: "5"
platform: "linux"
package: "dpkg-cross"
version: "2.3.0.1"
release: "Debian 5.0 (Lenny)"
platforms: ["linux"]
url: "https://new.carta.tech/cross-compile"
---

# cross-compile(5)

Configuration for dpkg-cross and relatives

## NAME

cross-compile — Configuration for dpkg-cross and relatives

## DESCRIPTION

This file defines some settings for **dpkg-cross** but many values   are unused in the general case.

Settings in the system path   file **/etc/dpkg-cross/cross-compile** can   be overridden by an optional file in your home directory:  **$HOME/.dpkg-cross/cross-compile**.

The configuration file syntax has been significantly relaxed since  version 1.39. Comments start with a '#' and continue to the end of the line.   Comments are allowed on their own lines or after variable definitions.  Variable definitions have the general form:

varname = value

Prior to v2.0.0, **dpkg-cross** diverted **dpkg-buildpackage** and  **dpkg-shlibdeps** from dpkg-dev and used lots of settings in this file to  modify that behaviour. In v2.0.0, these diversions have been removed and  the main elements of the diversions implemented in dpkg-dev itself. The old  diversion scripts are retained in **dpkg-cross** but are no longer called  in normal usage. Settings that are affected by this change are listed in  the "Legacy" section.

Scripts using the **Debian::DpkgCross** module  can define their own options to be set in this file and are free to use  the existing settings in any suitable way. All options are available via the  *read\_config* function in the module.

The following variables are recognised by default by **dpkg-cross** and   can be specified in any order. Only **default\_arch** is   used routinely.

- default\_arch (default: none)

  The default architecture for **dpkg-cross** is normally set by  debconf. To change the system-wide value, use

-

  $ sudo dpkg-reconfigure dpkg-cross

-

  Alternatively, the default can be overridden on a per-user basis using  the optional file in **$HOME/.dpkg-cross/**.

- crossbase (default: /usr)

  This is the path prefix for all other cross compiling paths below. It  is used in their default definition, but a user definition need not  necessarily use it.

- crossdir (default: $(CROSSBASE)/$(DEB\_HOST\_GNU\_TYPE))

  This is the base directory for a specific architecture.

- crossbin (default: $(CROSSDIR)/bin)

  This directory contains binaries for cross compiling (**gcc**,  **as**, **ld**, ...).  It's mainly intended for refering to, but **dpkg-shlibdeps** also  uses it as one alternative to locate a **objdump** that  can parse objects of the architecture in question.

- crosslib (default: $(CROSSDIR)/lib or $(CROSSROOT)/lib, resp.)

  This directory contains libraries and other linker support files (e.g.  **crt1.o**) for cross compiling. The setting is used by  **dpkg-cross** as place where to install files from usual **/lib**,  **/usr/lib**, and **/usr/X11R6/lib**. Also  **dpkg-shlibdeps** expects target arch libraries in this directory. This is  specially important if \`\`*$(CROSSROOT)*'' is defined.

- crosslib64 (default: $(CROSSLIB)64)

  On targets that have both 32bit and 64bit variants, this directory  contains 64bit versions of libraries and other linker support files. This  setting is used by **dpkg-cross** as place where to install files from  **/lib64**, **/usr/lib64**, and  **/usr/X11R6/lib64**. Note that this setting is NOT used for  64bit-only targets (such as \`\`*ia64*'').

- crossinc (default: $(CROSSDIR)/include)

  This directory contains headers for cross compiling. The setting is  used by **dpkg-cross** as place where to install files from usual  **/usr/include** and **/usr/X11R6/include**.  Unused if \`\`*$(CROSSROOT)*'' is defined.

- crossprefix (default: $(CPU)-$(OS)-)

  This is the prefix for cross compiling binaries, like  **gcc**. The default naming is GNU convention, e.g.  you could have **m68k-linux-gcc** in your PATH.  It is mainly intended for refering to, but **dpkg-shlibdeps** also  uses it as one alternative to locate a objdump that can parse objects  of the architecture in question (it tries \`\`*$(CROSSPREFIX)objdump*'').

- removedeps

  This variable defines comma-separated list of package names that  should be removed from any dependency fields (Depends:, Conflicts:, etc)  of the generated packages. This is useful when the original native package  depends on packages like **xfree86-common** or  **gpm**, that are of no value for cross-compilation.

-

  This option has been largely superceded by   the **-X**\|**--exclude** support in **dpkg-cross** itself.

- keepdeps

  This variable defines comma-separated list of package names that  should be kept as is, without adding *-arch-cross* suffix,  in all dependency fields (Depends:, Conflicts:, etc) of the generated  packages. This is useful for packages like **bison**,  when host version of package can satisfy the dependency.

-

  This option has been largely superceded by   the **-X**\|**--exclude** support in **dpkg-cross** itself.

## Legacy options

Other values previously used in this file are now largely legacy code   that are retained for use with the old scripts   from **/usr/share/dpkg-cross/**.

- crossroot-arch (default: none)

  If *arch* matches the current target architecture (selected by a  **-a** option), then this definition of \`\`*$(CROSSROOT)*'' will  take place. It tells **dpkg-cross** that there is a complete Debian installation for the  target arch mounted somewhere, in the path which is the value of the  definition. If a \`\`*$(CROSSROOT)*'' definition is active, some of the other  variables change their meaning. For a complete description, best refer  to **/usr/share/doc/dpkg-cross/README.Debian.gz**.

- compilerpath (default: /bin:/usr/bin)

  This variable defines colon-separated list of directories where **gccross** search  for compilers.

The variables \`\`*$(CPU)*'' and \`\`*$(OS)*'' mentioned above  sometimes are derived from the current target architecture \`\`*$(ARCH)*''.  If that one does not contain a dash ('-'), it's assumed to be \`\`*$(CPU)*'' and  \`\`*$(OS)*'' to be \`\`*linux*''. However, if the architecture string  starts with \`\`*hurd-*'' or end in \`\`*-gnu*'', the \`\`*$(OS)*'' part  will be \`\`*gnu*'', the \`\`*$(CPU)*'' the rest before or after the OS.

Additional variables may be defined for the legacy **dpkg-buildpackage** wrapper.

**Important:  Makeflags are disabled in 2.0.0**

The old behaviour of overriding all **MAKEFLAGS** within   a build has been abandoned. **MAKEFLAGS** should not be overridden  as it compromises the intended behaviour of **dpkg-cross** by preventing build  tools from being compiled with the native compiler, causing builds to fail  when the executable is run after being compiled under the cross-compiler as  dictated by the incorrect MAKEFLAGS. Packages that cross-built with MAKEFLAGS   but which fail to cross-build without it should be patched.

Old style 'environment' variables can still be set using the same  syntax as all other variables in the file and can be exported to the   environment when using the legacy scripts. This is a change from previous  behaviour.

## VARIABLE UNSETTING

Unlike previous versions, any variable can be unset in the same file or in  the user-specific file after being set in the system file. Simply provide an  empty value.

## FILES

**$HOME/.dpkg-cross/cross-compile**, **/etc/dpkg-cross/cross-compile**

## SEE ALSO

**[dpkg-cross(1)](/dpkg-cross/1.md)**, **[Debian::DpkgCross(3)](/Debian::DpkgCross/3.md)**, **[cross-compile(5)](/cross-compile/5.md)**, **/usr/share/doc/dpkg-cross/README.Debian.gz**

## AUTHOR

Roman Hodek \<debian-embedded@lists.debian.org\>

Neil Williams \<codehelp@debian.org\>

## VERSION

$Revision: 2.0.0

## COPYRIGHT

Copyright © 2007 Roman Hodek \<debian-embedded@lists.debian.org\>

Copyright © 2007 Neil Williams \<codehelp@debian.org\>

This program is free software; you can redistribute it and/or modify  it under the terms of the GNU General Public License as published by  the Free Software Foundation; either version 2 of the License, or  (at your option) any later version.
