---
name: "emsetup"
section: "1"
platform: "linux"
package: "emdebian-tools"
version: "1.4.3"
release: "Debian 5.0 (Lenny)"
platforms: ["linux"]
url: "https://new.carta.tech/emsetup"
---

# emsetup(1)

Check your system for Emdebian cross-build support.

## NAME

emsetup - Check your system for Emdebian cross-build support.

## SYNOPSIS

**emsetup** \[\[-a\] \| \[--arch\] *ARCH*\] \[\[-s\] \| \[--simulate\]\] \[\[-y\] \| \[--yes\]\] \[\[-v\] \| \[--verbose\]\] \[\[-q\] \| \[--quiet\]\]

**emsetup** \[\[-a\] \| \[--arch\] *ARCH*\] \[--report\]

**emsetup** \[\[-a\] \| \[--arch\] *ARCH*\] \[--download\] *VERSION*

**emsetup** \[\[-h\] \| \[--help\]\] \[\[--version\]\]

## DESCRIPTION

**emsetup** checks your system for Emdebian compatible cross-build support and determines some defaults for other emdebian-tools scripts. Run this before other emdebian-tools scripts, using the simulate option to see what changes may be needed. If a usable toolchain is already installed, **emsetup** exits without making any changes.

**emsetup** uses *apt-cross* to determine the latest versions of toolchain packages.

Use **--report** to see the package names that **emsetup** has checked or installed for the default or specified architecture.

If **emsetup** identifies that a suitable toolchain exists in Emdebian but is not installed, **edos-debcheck** can be used to check that the toolchain packages are installable by calling **emsetup** with the **--report** option.

## OPTIONS

**-a**\|**--arch** ARCH

Override the *dpkg-cross* default architecture.

**emsetup** tries to determine the current default architecture setting of **dpkg-cross** - managed by **debconf** in **dpkg-cross** (\>= 1.33). Prior to version 1.33, *dpkg-cross* used *~/.dpkg-cross/cross-compile*, copied from */etc/dpkg-cross/cross-compile* and manually edited to update the default\_arch:

```
# default architecture for dpkg-cross (to avoid always typing the -a option
# if you do cross installations only for one architecture)
# default_arch =
```

**-s**\|**--simulate**

Summarise the changes required to enable cross-building for your selected architecture on this system without making any changes, then exit. **emsetup** will run through each of the checks and determine if you need an additional source in */etc/apt/sources.list*. If you choose to add this source manually, ensure you run ´sudo apt-get update´ before restarting **emsetup**. Next, **emsetup** will output a list of toolchain packages that are needed to build your chosen architecture on this system. If these packages are not available in the current emdebian toolchain repository, **emsetup** will output a hint about using **emchain**. Packages that are available but not installed can be checked for installability using the **--report** option to **emsetup**.

**-s** is ignored if **--report** is used.

**-y**\|**--yes**

Proceed with the toolchain installation without getting a prompt from the apt-agent (either apt-get or aptitude according to debconf or *~/.apt-cross/emsource* preferences).

- **--report**

  View the status of packages that **emsetup** has either installed or checked to support cross-building for the default or specified architecture. If the required packages are not installed, **emsetup** prints a list of the package names that were checked and runs **edos-debcheck** to test that the toolchain packages are installable on your system. If **edos-debcheck** reports that any toolchain packages fail, please ask for help on the *debian-embedded* mailing list: http://lists.debian.org/debian-embedded/ \<debian-embedded@lists.debian.org\>, attaching the **emsetup** report.

- **--download** **VERSION**

  Sometimes, the Emdebian toolchains get behind the version of gcc in Debian itself and problems in the later version of gcc could mean that it does not build cleanly so **emchain** cannot fill the gap. In this situation, there will be a delay in providing an updated Emdebian toolchain for the new version but **emsetup** will not be able to install the old one on new installations. This can be a complicated situation but it may be possible to *force* the installation of the toolchain using **dpkg --force-depends**.

  Download tries to help you, a little bit. **VERSION** specifies the version of gcc that you want to be able to use, e.g. for gcc-4.2, specify **4.2**. The relevant gcc packages for your selected architecture are downloaded from the Emdebian repository. Supporting packages are downloaded using **apt-cross**. Packages that are already installed are omitted.

  With the necessary files available, **emsetup** can do no more for you - see **dpkg-cross** (1) for information on how to build suitable cross packages from the foreign binaries. Use **dpkg --force-depends** on the packages that have the correct architecture. (e.g. to build for ARM on amd64, use **dpkg-cross** on the ARM packages and **dpkg --force-depends** on the amd64 packages.)

  It is best to use **dpkg-cross** **-b** *not* **dpkg-cross** **-i** because it is very likely that you will need to use **sudo dpkg** **--force-depends -i** to actually install most (all?) of the toolchain packages. This part of the process needs to be done manually because if an automated method was likely to work, **--download** would be unnecessary. Other packages may also be necessary, these should be downloaded using **apt-cross**, using **--force** if an old version is already installed.

  If this method still fails, ensure that you use:

  ```
  $ sudo apt-get -f install
  ```

  to try to tidy up the mess left behind.

  Even if the installation succeeds, it is worth checking the installation with the above command or you may come up against problems with installing other packages.

  Consquences of forced toolchain installation **empdebuild** will not be able to use the same method (without an amount of manual hacking of an existing empdebuild chroot). This is not really a problem - forced toolchain installations are intended to be the exception, not the rule. The lack of clean chroot build support should act as a disincentive to upload cross built packages to repositories, until such a time as a full Emdebian toolchain becomes installable.

**-v**\|**--verbose**

be verbose. **-v** can be repeated to increase verbosity, up to a maximum of three times. When running **emsetup** directly, it is recommended to use at least one **-v** option.

**-q**\|**--quiet**

be quiet (default) - can also be used to reduce verbosity set using **-v**.

## HOST CONFIGURATION

In some circumstances (e.g. inside a chroot), *hostname* **-f** fails and **emsetup** reports an error about being unable to determine the fully qualified hostname. This usually occurs because of an old */etc/hosts* file.

**Example 1.1. Fixing hostname for mybox.mydomain**

The typical fix is to add an extra line to fix the *hostname* configuration. Substitute **mybox** with your short hostname (use *hostname* **-s**). If you have a local domain, specify it instead of **mydomain**. If you have no local domain, use **localdomain**:

```
127.0.1.1 mybox.mydomain mybox
```

## AMD64 VS I386

**emsetup** checks to see if a toolchain is necessary by comparing the requested cross build architecture against the host architecture. If the two are the same, no toolchain is necessary and **emsetup** does the other tasks and simply exits.

**i386** and **amd64** are a special case where it is possible to prepare an i386 chroot on amd64 (and vice versa) and build within that chroot using a normal toolchain. How to set up such a chroot is beyond the scope of this manpage but feel free to add to the  *Emdebian Wiki*\[1\] content.

## SETTING UP A DEBIAN CHROOT

You will need the **deboostrap** utility and at least 250Mb of free space (not including the builds that you want to do inside the chroot). Create a new directory that is writable by a normal user:

```
$ mkdir ./debian-chroot
```

Download a minimal Debian setup: (can take a bit of time)

```
$ sudo debootstrap sid ./debian-chroot http://ftp.fr.debian.org/debian
```

Change into the chroot and install emdebian-tools:

```
$ sudo chroot ./debian-chroot
sh # apt-get update
sh # apt-get dist-upgrade
sh # apt-get install emdebian-tools
```

Now continue with **emsetup** as before.

## AUTHOR

**emsetup** was written by Neil Williams \<codehelp@debian.org\>.

This manual page was written by Neil Williams \<codehelp@debian.org\>

## SEE ALSO

See also *apt-cross* (1), *dpkg-cross* (1), *em\_make* (1), *emdebian-tools* (1).

## AUTHOR

**Emdebian**

**Neil Williams**

-

  Author.

## COPYRIGHT

## NOTES

- 1\.

  Emdebian Wiki

  http://wiki.debian.org/Embedded\_Debian
