On 24/06/2019 14:54, Tim Janes wrote: > > > On 24/06/2019 11:52, Jonathan Wakely wrote: >> On Sun, 23 Jun 2019 at 19:44, Tim Janes <twjanes@xxxxxxxxx> 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. > Thanks I will try that and let you know if that fixes it. > > I am however even more confused, last night I dug out an old arm6 > system, and stared afresh, after 18hours running it has failed with the > same error, we are running on an arm6 so how is it picking up arm7-a? > > cc1: error: switch '-mcpu=arm1176jzf-s' conflicts with '-march=armv7-a' > > Tim. I think this is because your environment variables are interfering with the build system. Why are you trying to set CFLAGS and CXXFLAGS? Also, note that in GCC-9 setting -mfpu on the command line should no-longer be necessary (the -mfpu option now defaults to -mfpu=auto). The floating-point options can now be derived from the CPU or architecture specification - see the manual for details. You probably want to change your configure options to: ../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+fp \ --with-tune=arm1176jzf-s \ --with-float=hard \ --with-gxx-include-dir=/usr/include/c++/9.1.0 If you do this, and get rid of the environment variables, then the result after a 3-stage bootstrap should be compatible with your Arm6 based Pi. R.