There are pre-built binaries available for ELLCC for Mac OS X, Windows, and various Linux platforms. You can find them at ftp://ellcc.org/pub or http://ellcc.org/releases. It’s pretty easy to download and try ELLCC. You don’t have to have any special privileges. Just download the tarball, extract it anywhere (e.g. your home directory) and either put the ~/ellcc/bin directory in your PATH or run ecc with a full path name. You can use the -target option to select the processor
~/ellcc/bin/ecc -target arm-linux-engeabihf hello.c
or you can make a symbolic link like
ln -s ecc arm-linux-engeabihf-ecc
to avoid having to specify the “-target” explicitly.
ELLCC is also available as a source distribution. Here are step by step instructions that describe how to build ELLCC under Linux.
It takes a while to build ELLCC. It helps to have a system with at least 3GB of RAM to speed up the LLVM build.
An ELLCC build requires the following packages to be installed:
- A C/C++ compiler
Get the ELLCC Sources
This will take a while since it gets all of LLVM, Clang, binutils, GDB, and QEMU.
You can use the command
[~] main% svn co http://ellcc.org/svn/ellcc/tags/current ellcc
to get the sources of the latest ELLCC release. The advantage of using the latest release sources is that they have been used to compile themselves and to cross compile themselves for all the supported hosts.
If you are interested in the latest ELLCC sources which may not have been as extensively tested, you can use the command
[~] main% svn co http://ellcc.org/svn/ellcc/trunk ellcc
The ELLCC build script will attempt to bootstrap ELLCC so that it can compile itself. If you haven’t installed ELLCC before, the first thing that will happen is that a build will be done using gcc. That compiler will be used to build the GNU tools and the ELLCC standard libraries. After that, everything will be rebuilt using the ELLCC.
[~] main% cd ellcc
[~/ellcc] main% make
At this point you may be prompted to re-run make to complete the bootstrap process.
If everything has been successful up to this point, you have built
QEMU, and libraries for all targets. All the binaries created by the build are in the
bin subdirectory of the build directory, i.e. in
~/ellcc/bin in my example. The
bin directory should look something like this:
[~/ellcc] main% ls bin aarch64-elf-as* linker-script-test* nios2-elf-as* arm-elf-as* llc* not* bugpoint* lld* obj2yaml* c-index-test* lli* opt* clang-check* lli-child-target* ppc64-elf-as* clang-format* llvm-ar* ppc-elf-as* clang-tblgen* llvm-as* qemu-arm* count* llvm-bcanalyzer* qemu-armeb* ecc* llvm-config* qemu-i386* ecc++@ llvm-cov* qemu-microblaze* ecc-addr2line* llvm-diff* qemu-mips* ecc-ar* llvm-dis* qemu-mipsel* ecc-as* llvm-dwarfdump* qemu-ppc* ecc-c++filt* llvm-extract* qemu-ppc64* ecc-elfedit* llvm-link* qemu-ppc64abi32* ecc-embedspu* llvm-mc* qemu-sparc* ecc-gcore* llvm-mcmarkup* qemu-system-arm* ecc-gdb* llvm-nm* qemu-system-i386* ecc-gprof* llvm-objdump* qemu-system-microblaze* ecc-ld* llvm-profdata* qemu-system-mips* ecc-ld.bfd* llvm-ranlib@ qemu-system-mipsel* ecc-lit* llvm-readobj* qemu-system-ppc* ecc-nm* llvm-rtdyld* qemu-system-ppc64* ecc-objcopy* llvm-size* qemu-system-sparc* ecc-objdump* llvm-stress* qemu-system-x86_64* ecc-ranlib* llvm-symbolizer* qemu-x86_64* ecc-readelf* llvm-tblgen* sparc-elf-as* ecc-size* llvm-vtabledump* verify-uselistorder* ecc-strings* macho-dump* x86_64-elf-as* ecc-strip* microblaze-elf-as* yaml2obj* FileCheck* mips-elf-as* i386-elf-as* ncurses5-config*
You may want to put the
bin directory in your PATH, but it is not required at this point.
ecc++ are the C and C++ compilers: By default, they use the system header files in
/usr/include and use the system
c++ libraries to do the final program link. This means you can use
ecc++ to compile programs that run natively on your system.
Note that the important files in the
bin directory for using ELLCC to write applications for a target are
The other important directories which are populated during the build process are
These directories contain the ELLCC include files, run-time libraries, and linker command scripts respectively. Note that ELLCC relies on the fact that its
bin directory and
libecc directory are next to each other. The
ecc binary finds its include files and libraries in
libecc by using its location and going to
You can use the newly built tools to compile programs on your build host for any of the available targets. See Using ELLCC for more information.
A Quick Sanity Check
Change in to the ~/ellcc/test directory:
[~/ellcc/test] main% make check
This will run a series of regression tests on the newly built compiler.
Building ELLCC for Another Build Host
Building ELLCC to run on another build host is easy. This will build ELLCC executables that will run on the specified host. For example, to build for an ARM build host you specify a build configuration:
[~] main% cd ellcc
[~/ellcc] main% ./build arm-linux-engeabi
This will build ARM executables and populate the
bin-arm-linux directory. The
libecc directory is the same because the
lib directories have already been populated during the main build.
Available build configurations are listed on Using ELLCC. In addition, there is a special configuration to build cross tools that run on Windows. If you have mingw-w64 installed, you can build for Windows with the command
[~/ellcc] main% ./build -m