Help needed building gcc on Arm

Jonathan Wakely jwakely.gcc@gmail.com
Mon Jun 24 10:52:00 GMT 2019


On Sun, 23 Jun 2019 at 19:44, Tim Janes <twjanes@gmail.com> wrote:
>
> I am attempting to build gcc 9.1.0 on an Arm7 (Raspberry Pi) running
> piCore Linux distribution, but i wish it to be build to also run on Arm6
> (older Pi).
>
> My build script looks like this
>
> export CFLAGS="-O2 -pipe -march=armv6zk -mtune=arm1176jzf-s
> -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard-fuse-ld=gold"
> export CXXFLAGS="-O2 -pipe -fno-exceptions -march=armv6zk
> -mtune=arm1176jzf-s -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard
> -fuse-ld=gold"
> export LDFLAGS="-L/usr/local/lib"
>
>   ../gcc-9.1.0/configure \
>      --libdir=/usr/lib \
>      --enable-shared \
>      --enable-threads=posix \
>      --enable-__cxa_atexit \
>      --enable-c99 \
>      --enable-long-long \
>      --enable-clocale=gnu \
>      --enable-languages=c,c++ \
>      --disable-multilib \
>      --disable-libstdcxx-pch \
>      --enable-cloog-backend=isl \
>      --with-isl=/usr \
>      --with-system-zlib \
>      --enable-frame-pointer \
>      --disable-bootstrap \
>      --enable-lto \
>      --with-pkgversion=piCore \
>      --with-arch=armv6zk \
>      --with-tune=arm1176jzf-s \
>      --with-fpu=vfp \
>      --with-float=hard \
>      --with-gxx-include-dir=/usr/include/c++/9.1.0
>
> but this fails with
>
> libtool: compile:
> /mnt/sda1/piCore/10.x/armv7/tcz/src/gcc/build/./gcc/xgcc
> -B/mnt/sda1/piCore/10.x/armv7/tcz/src/gcc/build/./gcc/
> -B/usr/local/armv7l-unknown-linux-gnueabihf/bin/
> -B/usr/local/armv7l-unknown-linux-gnueabihf/lib/ -isystem
> /usr/local/armv7l-unknown-linux-gnueabihf/include -isystem
> /usr/local/armv7l-unknown-linux-gnueabihf/sys-include -DHAVE_CONFIG_H
> -I../../../gcc-9.1.0/libatomic/config/arm
> -I../../../gcc-9.1.0/libatomic/config/linux/arm
> -I../../../gcc-9.1.0/libatomic/config/posix
> -I../../../gcc-9.1.0/libatomic -I. -Wall -Werror -pthread -g -O2 -pipe
> -march=armv6zk -mtune=arm1176jzf-s -mcpu=arm1176jzf-s -mfpu=vfp
> -mfloat-abi=hard -fuse-ld=gold -MT load_1_1_.lo -MD -MP -MF
> .deps/load_1_1_.lo.Ppo -DN=1 -DIFUNC_ALT=1 -march=armv7-a+fp -c
> ../../../gcc-9.1.0/libatomic/config/linux/arm/load_n.c  -fPIC -DPIC -o
> .libs/load_1_1_.o
> cc1: error: switch '-mcpu=arm1176jzf-s' conflicts with '-march=armv7-a'
> switch [-Werror]
> cc1: all warnings being treated as errors
> make[4]: *** [Makefile:854: load_1_1_.lo] Error 1
>
> How do I stop it picking up march=armv7-a - presumably it is getting
> that from the machine I am running on.?
>
> I have tried adding --with-cpu=arm1176jzf-s to the configuration, with
> this I had to remove with-arch and with-tune, but the build gives
> exactly the same error.
>
> Any help or suggestuions would be welcome.

GCC assumes you want to build a compiler that runs on the system it's
being built. To run on a different system you need to build a
cross-compiler, so I think you should use something like:

--host=armv6zk-unknown-linux-gnueabihf

in the configure arguments.



More information about the Gcc-help mailing list