I am trying to build Emacs for an embedded ARM Linux system. Unfortunately, it is proving to be more difficult than I anticipated. I have the device mounted at /mnt/my_device. Now I am not sure exactly how to go about building Emacs from source.

I know I can set the prefix of the install via --prefix=/mnt/my_device/usr/local. However, beyond that, things get more difficult. How can I configure my Emacs build for my ARM system? After configuration, how do I compile Emacs? Using an ARM toolchain in QEMU or something? I know that there are cross-compiler tools that run on x86 systems, but should I use those given that configure may get the wrong info if I run it on my x86 system? Also, I need this installation of Emacs to be quite minimal, as this is an embedded system and there's not a lot of room.

Any tips that would help cohere and streamline this build process would be most appreciated.

  • Can you compile Emacs on the device itself (or in emulator)? Because if not, then what options other than cross-compiling do you have? --prefix isn't a very useful option for you, it just tells the build where to put the binaries. I don't have Emacs sources on this computer, but my first step would be to run configure --help and read what options are available. Perhaps, you can set architecture in those options...
    – wvxvw
    Nov 8, 2017 at 9:58
  • @wvxvw I searched around for such options, but I couldn't find anything that stuck out to me for architectures and so forth.
    – GDP2
    Nov 9, 2017 at 21:02

2 Answers 2


First: do you need to run Emacs on that system? Emacs can access remote files easily. Typically you just run it on your local machine. If you only ever access the system remotely, it probably doesn't need Emacs. ARM covers a very wide range of system sizes, from appliances with only a few megabytes of memory to equivalents of a 10-year old PC such as the latest Raspberry Pi model.

Second: do you need to compile Emacs yourself? There are plenty of Linux distributions that have ARM binaries and include Emacs. Distributions intended for smaller systems usually don't have it, but see “First” above. On “larger” distributions such as Debian or Arch, just install the package.

If you determine that you do need to compile Emacs, then you have a choice of cross-compiling or not. Emacs is written in C, and C compilers can work in relatively small amounts of memory. For example, you could compile on something like a Pi — but even a slightly aging PC will do it faster. If the device is powerful enough to cross-compile, then you'll probably want to run a distribution that has an Emacs package anyway.

If you do want to cross-compile, you'll need a cross-compiler. This can be a bit painful to set up sometimes. However, the distribution you're running on the device probably already has a cross-compiler setup. This is your most promising route: use whatever toolchain the distribution uses for its own packages.

Regarding Emacs itself, there are a few instructions in the INSTALL file. You'll need to pass the --host option to ./configure. The argument depends on the exact platform, depending on whether it has floating point registers and which standard library it runs. It might look something like arm-linux-gnueabihf (with GNU libc and Hardware Floating point). Usually the argument is the same name that the toolchain is installed under; for example a compiler for the arm-linux-gnueabihf target is typically called arm-linux-gnueabihf-gcc.

  • 1
    You should also read Bug#13479 before attempting a cross-compile.
    – npostavs
    Nov 8, 2017 at 12:36
  • To answer your first question: unfortunately, the device in question does not have networking support so TRAMP is a no-go. To answer your second question: the Linux distro that is installed on the device is Busybox. Unfortunately, as far as I can tell, package management is basically non-existent on Busybox. Cross-compilation therefore also looks bleak. Thanks for the other tips, though; I'll try to keep this stuff in mind and see if I can work something out.
    – GDP2
    Nov 8, 2017 at 18:12
  • @npostavs Thanks a lot for the link; the info there looks helpful to my situation.
    – GDP2
    Nov 8, 2017 at 18:16
  • @npostavs Sorry, I used the term "distro" loosely ;)
    – GDP2
    Nov 9, 2017 at 4:49
  • @GDP2 If your device doesn't have a package manager, you may want to install a Linux distribution in a chroot. I've done that on Android, which has a Linux kernel. Debian's debootstrap make that easy. I recommend searching (there's an overview in unix.stackexchange.com/questions/355142/…, and I think there are other threads that could help you), and asking for help if necessary, on Unix & Linux rather than here. The easiest solution for you is likely not to involve much that's specific to Emacs if anything. Nov 9, 2017 at 9:49

try chrooting to the root filesystem - assuming it has a build environment... you can then use the arm compiler.... something like:-

cd arm/rootfs
sudo su
cp /usr/bin/qemu-aarch64-static  usr/bin
cp /run/systemd/resolve/stub-resolv.conf run/resolvconf/resolv.conf

mount /sys ./sys -o bind
mount /proc ./proc -o bind
mount /dev ./dev -o bind

sudo LC_ALL=C chroot . /bin/bash
# we are not in kansas anymore!

root@jw-XPS-13-9370:/# gcc -dumpmachine
  • Thanks for the advice. Unfortunately, I gave up on this project long ago as per the above conversations. Hopefully this will help someone else (if anyone else is attempting to do something similar).
    – GDP2
    Jul 9, 2020 at 7:22
  • 2
    cheers.... i suppose there might be a use for a computer without emacs on it.... but it's not immediately obvious what that might be.... a door stop? :)
    – jolyon
    Jul 9, 2020 at 8:51
  • LOL, good one xD
    – GDP2
    Jul 10, 2020 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.