Compiling LLVM w/ Clang for ARMv7 and ARMv6 archs from a i386 OSX machine


For the last couple of days I struggled to find a way to compile LLVM with Clang for ARM. Now, I tried many variations of the settings, linkers and compilers, but I was able only to build for i386 and x86_64. My machine is an i386 iMac. This is my first attempt to cross-compile something, so probably I’m doing something incredible stupid.

First, I’m not sure which compiler should I use. I tried:



Here is my conf: …/llvm/configure --host=armv7-apple-darwin --target=armv7-apple-darwin --build=i386-apple-darwin --enable-optimized --disable-debug --disable-expensive-checks --disable-doxygen --disable-threads --enable-targets=arm

Just after I run configure, I get:

checking for armv7-apple-darwin-clang… no
checking for armv7-apple-darwin-llvm-gcc… no
checking for armv7-apple-darwin-gcc… no
checking for clang… clang
configure: WARNING: In the future, Autoconf will not detect cross-tools
whose name does not start with the host triplet. If you think this
configuration is useful to you, please write to
checking for C compiler default output file name… a.out
checking whether the C compiler works… yes
checking whether we are cross compiling… yes
checking for suffix of executables…
checking for suffix of object files… o
checking whether we are using the GNU C compiler… yes
checking whether clang accepts -g… yes
checking for clang option to accept ISO C89… none needed
checking for armv7-apple-darwin-clang++… no
checking for armv7-apple-darwin-llvm-g++… no
checking for armv7-apple-darwin-g++… no
checking for clang++… clang++
checking whether we are using the GNU C++ compiler… yes
checking whether clang++ accepts -g… yes
checking how to run the C preprocessor… clang -E
configure: WARNING: Unknown project (.svn) won’t be configured automatically
checking build system type… i386-apple-darwin
checking host system type… armv7-apple-darwin
checking target system type… armv7-apple-darwin
checking type of operating system we’re going to host on… Darwin
checking type of operating system we’re going to target… Darwin
checking target architecture… ARM
checking for grep that handles long lines and -e… /usr/bin/grep
checking for egrep… /usr/bin/grep -E
checking for ANSI C header files… yes
checking for sys/types.h… yes
checking for sys/stat.h… yes
checking for stdlib.h… yes
checking for string.h… yes
checking for memory.h… yes
checking for strings.h… yes
checking for inttypes.h… yes
checking for stdint.h… yes
checking for unistd.h… yes
checking whether byte ordering is bigendian… no

Everythings seems to be fine, it targets ARM and its cross-compiling, however, when I run “make”, it makes either a x86_64 or a i386 archive file (.a).

I’m sure I’m doing something stupid somewhere…

It’s because you don’t have a compiler around that targets arm by default.


Exactly right.

You can look in the build_llvm script for an ugly-but-effective way to work around that on Darwin.


Hello Jim, Eric,

Thank you both for your input, will have a look over the build_llvm script tomorrow!