Problems compiling hello world for Arm

Post new topic   Reply to topic    DD-WRT Forum Index -> Generic Questions
Author Message
jrussell88
DD-WRT User


Joined: 01 May 2009
Posts: 64

PostPosted: Sat Oct 29, 2016 21:00    Post subject: Problems compiling hello world for Arm Reply with quote
Can anyone suggest what the problem is - my hello world program fails to compile; here's what I did.

Code:
$ arm-openwrt-linux-muslgnueabi-gcc hello.c -DNEED_PRINTF -o hello
Assembler messages:
Fatal error: invalid -march= option: `armv7-a'


I'm running Ubuntu 15.10 x64, and compiling for a Linksys EA8500:
Code:
# cat /proc/version
   Linux version 3.18.26 (root@seg-desktop) (gcc version 5.2.0 (OpenWrt GCC 5.2.0 r47665) ) #59 SMP PREEMPT Mon Feb 1 01:26:29 CET 2016


I installed the GNU C compiler for armhf architecture: gcc-arm-linux-gnueabihf and downloaded and unpacked the dd-wrt toolchains: ftp://ftp.dd-wrt.com/toolchains/

The Linksys EA8500 has an Arm 7a Neon processor so the relevant toolchain is:
/..../toolchains/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_musl-1.1.2_eabi

Add the path for the cross-compiler executable to the path environment variable:
Code:
PATH=~/..../toolchains/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_musl-1.1.2_eabi/bin:$PATH


Turn on executable bits (chmod a+x or Nautilus) for:
/..../toolchains/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_musl-1.1.2_eabi/bin/arm-linux-uclibc-gcc
/..../toolchains/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_musl-1.1.2_eabi/lib/gcc/arm-openwrt-linux-muslgnueabi/4.8.3/cc1
/..../toolchains/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_musl-1.1.2_eabi/lib/gcc/arm-openwrt-linux-muslgnueabi/4.8.3/cc1plus
/..../toolchains/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_musl-1.1.2_eabi/lib/gcc/arm-openwrt-linux-muslgnueabi/4.8.3/collect2

hello.c:
Code:
#include <stdio.h>
int main(int argc, char **argv)
{ printf("hello %d\n", argc); }


Compile hello.c, enabling printf output:
Code:
arm-linux-uclibc-gcc hello.c -DNEED_PRINTF -o hello


Verbose output:
Quote:
$ arm-linux-uclibc-gcc hello.c -v -DNEED_PRINTF -o hello
Using built-in specs.
COLLECT_GCC=arm-linux-uclibc-gcc
Target: arm-openwrt-linux-muslgnueabi
Configured with: /home/xfs/openwrt/trunk2/trunk/build_dir/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_musl-1.1.2_eabi/gcc-linaro-4.8-2014.04/configure --with-bugurl=https://dev.openwrt.org/ --with-pkgversion='OpenWrt/Linaro GCC 4.8-2014.04 r41062' --prefix=/home/xfs/openwrt/trunk2/trunk/staging_dir/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_musl-1.1.2_eabi --build=x86_64-suse-linux --host=x86_64-suse-linux --target=arm-openwrt-linux-muslgnueabi --with-gnu-ld --enable-target-optspace --disable-libgomp --disable-libmudflap --disable-multilib --disable-nls --with-host-libstdcxx=-lstdc++ --with-gmp=/home/xfs/openwrt/trunk2/trunk/staging_dir/host --with-mpfr=/home/xfs/openwrt/trunk2/trunk/staging_dir/host --disable-decimal-float --with-mpc=/home/xfs/openwrt/trunk2/trunk/staging_dir/host --disable-libssp --enable-__cxa_atexit --with-arch=armv7-a --with-headers=/home/xfs/openwrt/trunk2/trunk/staging_dir/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_musl-1.1.2_eabi/include --enable-languages=c,c++ --enable-shared --enable-threads --with-slibdir=/home/xfs/openwrt/trunk2/trunk/staging_dir/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_musl-1.1.2_eabi/lib
Thread model: posix
gcc version 4.8.3 (OpenWrt/Linaro GCC 4.8-2014.04 r41062)
COLLECT_GCC_OPTIONS='-v' '-D' 'NEED_PRINTF' '-o' 'hello' '-march=armv7-a' '-mtls-dialect=gnu'
/..../toolchains/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_musl-1.1.2_eabi/bin/../lib/gcc/arm-openwrt-linux-muslgnueabi/4.8.3/cc1 -quiet -v -iprefix /..../toolchains/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_musl-1.1.2_eabi/bin/../lib64/gcc/arm-openwrt-linux-muslgnueabi/4.8.3/ -D NEED_PRINTF hello.c -quiet -dumpbase hello.c -march=armv7-a -mtls-dialect=gnu -auxbase hello -version -o /tmp/ccnrh6IF.s
GNU C (OpenWrt/Linaro GCC 4.8-2014.04 r41062) version 4.8.3 (arm-openwrt-linux-muslgnueabi)
compiled by GNU C version 4.7.2 20130108 [gcc-4_7-branch revision 195012], GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "/..../toolchains/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_musl-1.1.2_eabi/bin/../lib64/gcc/../../lib64/gcc/arm-openwrt-linux-muslgnueabi/4.8.3/include"
ignoring duplicate directory "/..../toolchains/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_musl-1.1.2_eabi/bin/../lib64/gcc/../../lib64/gcc/arm-openwrt-linux-muslgnueabi/4.8.3/include-fixed"
ignoring duplicate directory "/..../toolchains/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_musl-1.1.2_eabi/bin/../lib64/gcc/../../lib64/gcc/arm-openwrt-linux-muslgnueabi/4.8.3/../../../../arm-openwrt-linux-muslgnueabi/sys-include"
ignoring duplicate directory "/..../toolchains/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_musl-1.1.2_eabi/bin/../lib64/gcc/../../lib64/gcc/arm-openwrt-linux-muslgnueabi/4.8.3/../../../../arm-openwrt-linux-muslgnueabi/include"
#include "..." search starts here:
#include <...> search starts here:
/..../toolchains/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_musl-1.1.2_eabi/bin/../lib64/gcc/arm-openwrt-linux-muslgnueabi/4.8.3/include
/..../toolchains/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_musl-1.1.2_eabi/bin/../lib64/gcc/arm-openwrt-linux-muslgnueabi/4.8.3/include-fixed
/..../toolchains/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_musl-1.1.2_eabi/bin/../lib64/gcc/arm-openwrt-linux-muslgnueabi/4.8.3/../../../../arm-openwrt-linux-muslgnueabi/sys-include
/..../toolchains/toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_musl-1.1.2_eabi/bin/../lib64/gcc/arm-openwrt-linux-muslgnueabi/4.8.3/../../../../arm-openwrt-linux-muslgnueabi/include
End of search list.
GNU C (OpenWrt/Linaro GCC 4.8-2014.04 r41062) version 4.8.3 (arm-openwrt-linux-muslgnueabi)
compiled by GNU C version 4.7.2 20130108 [gcc-4_7-branch revision 195012], GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 78b3c37e1aa30b6fbf8650f043dd3b51
COLLECT_GCC_OPTIONS='-v' '-D' 'NEED_PRINTF' '-o' 'hello' '-march=armv7-a' '-mtls-dialect=gnu'
as -v -march=armv7-a -meabi=5 -o /tmp/cc3xlkex.o /tmp/ccnrh6IF.s
GNU assembler version 2.25.1 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.25.1
Assembler messages:
Fatal error: invalid -march= option: `armv7-a'


Have I missed something? Thanks!
Sponsor
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Generic Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum