You are not logged in.

#1 2006-12-31 19:18:47

firewalker
Member
From: Hellas (Greece).
Registered: 2006-06-05
Posts: 552

Problem compiling avr-gcc

I downloaded avr-gcc from Aur (from here.)

When I 'm trying to makepkg after some time the fowling error occurs:

make[3]: Entering directory `/home/firewalker/Desktop/gcc-avr4.1.1/src/gcc-4.1.1/objdir/gcc'
/home/firewalker/Desktop/gcc-avr4.1.1/src/gcc-4.1.1/objdir/./gcc/xgcc 
-B/home/firewalker/Desktop/gcc-avr4.1.1/src/gcc-4.1.1/objdir/./gcc/ -B/opt/avr/avr/bin/ -B/opt/avr/avr/lib/ -isystem 
/opt/avr/avr/include -isystem /opt/avr/avr/sys-include -O2  -O2 -march=i686 -O2 -pipe  -DIN_GCC -DCROSS_COMPILE   -W 
-Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -DDF=SF 
-Dinhibit_libc -mcall-prologues -g  -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc -I. -I. -I../../gcc 
-I../../gcc/. -I../../gcc/../include -I../../gcc/../libcpp/include  -DL_eprintf  -c ../../gcc/libgcc2.c -o 
libgcc/./_eprintf.o
cc1: error: unrecognized command line option "-march=i686"
make[3]: *** [libgcc/./_eprintf.o] Error 1
make[3]: Leaving directory `/home/firewalker/Desktop/gcc-avr4.1.1/src/gcc-4.1.1/objdir/gcc'
make[2]: *** [stmp-multilib] Error 2
make[2]: Leaving directory `/home/firewalker/Desktop/gcc-avr4.1.1/src/gcc-4.1.1/objdir/gcc'
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory `/home/firewalker/Desktop/gcc-avr4.1.1/src/gcc-4.1.1/objdir'
make: *** [all] Error 2

What is happening? Why the compiler cant recognize the option -march=i686?

The PKGBUILD file is the fowling:

# Maintainer: danst0 <danst0>
pkgname=gcc-avr

pkgver=4.1.1
pkgrel=1
pkgdesc="The GNU avr Compiler"
url="http://www.gnu.org/software/gcc/gcc.html"
license="GPL"
depends=('glibc' 'binutils-avr' 'gmp' 'mpfr')

source=(ftp://ftp.gnu.org/gnu/gcc/gcc-$pkgver/gcc-$pkgver.tar.bz2)

md5sums=('ad9f97a4d04982ccf4fd67cb464879f3')

build() {
cd $startdir/src/gcc-$pkgver
mkdir objdir
cd objdir
export PATH=$PATH:/opt/avr/bin


../configure --target=avr --prefix=/opt/avr --disable-nls --enable-languages=c --disable-libssp

make || return 1
make DESTDIR=$startdir/pkg install
rm -r $startdir/pkg/opt/avr/include
rm -r $startdir/pkg/opt/avr/avr

}

Γίνε ρεαλιστής, μείνε ονειροπόλος ...

Offline

#2 2007-01-05 17:14:19

queueRAM
Member
Registered: 2006-09-05
Posts: 14

Re: Problem compiling avr-gcc

I was having the same problem, so after some hunting around, i tracked it down in the makefile.  The problem was that they were including the CFLAGS in the CFLAGS_FOR_TARGET, so i got rid of that and replaced it with just -O2.  I'm not sure if this is what was intended, but it makes more sense to me (not to mention it works).

Here's my patch (Makefile.in.diff):

--- Makefile.in.orig    2007-01-05 10:43:50.000000000 -0600
+++ Makefile.in 2007-01-05 10:44:14.000000000 -0600
@@ -329,9 +329,9 @@
 # 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 $(SYSROOT_CFLAGS_FOR_TARGET)
 SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
-CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
+CXXFLAGS_FOR_TARGET = -O2 $(SYSROOT_CFLAGS_FOR_TARGET)
 LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
 LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
 LDFLAGS_FOR_TARGET =

and the PKGBUILD i used:

# Maintainer: danst0 <danst0>
pkgname=gcc-avr

pkgver=4.1.1
pkgrel=1
pkgdesc="The GNU avr Compiler"
url="http://www.gnu.org/software/gcc/gcc.html"
license="GPL"
depends=('glibc' 'binutils-avr' 'gmp' 'mpfr')

source=(ftp://ftp.gnu.org/gnu/gcc/gcc-$pkgver/gcc-$pkgver.tar.bz2 
        Makefile.in.diff)

md5sums=('ad9f97a4d04982ccf4fd67cb464879f3' 'c69a8d8d21bb6dc35889e397d728609a')

build() {
cd $startdir/src/
mv Makefile.in.diff gcc-$pkgver
cd gcc-$pkgver
patch -p0 < Makefile.in.diff
mkdir objdir
cd objdir
export PATH=$PATH:/opt/avr/bin


../configure --target=avr --prefix=/opt/avr --disable-nls --enable-languages=c --disable-libssp

make || return 1
make DESTDIR=$startdir/pkg install
rm -r $startdir/pkg/opt/avr/include
rm -r $startdir/pkg/opt/avr/avr

}

Upon installing this package, though, i get a file conflict with /opt/avr/info/dir which is both created by the binutils-avr and gcc-avr.  I just renamed the old one and all is well.

Offline

#3 2007-01-08 12:42:29

firewalker
Member
From: Hellas (Greece).
Registered: 2006-06-05
Posts: 552

Re: Problem compiling avr-gcc

Thanks. I will give it a try.


Γίνε ρεαλιστής, μείνε ονειροπόλος ...

Offline

#4 2007-01-10 23:36:08

queueRAM
Member
Registered: 2006-09-05
Posts: 14

Re: Problem compiling avr-gcc

If we would have read this other post earlier, we wouldn't be having these issues: http://bbs.archlinux.org/viewtopic.php?t=25825

There, it is described the procedure to compile gcc-avr with makepkg.
1. remove -march=i686 from CFLAGS in /etc/makepkg.conf
2. uncomment the export NOSTRIP="1" from /etc/makepkg.conf
Removing -march=i686 from CFLAGS also fixes this problem.  Make sure you compile your entire toolchain this way though.

The NOSTRIP="1" fixes a cannot find -lgcc problem which you'd otherwise encounter when trying to run avr-gcc later.

Offline

#5 2007-01-11 07:04:19

byte
Member
From: Düsseldorf (DE)
Registered: 2006-05-01
Posts: 2,046

Re: Problem compiling avr-gcc

AUR packages shouldn't need modifying /etc/makepkg.conf.
For the CFLAGS issue you could either modify the Makefile or use the variable directly in the build() function.
For the other issue, just use "options=nostrip" in the PKGBUILD.


1000

Offline

#6 2007-01-11 17:17:48

queueRAM
Member
Registered: 2006-09-05
Posts: 14

Re: Problem compiling avr-gcc

byte wrote:

AUR packages shouldn't need modifying /etc/makepkg.conf.
For the CFLAGS issue you could either modify the Makefile or use the variable directly in the build() function.
For the other issue, just use "options=nostrip" in the PKGBUILD.

I was not aware that this could be done in the PKGBUILD.  I've been going off of the wiki, but I should really be reading the manpages more.  I've successfully built the avr toolchain using this method now though.  Here is my updated PKGBUILD for gcc-avr:

# Maintainer: danst0 <danst0>
pkgname=gcc-avr

pkgver=4.1.1
pkgrel=2
pkgdesc="The GNU avr Compiler"
url="http://www.gnu.org/software/gcc/gcc.html"
license="GPL"
depends=('glibc' 'binutils-avr' 'gmp' 'mpfr')
options=('NOSTRIP')

source=(ftp://ftp.gnu.org/gnu/gcc/gcc-$pkgver/gcc-$pkgver.tar.bz2)

md5sums=('ad9f97a4d04982ccf4fd67cb464879f3')

build() {
  cd $startdir/src/gcc-$pkgver
  mkdir objdir
  cd objdir
  export PATH=$PATH:/opt/avr/bin

  ../configure --target=avr --prefix=/opt/avr --disable-nls 
               --enable-languages=c --disable-libssp

  make CFLAGS='-O2 -pipe' || return 1
  make DESTDIR=$startdir/pkg install
  rm -rf $startdir/pkg/opt/avr/include
  rm -rf $startdir/pkg/opt/avr/avr
  rm -rf $startdie/pkg/opt/avr/info
}

The same changes can be made to the binutils-avr PKGBUILD.  I will try to contact the maintainer of the AUR packages to update them there as well.

Offline

#7 2007-01-16 04:05:42

kcbanner
Member
From: Toronto, Canada
Registered: 2006-08-28
Posts: 43
Website

Re: Problem compiling avr-gcc

Join #robotics and #avr on freenode to discuss all things avr big_smile

Offline

Board footer

Powered by FluxBB