Creating a cross compiler from ARM to x86

Jason Smith jason.tr.smith@gmail.com
Sat Jul 5 17:59:00 GMT 2014


I am trying to build a cross compiler on a BeagleBone Black to compile
from ARM to x86. The intent of this is to use the low power consuming
BeagleBone Black that I had on hand as a build server. It can already
compile for windows through mingw-w64, but I need it to also compile the
code for Linux x86 systems.

However, when I try to compile gcc on the BeagleBone Black I get the
following errors:
    /bin/bash ./libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H
-I. -I../../gcc-4.6.3/gmp -D__GMP_WITHIN_GMP    -g -O2 -c -o
mpn/div_qr_1n_pi1.lo mpn/div_qr_1n_pi1.c
    libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../gcc-4.6.3/gmp
-D__GMP_WITHIN_GMP -g -O2 -c mpn/div_qr_1n_pi1.c -o mpn/div_qr_1n_pi1.o
    /tmp/cckCXg2a.s: Assembler messages:
    /tmp/cckCXg2a.s:194: Error: thumb conditional instruction should be
in IT block -- `movcc r4,#0'
    /tmp/cckCXg2a.s:195: Error: thumb conditional instruction should be
in IT block -- `movcs r4,#-1'
    /tmp/cckCXg2a.s:452: Error: thumb conditional instruction should be
in IT block -- `movcc r4,#0'
    /tmp/cckCXg2a.s:453: Error: thumb conditional instruction should be
in IT block -- `movcs r4,#-1'
    make[4]: *** [mpn/div_qr_1n_pi1.lo] Error 1
    make[4]: Leaving directory `$HOME/builds/gcc/gmp'
    make[3]: *** [all-recursive] Error 1
    make[3]: Leaving directory `$HOME/builds/gcc/gmp'
    make[2]: *** [all] Error 2
    make[2]: Leaving directory `$HOME/builds/gcc/gmp'
    make[1]: *** [all-gmp] Error 2
    make[1]: Leaving directory `$HOME/builds/gcc'
    make: *** [all] Error 2

I know thumbs have something to do with ARM, but I'm mostly at a loss
for why this isn't working. What did I do wrong? Any help would be
greatly appreciated.

Below are the steps I took in trying to create the cross-compiler. This
is my first attempt at trying to make a cross-compiler, so most of this
information was gleamed from several web pages and manuals.



Steps Taken
----------------

To create the cross compiler I downloaded the following packages:
    1. binutils-2.24
    2. gmp-6.0.0a
    3. mpfr-3.1.2
    4. mpc-1.0.2
    5. gcc-4.6.3
    6. linux-3.15.3
    7. glibc-2.19

These were all unpacked into the directory $HOME.


>From there I set the following bash environment variables.
    export PREFIX="$HOME/cross_compiler/x86_64"
    export TARGET="x86_64-linux-gnu"
    export PATH="$PREFIX/bin:$PATH"


I then proceeded to configure, build, and install the binutils.
    mkdir -p $HOME/builds/binutils
    cd $HOME/builds/binutils
    ../../binutils-2.24/configure --target=$TARGET --prefix="$PREFIX"
--disable-nls --disable-werror
    make
    make install


Binutils built without any errors, so I proceeded to build gcc. First I
moved all the extras into the gcc directory.
    mv $HOME/gmp-6.0.0a $HOME/gcc-4.6.3/gmp
    mv $HOME/mpfr-3.1.2 $HOME/gcc-4.6.3/mpfr
    mv $HOME/mpc-1.0.2 $HOME/gcc-4.6.3/mpc


I then configured, without any errors, and tried to build gcc.
    mkdir -p $HOME/builds/gcc
    cd $HOME/builds/gcc
    ../../gcc-4.6.3/configure --target=$TARGET --prefix="$PREFIX"
--disable-nls --enable-languages=c,c++ --enable-shared
--with-multilib-list=m32,m64 --enable-threads=posix --enable-tls
--without-headers
    make


This generated the following errors:
    /bin/bash ./libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H
-I. -I../../gcc-4.6.3/gmp -D__GMP_WITHIN_GMP    -g -O2 -c -o
mpn/div_qr_1n_pi1.lo mpn/div_qr_1n_pi1.c
    libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../gcc-4.6.3/gmp
-D__GMP_WITHIN_GMP -g -O2 -c mpn/div_qr_1n_pi1.c -o mpn/div_qr_1n_pi1.o
    /tmp/cckCXg2a.s: Assembler messages:
    /tmp/cckCXg2a.s:194: Error: thumb conditional instruction should be
in IT block -- `movcc r4,#0'
    /tmp/cckCXg2a.s:195: Error: thumb conditional instruction should be
in IT block -- `movcs r4,#-1'
    /tmp/cckCXg2a.s:452: Error: thumb conditional instruction should be
in IT block -- `movcc r4,#0'
    /tmp/cckCXg2a.s:453: Error: thumb conditional instruction should be
in IT block -- `movcs r4,#-1'
    make[4]: *** [mpn/div_qr_1n_pi1.lo] Error 1
    make[4]: Leaving directory `$HOME/builds/gcc/gmp'
    make[3]: *** [all-recursive] Error 1
    make[3]: Leaving directory `$HOME/builds/gcc/gmp'
    make[2]: *** [all] Error 2
    make[2]: Leaving directory `$HOME/builds/gcc/gmp'
    make[1]: *** [all-gmp] Error 2
    make[1]: Leaving directory `$HOME/builds/gcc'
    make: *** [all] Error 2



BeagleBone Black
    Linux version 3.14.1-bone2 (root@imx6q-wandboard-2gb-0) (gcc version
4.6.3 (Debian 4.6.3-14) ) #1 SMP Sun Apr 20 09:56:48 UTC 2014

Desktop
    This is the computer I am trying to get the code to run on in the end.

    Linux version 3.2.0-65-generic (buildd@brownie) (gcc version 4.6.3
(Ubuntu/Linaro 4.6.3-1ubuntu5) ) #98-Ubuntu SMP Wed Jun 11 20:27:07 UTC 2014

-- 

Jason Smith



More information about the Gcc-help mailing list