Makefile in gcc-4.1.0 unconditionally adds host compiler flags
containing in CFLAGS variable to CFLAGS_FOR_TARGET.
If CFLAGS contains -march=... option, building of libgcc modules
fails with the following error message:
cc1: error: unrecognized command line option "-march=pentiumpro"
Fix: add the following patch to devel/avr-gcc-devel/files
How-To-Repeat: echo CPUTYPE=i686 >>/etc/make.conf
cd /usr/ports/devel/avr-gcc-devel && make
Over to maintainer
As Alex Mogilnikov wrote:
> --- patch-march begins here ---
> --- Makefile.in.orig Thu Dec 15 19:02:02 2005
> +++ Makefile.in Thu Apr 27 03:58:59 2006
> @@ -329,7 +329,7 @@
> # CFLAGS will be just -g. We want to ensure that TARGET libraries
> # (which we know are built with gcc) are built with optimizations so
> # prepend -O2 when setting CFLAGS_FOR_TARGET.
> -CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
> +CFLAGS_FOR_TARGET = -O2 $(filter-out -march=% -mcpu=%,$(CFLAGS)) $(SYSROOT_CFLAGS_FOR_TARGET)
> SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
> CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
> LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
> --- patch-march ends here ---
I'm somewhat reluctant to add hacks like this as local patches.
I think it's basically a pilot error to first set CPU-specific
options in /etc/make.conf's CFLAGS, and then expect any kind of
cross-compilation still to work.
OTOH, it could be considered a general flaw in GCC's cross-compilation
setup, but then, I'd like to see it accompanied by a GCC bug report.
I'm don't think filtering -mcpu and -march is sufficient, as there
could be any number of other options that are incompatible with the
target CPU. At least, all -m options need to be filtered.
cheers, J"org .-.-. --... ...-- -.. . DL8DTL
http://www.sax.de/~joerg/ NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)
Another possible solution would be to set
in the devel/avr-gcc/Makefile, thus overriding all of the CFLAGS
specified in the environment.
Henrik Brix Andersen <firstname.lastname@example.org>
joerg 2006-10-10 10:24:51 UTC
FreeBSD ports repository
OK, I bite. Implement the patch from PR ports/96407, to avoid the
There's a GCC bug open for this:
so at least, the issue is being dealt with in its origin.
Submitted by: Alex Mogilnikov <email@example.com>
Revision Changes Path
1.57 +1 -0 ports/devel/avr-gcc/Makefile
1.1 +13 -0 ports/devel/avr-gcc/files/patch-bug25672 (new)
firstname.lastname@example.org mailing list
To unsubscribe, send any mail to "email@example.com"
Suggested patch has been added, spasibo bolshoye!
There's a GCC bug report for this:
so at least it is a known issue that is being dealt with.
I eventually came to like the patch better than Brix' idea about
blanking CFLAGS entirely, as that would leave us potentially with a
non-optimized compiler which can cause a huge performance penalty in
particular on RISC machines.