Configuring for cross-compilation doesn't work

Hi,

I am trying to build LLVM 3.4 RC1 with the Intel compiler targeting the Xeon Phi (native). In order to skip the building and execution of a test binary during configuration one needs the set the "-host" option indicating a cross compilation. Intel suggests to use "x86_64-unknown-linux-gnu".

However, either using "x86_64-unknown-linux-gnu" or something unknown like "unknown" brings me through the configuration:

../llvm/configure CXX=icpc CC=icc CXXFLAGS="-O3 -mmic" CFLAGS="-O3 -mmic" --host=x86_64-unknown-linux-gnu

configure: WARNING: If you wanted to set the --build type, don't use --host.
     If a cross compiler is detected then cross compile mode will be used.
checking for x86_64-unknown-linux-gnu-clang... icc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
...
checking for gcc... gcc
configure: error: installation or configuration problem: compiler cannot create executables.
make: *** No targets specified and no makefile found. Stop.
make: *** No rule to make target `install'. Stop.

../llvm/configure CXX=icpc CC=icc CXXFLAGS="-O3 -mmic" CFLAGS="-O3 -mmic" --host=unknown
checking for unknown-clang... icc
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...

configure: WARNING: Configuring LLVM for an unknown target archicture
configure: WARNING: Configuring LLVM for an unknown host archicture
checking for gcc... gcc
configure: error: installation or configuration problem: compiler cannot create executables.

Any ideas?

Frank

Let me add that when not specifying the '--host' option, the whole thing fails as well:

../llvm/configure CXX=icpc CC=icc CXXFLAGS="-O3 -mmic" CFLAGS="-O3 -mmic"

checking for C compiler default output file name... a.out
checking whether the C compiler works... configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.

Frank

For the record: CMake is needed for cross compilation.

There is a small article how to cross compile with CMake for Xeon Phi:

Frank

You also need the --build option. --host should be the target system and --build should be set to the build host. Then configure will use the build host's compiler to build stuff that needs to run there, like tblgen.

I use this to cross build my clang/LLVM based tool chain, ELLCC. http://ellcc.org

-Rich