Cross-compile to ARM using Code Sourcery Lite Toolchain


I am new to LLVM and would like to cross-compile LLVM 2.9 on x86
(Ubuntu) to ARM using Code Sourcery LIte toolchain for ARM EABI

This is the command I used to configure:
./configure --build=i686-pc-linux-gnu --host=arm-none-linux-gnueabi

followed by:
make -C llvm.2.9 ENABLE_OPTIMIZED=0

I encountered the following errors:
configure:error: Already configured in /llvm2.9
make[1]: Entering directory '/llvm2.9/BuildTools'
make[1]: *** No targets specified and no makefile found. Stop.
make[1]" Leaving directory '/llvm2.9/BuildTools'
make: *** [cross-compile-build-tools] Error 1
make: Leaving directory 'llvm2.9'

How can I resolve the errors and is there anything I missed out while
trying to cross-compile LLVM on x86 to ARM?

Thanks in advance for looking into my problem.


  You can try this one,

  Don't forget export Code Sourcery Lite Toolchain PATH.



Have you tried building in a dedicated build directory rather than directly in your source tree? Especially for cross compilers, that's likely to give you better results. That is,

$ mkdir build-llvm
$ cd build-llvm
$ ../<llvm-src-dir/configure --build=i686-pc-linux-gnu --host=arm-none-linux-gnueabi --target=arm-none-linux-gnueabi --enable-optimized=no --enable-assertions=yes
$ make

I've used that recipe before with good results.



(cc:llvmdev Keeping on the list to get more eyes on the problem and for archival purposes).

Configure will be re-run, yes. LLVM includes some tools which need to be built for the host, even when cross compiling (e.g., tblgen). In a cross-build, these are built in the BuiltTools directory and that's where you're seeing configure being re-run.

From the below snippet it appears that your host compiler is being run incorrectly. That could happen for any number of reasons. I would suggest having a look in config.log (in the BuildTools directory since that's where it's failing) as the error message suggests to find more information about why.

My best guess is that configure is finding the wrong compiler for building for your host, either because your cross compile tools are first on the path and have conflicting generic names (gcc, g++, etc. instead of a fully qualified name with the triple as prefix) or there's something broken in the host tools installation.