Hi Linaro Toolchain Group,

I am trying to build a cross-native toolchain for AARCH64 using ABE build framework.
By cross native I mean that toolchain will be build on 0x86 (Red hat Santiago 6.4), it will run on AARCH64 (Juno) and 
will produce binaries to be run on AARCH64 (Juno)
(If I am not mistaked) --build=0x86, --host=AARCH64, --target=AARCH64

Steps followed:
1. I built a cross toolchain first
../abe/configure
../abe/abe.sh --target aarch64-linux-gnu --build all --release 2015.05.29 --tarbin --disable update
2. Added the above cross toolchain (bin path) in the PATH
3. To build to cross-native
../abe/configure
../abe/abe.sh --host aarch64-linux-gnu --target aarch64-linux-gnu --build all --release 2015.06.01.native --tarbin --disable update

But after some time, I got following error and compilation hanged.

make: Leaving directory `/home/user_name/vpathak/build_abe/builds/aarch64-linux-gnu/aarch64-linux-gnu/gcc.git~linaro-4.9-branch-stage1'
RUN: copy_gcc_libs_to_sysroot "/home/user_name/vpathak/build_abe/builds/destdir/aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc --sysroot=/home/user_name/vpathak/build_abe/sysroots/aarch64-linux-gnu"
/home/user_name/vpathak/abe/lib/make.sh: line 962: ./builds/destdir/aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc: cannot execute binary file

Am I missing something ? Please help.



However with the following hack in the abe, I am able to compile cross-native toolchain for aarch64-linux-gnu.

In the abe code base:
-------------------------------------------------------------------------------------------------------
lib/make.sh
Function copy_gcc_libs_to_sysroot()
     gcc_exe="`find -name ${target}-gcc`"
-    libgcc="`${gcc_exe} -print-file-name=${libgcc}`"
+    #libgcc="`${gcc_exe} -print-file-name=${libgcc}`"
+    libgcc="/home/user_name/vpathak/build_abe/builds/destdir/aarch64-linux-gnu/lib/gcc/aarch64-linux-gnu/4.9.3/libgcc.a"

Since './builds/destdir/aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc' is native toolchain it will not run on 0x86. Thus libgcc will be empty.
Therefore I hard-coded libgcc path.
-------------------------------------------------------------------------------------------------------
I had to disable gdb compilation. This error I faced while compiling cross-native compilation only.
Cross compilation is successful on the same 0x86 machine.

checking for library containing waddstr... no
configure: error: no enhanced curses library found; disable TUI
make: *** [configure-gdb] Error 1
make: Leaving directory `/home/user_name/vpathak/build_abe/builds/aarch64-linux-gnu/aarch64-linux-gnu/binutils-gdb.git~linaro_gdb-7.8-branch-gdb'
WARNING: Make had failures!
ERROR (#159): build_all (Failed building .)

hacked patch
--- a/lib/make.sh
+++ b/lib/make.sh
@@ -31,10 +31,10 @@ build_all()
            # to rebuilt the sysroot.
             local builds="infrastructure binutils libc stage2 gdb"
        else
-            local builds="infrastructure binutils stage1 libc stage2 gdb"
+            local builds="infrastructure binutils stage1 libc stage2"
        fi
        if test "`echo ${target} | grep -c -- -linux-`" -eq 1; then
-           local builds="${builds} gdbserver"
+           local builds="${builds}"
        fi
---------------------------------------------------------------------------------------------------------------

Thanks.


--
with regards,
Virendra Kumar Pathak