GCC compile failure?

Go To Last Post
11 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello.

I have a problem that needs some urgent attention, and I was wondering if anyone could help.

I am trying to prepare my AMD64 (the only computer I own) for cross-compilation to the Atmel AVR 8-bit MCU, as I have some projects in the pipeline.
Interestingly, I have had gcc, avr-libc, avrdude and gnome-avrdude all up and working before (although I suspect it was on my previous 32-bit computer), using the following command:

# crossdev -t avr

The problem I have now is that I cannot get gcc to compile for avr at all. I have used the above command, and I have manually tried to build gcc versions 4.1.2, 4.2.2 and 4.2.3, all of them fail. Following, are the error message I receive for all 4 tries:

1: crossdev -t avr logfile from /var/log/portage/cross-avr-gcc-stage1.log

Quote:
make[3]: *** [libgcc/avr35/_mulsi3.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory `/tmp/portage/cross/avr/portage/cross-avr/gcc-4.2.3/work/build/gcc'
make[2]: *** [stmp-multilib] Error 2
make[2]: Leaving directory `/tmp/portage/cross/avr/portage/cross-avr/gcc-4.2.3/work/build/gcc'
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory `/tmp/portage/cross/avr/portage/cross-avr/gcc-4.2.3/work/build'
make: *** [all] Error 2
*
* ERROR: cross-avr/gcc-4.2.3 failed.
* Call stack:
* ebuild.sh, line 49: Called src_compile
* environment, line 4614: Called toolchain_src_compile
* environment, line 5083: Called gcc_src_compile
* environment, line 2943: Called gcc_do_make
* environment, line 2773: Called die
* The specific snippet of code:
* emake LDFLAGS="${LDFLAGS}" STAGE1_CFLAGS="${STAGE1_CFLAGS}" LIBPATH="${LIBPATH}" BOOT_CFLAGS="${BOOT_CFLAGS}" ${GCC_MAKE_TARGET} || die "emake failed with ${$
* The die message:
* emake failed with all
*
* If you need support, post the topmost build error, and the call stack if relevant.
* A complete build log is located at '/tmp/portage/cross/avr/portage/cross-avr/gcc-4.2.3/temp/build.log'.
* The ebuild environment file is located at '/tmp/portage/cross/avr/portage/cross-avr/gcc-4.2.3/temp/environment'.
* This ebuild is from an overlay: '/usr/local/portage/'
*

2: gcc-4.1.2

Quote:
../../../libssp/ssp.c: In function '__guard_setup':
../../../libssp/ssp.c:70: warning: implicit declaration of function 'open'
../../../libssp/ssp.c:70: error: 'O_RDONLY' undeclared (first use in this function)
../../../libssp/ssp.c:70: error: (Each undeclared identifier is reported only once
../../../libssp/ssp.c:70: error: for each function it appears in.)
../../../libssp/ssp.c:73: error: 'ssize_t' undeclared (first use in this function)
../../../libssp/ssp.c:73: error: expected ';' before 'size'
../../../libssp/ssp.c:75: warning: implicit declaration of function 'close'
../../../libssp/ssp.c:76: error: 'size' undeclared (first use in this function)
../../../libssp/ssp.c: At top level:
../../../libssp/ssp.c:89: error: expected declaration specifiers or '...' before 'size_t'
../../../libssp/ssp.c: In function 'fail':
../../../libssp/ssp.c:100: error: 'O_WRONLY' undeclared (first use in this function)
../../../libssp/ssp.c:104: error: 'size_t' undeclared (first use in this function)
../../../libssp/ssp.c:104: error: expected ';' before 'progname_len'
../../../libssp/ssp.c:107: error: 'progname_len' undeclared (first use in this function)
../../../libssp/ssp.c:107: warning: implicit declaration of function 'strlen'
../../../libssp/ssp.c:107: warning: incompatible implicit declaration of built-in function 'strlen'
../../../libssp/ssp.c:108: error: 'len' undeclared (first use in this function)
../../../libssp/ssp.c:108: error: 'msg1len' undeclared (first use in this function)
../../../libssp/ssp.c:109: warning: implicit declaration of function 'alloca'
../../../libssp/ssp.c:109: warning: incompatible implicit declaration of built-in function 'alloca'
../../../libssp/ssp.c:111: warning: implicit declaration of function 'memcpy'
../../../libssp/ssp.c:111: warning: incompatible implicit declaration of built-in function 'memcpy'
../../../libssp/ssp.c:119: error: 'ssize_t' undeclared (first use in this function)
../../../libssp/ssp.c:119: error: expected ';' before 'wrote'
../../../libssp/ssp.c:120: error: 'wrote' undeclared (first use in this function)
../../../libssp/ssp.c:151: warning: implicit declaration of function '_exit'
../../../libssp/ssp.c:151: warning: incompatible implicit declaration of built-in function '_exit'
../../../libssp/ssp.c: In function '__stack_chk_fail':
../../../libssp/ssp.c:161: warning: incompatible implicit declaration of built-in function 'strlen'
../../../libssp/ssp.c:161: warning: passing argument 2 of 'fail' makes pointer from integer without a cast
../../../libssp/ssp.c:161: error: too many arguments to function 'fail'
../../../libssp/ssp.c: In function '__chk_fail':
../../../libssp/ssp.c:168: warning: incompatible implicit declaration of built-in function 'strlen'
../../../libssp/ssp.c:168: warning: passing argument 2 of 'fail' makes pointer from integer without a cast
../../../libssp/ssp.c:168: error: too many arguments to function 'fail'
make[3]: *** [ssp.lo] Error 1
make[3]: Leaving directory `/home/nathaniel/Programs/gcc-4.1.2/obj-avr/avr/libssp'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/nathaniel/Programs/gcc-4.1.2/obj-avr/avr/libssp'
make[1]: *** [all-target-libssp] Error 2

3: gcc-4.2.2

Quote:
../../../libssp/ssp.c: In function '__guard_setup':
../../../libssp/ssp.c:70: warning: implicit declaration of function 'open'
../../../libssp/ssp.c:70: error: 'O_RDONLY' undeclared (first use in this function)
../../../libssp/ssp.c:70: error: (Each undeclared identifier is reported only once
../../../libssp/ssp.c:70: error: for each function it appears in.)
../../../libssp/ssp.c:73: error: 'ssize_t' undeclared (first use in this function)
../../../libssp/ssp.c:73: error: expected ';' before 'size'
../../../libssp/ssp.c:75: warning: implicit declaration of function 'close'
../../../libssp/ssp.c:76: error: 'size' undeclared (first use in this function)
../../../libssp/ssp.c: At top level:
../../../libssp/ssp.c:89: error: expected declaration specifiers or '...' before 'size_t'
../../../libssp/ssp.c: In function 'fail':
../../../libssp/ssp.c:100: error: 'O_WRONLY' undeclared (first use in this function)
../../../libssp/ssp.c:104: error: 'size_t' undeclared (first use in this function)
../../../libssp/ssp.c:104: error: expected ';' before 'progname_len'
../../../libssp/ssp.c:107: error: 'progname_len' undeclared (first use in this function)
../../../libssp/ssp.c:107: warning: implicit declaration of function 'strlen'
../../../libssp/ssp.c:107: warning: incompatible implicit declaration of built-in function 'strlen'
../../../libssp/ssp.c:108: error: 'len' undeclared (first use in this function)
../../../libssp/ssp.c:108: error: 'msg1len' undeclared (first use in this function)
../../../libssp/ssp.c:109: warning: implicit declaration of function 'alloca'
../../../libssp/ssp.c:109: warning: incompatible implicit declaration of built-in function 'alloca'
../../../libssp/ssp.c:111: warning: implicit declaration of function 'memcpy'
../../../libssp/ssp.c:111: warning: incompatible implicit declaration of built-in function 'memcpy'
../../../libssp/ssp.c:119: error: 'ssize_t' undeclared (first use in this function)
../../../libssp/ssp.c:119: error: expected ';' before 'wrote'
../../../libssp/ssp.c:120: error: 'wrote' undeclared (first use in this function)
../../../libssp/ssp.c:151: warning: implicit declaration of function '_exit'
../../../libssp/ssp.c:151: warning: incompatible implicit declaration of built-in function '_exit'
../../../libssp/ssp.c: In function '__stack_chk_fail':
../../../libssp/ssp.c:161: warning: incompatible implicit declaration of built-in function 'strlen'
../../../libssp/ssp.c:161: warning: passing argument 2 of 'fail' makes pointer from integer without a cast
../../../libssp/ssp.c:161: error: too many arguments to function 'fail'
../../../libssp/ssp.c: In function '__chk_fail':
../../../libssp/ssp.c:168: warning: incompatible implicit declaration of built-in function 'strlen'
../../../libssp/ssp.c:168: warning: passing argument 2 of 'fail' makes pointer from integer without a cast
../../../libssp/ssp.c:168: error: too many arguments to function 'fail'
make[3]: *** [ssp.lo] Error 1
make[3]: Leaving directory `/home/nathaniel/Programs/gcc-4.2.2/obj-avr/avr/libssp'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/nathaniel/Programs/gcc-4.2.2/obj-avr/avr/libssp'
make[1]: *** [all-target-libssp] Error 2
make[1]: Leaving directory `/home/nathaniel/Programs/gcc-4.2.2/obj-avr'
make: *** [all] Error 2

4: gcc-4.2.3

Quote:
../../gcc/config/avr/libgcc.S: Assembler messages:
../../gcc/config/avr/libgcc.S:280: Error: illegal opcode movw for mcu avr3
../../gcc/config/avr/libgcc.S:282: Error: illegal opcode movw for mcu avr3
make[3]: *** [libgcc/avr35/_mulsi3.o] Error 1
make[3]: Leaving directory `/home/nathaniel/Programs/gcc-4.2.3/obj-avr/gcc'
make[2]: *** [stmp-multilib] Error 2
make[2]: Leaving directory `/home/nathaniel/Programs/gcc-4.2.3/obj-avr/gcc'
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory `/home/nathaniel/Programs/gcc-4.2.3/obj-avr'
make: *** [all] Error 2

Judging from the error messages, crossdev is currently using gcc-4.2.3.

Naturally, I am quite frustrated by this, especially seeing as I am expecting a delivery of an ATmega8 and some other doodads tomorrow (Tuesday 18th March).

Any help would be greatly appreciated.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well the error about O_RDONLY suggests that a file include path may have a problem. Looking at a standard C reference reminds me that it's a possible parameter to the open() library function and that would usually require the inclusion of and .

Though I'm a bit puzzled as to what use such filesystem-centric calls would be on an AVR? (or have you implemented an fsys on memory card or something?)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
Though I'm a bit puzzled as to what use such filesystem-centric calls would be on an AVR? (or have you implemented an fsys on memory card or something?)

I havn't begun to even start developing on AVR yet. I'm trying to install avr-gcc on my Gentoo computer, but during compilation of gcc, it fails.

I'm coming from a minute experience with PIC's, and having the worlds most fantastic 4-month long problems getting the programmer to work (with culminated in the death of the programmer), I'm moving to AVR.

But without avr-gcc...I'm a bit stuck :(

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Configure with --disable-libssp.

Better yet, have a look at Bingo600's Linux build script on top.
It builds with all current patches, otherwise your toolchain might
miss some. Also, crossdev has been known in the past to notoriously
cause troubles with the AVR toolchain, so I'd recommend to stay away
from it.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I also reiterate what Joerg says: stay away from crossdev as it has known problems in building an AVR toolchain correctly.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

dl8dtl wrote:
Configure with --disable-libssp.

Hi, thanks for your help. Compilation of gcc progressed farther than before, but then stumped, saying that the GNU-Fortran compiler was broken.

I have managed to find and install a pre-built toolchain fromThis Page, which will hopefully fit the bill. But the trial comes tomorrow :)

Thanks for your help guys. No doubt I will see you soon with many annoying newbie questions (I will try my best with the datasheets first) :)

Nathaniel.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just to check but when Jörg mentioned the "Bing600 script" you did know what he was talking about didn't you? That is:

http://www.avrfreaks.net/index.p...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
Just to check but when Jörg mentioned the "Bing600 script" you did know what he was talking about didn't you? That is:

http://www.avrfreaks.net/index.p...

I didn't at first, but I Google'd and came back to that thread.
Although, to be honest, I don't think I scrolled as far down the thread as just now.

But thanks for doubly making sure, if I encounter any problems tomorrow, I'll check back to Bingo600's thread.

Thanks again.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

> ...saying that the GNU-Fortran compiler was broken.

Only C is fully supported at this time. C++ is supported except of the
library, and AFAICT a fair amount of Ada support does exist for the AVR
target (enough for Eric Weddington to ship AVR-Ada as part of WinAVR).

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The front-ends available for the AVR are: c,c++,ada,objc

However, you need many patches to build AVR-Ada, which contains the Ada support library for the AVR. I don't think there would be very many people ever using Objective-C for the AVR and to properly build it, you have to build just the C compiler first, then build avr-libc for the headers, then go back and build for all languages. This takes up more time obviously, but it is a fairly typical build process for other targets and for native compilers.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I love most things about Gentoo, but crossdev is not one of them. Forget you ever heard about it. Just ./configure --prefix=/usr/local/avr and build from sources. This is one place where a spiral notebook is a better package manager than what you get from portage.