Assembler issue Building GCC cross compiler on Linux Debian 4.0.0-9-amd64 to build code for Android ARM

127 views
Skip to first unread message

Stephen Kirby

unread,
Jul 16, 2019, 6:20:26 PM7/16/19
to android-ndk
Hi,

In my effort to build a GCC cross-compiler to build code for Android ARM, I have hit some assembler issues.  The first error from the "make" is:

/home/skirby/android-29/arm-android-eabi/bin/as: unrecognized option '--64'

To get around this I added these (--with-as=/usr/bin/as and --with-ld=/usr/bin/ld) options to my configure.  I did this because this assembler accepts the --64 flag.

But when I do this, the new make error is:

Fatal error: invalid -march= option: `armv5te'

And this happened because I checked the possible options for -march with /usr/bin/as and they are:
march=CPU[,+EXTENSION...]
                          generate code for CPU and EXTENSION, CPU is one of:
                           generic32, generic64, i386, i486, i586, i686,
                           pentium, pentiumpro, pentiumii, pentiumiii, pentium4,
                           prescott, nocona, core, core2, corei7, l1om, k1om,
                           iamcu, k6, k6_2, athlon, opteron, k8, amdfam10,
                           bdver1, bdver2, bdver3, bdver4, znver1, btver1,
                           btver2

None of these are ARM.  

Below are the exact configure parameters I am using and the details of the issues I describe above.  Note -- I followed the procedures as seen in Mike Long's blog at http://specificimpulses.blogspot.com/2011/01/my-android-speaks-fortran-yours-can-too.html.  I too need a FORTRAN cross-compile capability.

Can somebody please help me as to what I am doing wrong here.  Thanks so much.

--Steve

=====================================================================================================================================

Case 1:

configure step:

/home/skirby/gcc-9.1.0/configure --prefix=/home/skirby/android-29 --disable-libquadmath --target=arm-android-eabi --with-gnu-as --with-gnu-ld --enable-languages=c,fortran --with-mpfr=/home/skirby/android-29 --with-gmp=/home/skirby/android-29 --with-mpc=/home/skirby/android-29 --disable-libssp --enable-threads --disable-nls --disable-libgomp --disable-shared --disable-tls --with-float=soft --with-fpu=vfp --with-arch=armv5te --enable-target-optspace --disable-nls --with-sysroot=/home/skirby/NDK/android-ndk-r20/platforms/android-29/arch-arm

Error from the make:
g++ -c   -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE   -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H  -DGENERATOR_FILE -fno-PIE -I. -Ibuild -I/home/skirby/gcc-9.1.0/gcc -I/home/skirby/gcc-9.1.0/gcc/build -I/home/skirby/gcc-9.1.0/gcc/../include  -I/home/skirby/gcc-9.1.0/gcc/../libcpp/include  \
-o build/genmodes.o /home/skirby/gcc-9.1.0/gcc/genmodes.c
/home/skirby/android-29/arm-android-eabi/bin/as: unrecognized option '--64'

=============================================================================
Case 2 (add --with-as=/usr/bin/as and --with-ld=/usr/bin/ld to configure):

configure --

/home/skirby/gcc-9.1.0/configure --prefix=/home/skirby/android-29 --disable-libquadmath --target=arm-android-eabi --with-gnu-as --with-gnu-ld --enable-languages=c,fortran --with-mpfr=/home/skirby/android-29 --with-gmp=/home/skirby/android-29 --with-mpc=/home/skirby/android-29 --disable-libssp --enable-threads --disable-nls --disable-libgomp --disable-shared --disable-tls --with-float=soft --with-fpu=vfp --with-arch=armv5te --enable-target-optspace --disable-nls --with-sysroot=/home/skirby/NDK/android-ndk-r20/platforms/android-29/arch-arm --with-as=/usr/bin/as --with-ld=/usr/bin/ld

Error from the make:
checking for arm-android-eabi-gcc... /home/skirby/build-gcc-arm/./gcc/xgcc -B/home/skirby/build-gcc-arm/./gcc/ -B/home/skirby/android-29/arm-android-eabi/bin/ -B/home/skirby/android-29/arm-android-eabi/lib/ -isystem /home/skirby/android-29/arm-android-eabi/include -isystem /home/skirby/android-29/arm-android-eabi/sys-include   
checking for suffix of object files... configure: error: in `/home/skirby/build-gcc-arm/arm-android-eabi/libgcc':
configure: error: cannot compute suffix of object files: cannot compile

checking config.log:
configure:3767: /home/skirby/build-gcc-arm/./gcc/xgcc -B/home/skirby/build-gcc-arm/./gcc/ -B/home/skirby/android-29/arm-android-eabi/bin/ -B/home/skirby/android-29/arm-android-eabi/lib/ -isystem /home/skirby/android-29/arm-android-eabi/include -isystem /home/skirby/android-29/arm-android-eabi/sys-include    -c -g -O2 -g -Os  conftest.c >&5
Assembler messages:
Fatal error: invalid -march= option: `armv5te'

Andrew Esh

unread,
Jul 18, 2019, 9:58:27 AM7/18/19
to android-ndk
"--64" is probably not the right way to control the target for the assembler. Perhaps use "-march= "instead.

"/usr/bin/as" is not part of your cross development toolchain. It is meant to support building in your host environment only. Use the arm-android-eabi tools only.

Stephen Kirby

unread,
Jul 18, 2019, 11:48:27 AM7/18/19
to android-ndk
Thanks Andrew.  I'm going to test out your suggestions.
Reply all
Reply to author
Forward
0 new messages