Cross compiling question

I am trying to build a x86_64 to ARM cross compiler.

I configured, built and installed LLVM as follows:

$ …/…/…/src/llvm/configure --with-llvmgccdir=/install/x86_64-arm/llvm-gcc-4.2 --enable-optimized --enable-jit --prefix=/install/x86_64-arm/llvm --target=arm-unknown-linux-gnueabi

$ make
$ make install

Then I configured gcc front end as follows:

$ …/…/…/src/llvm-gcc-4.2/configure --prefix=/install/x86_64-arm/llvm-gcc-4.2 --program-prefix=llvm-x86_64-arm --enable-llvm=/install/x86_64-arm/llvm --enable-languages=c,c++ --disable-multilib --target=arm-unknown-linux-gnueabi

I get the following error:

exec: 2: -meabi=4: not found

while assembling …/…/…/…/src/llvm-gcc-4.2/gcc/crtstuff.c

I found that execution of the command
/build/x86_64-arm/llvm-gcc-4.2/./gcc/as

which is part of execution of the command

/build/x86_64-arm/llvm-gcc-4.2/./gcc/xgcc

is the resulting in this error. It turns out that this is a 2 line shell script that exec’s the arguments like thus:

#!/bin/sh
exec “$@”

Where is the assembler that needs to be invoked? What do I need to do to get the configuration find it?

What am I doing wrong?

Thanks for any help!

Bharadwaj

S. Bharadwaj Yadavalli wrote:

I am trying to build a x86_64 to ARM cross compiler.

I configured, built and installed LLVM as follows:

$ ../../../src/llvm/configure --with-llvmgccdir=<llvm-root>/install/x86_64-arm/llvm-gcc-4.2 --enable-optimized --enable-jit --prefix=<llvm-root>/install/x86_64-arm/llvm --target=arm-unknown-linux-gnueabi

$ make
$ make install

Then I configured gcc front end as follows:

$ ../../../src/llvm-gcc-4.2/configure --prefix=<llvm-root>/install/x86_64-arm/llvm-gcc-4.2 --program-prefix=llvm-x86_64-arm --enable-llvm=<llvm-root>/install/x86_64-arm/llvm --enable-languages=c,c++ --disable-multilib --target=arm-unknown-linux-gnueabi

I can't really comment on your specific problem, but you might try adding --with-build-sysroot to point to your arm headers. You also need to have binutils built for cross ARM as well. If cross binutils is in your path (bins will have arm prefix) you're fine, otherwise you need to specify them at configure too (--with-gnu-ld, --with-gnu-as). I don't know if you need cross gmp or mpfr too.

I may be way off-base, but this is part of how I got a cross for SPARC built.

Good luck,
Luke

Luke Dalessandro wrote:

S. Bharadwaj Yadavalli wrote:

$ ../../../src/llvm-gcc-4.2/configure --prefix=<llvm-root>/install/x86_64-arm/llvm-gcc-4.2 --program-prefix=llvm-x86_64-arm --enable-llvm=<llvm-root>/install/x86_64-arm/llvm --enable-languages=c,c++ --disable-multilib --target=arm-unknown-linux-gnueabi

I can't really comment on your specific problem, but you might try adding --with-build-sysroot to point to your arm headers. You also need to have binutils built for cross ARM as well. If cross binutils is in your path (bins will have arm prefix) you're fine, otherwise you need to specify them at configure too (--with-gnu-ld, --with-gnu-as). I don't know if you need cross gmp or mpfr too.

Sorry, that should be --with-sysroot. And I guess you don't need gmp or mpfr since you're running it on a system where those exist already.

For more info about these configure options see http://gcc.gnu.org/install/configure.html under "Cross-Compiler-Specific Options."

Good luck,
Luke

Thanks for the tip! I was able to build the front end with the suggested config option.

Bharadwaj