Go Down

Topic: Incrementation bug? WTF? [BROKEN COMPILER - SOLVED] (Read 9070 times) previous topic - next topic

kg4wsv

You might try avoiding the problem by applying good programming practice, and declare hue in the function where it's used (instead of using a global variable):
Code: [Select]
void loop()
{
   static int hue = 0;

   ...


-j

dsh

#16
Feb 03, 2011, 11:03 pm Last Edit: Feb 03, 2011, 11:06 pm by dsh1 Reason: 1
I just would like to know if it's likely that installing avr-gcc from sources will solve the problem?

@kg4wsv

Thanks, I usually apply good programming practices. I just got my arduino today and was experimenting. It's not like it's some kind of a production code. Besides in a one-file, 50 liner it really doesn't matter if you use global variables.

And working around compiler bugs like this is way more evil than bad programming practices.

stimmer

I don't know if compiling from source would help, if you've got the time and the patience you could try it. I couldn't get the compiler to compile on Ubuntu and I just gave up.

Due VGA library - http://arduino.cc/forum/index.php/topic,150517.0.html

dsh

#18
Feb 03, 2011, 11:52 pm Last Edit: Feb 04, 2011, 12:35 am by dsh1 Reason: 1
It could be gcc version or configure switches. I adapted PKGBUILDs from tinyos and compiled latest vanilla binutils (2.21) and gcc (4.5.2) and still the same problem.

If you know anything about compiling gcc-avr tell me if you see something suspicious here:

GCC:
Code: [Select]
 ../configure --disable-libssp \
              --disable-nls \
              --enable-languages=c,c++ \
              --infodir=/usr/share/info \
              --libdir=/usr/lib \
              --libexecdir=/usr/lib \
              --mandir=/usr/share/man \
              --prefix=/usr \
              --target=avr \
              --with-gnu-as \
              --with-gnu-ld \
              --with-as=/usr/bin/avr-as \
              --with-ld=/usr/bin/avr-ld



binutils:
Code: [Select]
   ../configure --build=$(../config.guess) \
                --disable-nls \
                --enable-install-libbfd \
                --includedir=/usr/$(../config.guess)/include \
                --infodir=/usr/share/info \
                --libdir=/usr/lib \
                --mandir=/usr/share/man \
                --prefix=/usr \
                --target=avr \
                --disable-werror


Just compiled gcc 4.2.3 and it doesn't support atmega328p. One more try... This time 4.4.5.

--- EDIT --- No luck with 4.4.5 either. I suppose there are some patches or configure switches that fix this issue...

And I almost forgot: Thank you all for help, it's very appreciated.

stimmer

I'd suggest downgrading to version 4.3.5, and applying the set of patches that Debian currently uses. The patches are here (debian/bsdpatches directory):
http://ftp.de.debian.org/debian/pool/main/g/gcc-avr/gcc-avr_4.3.5-1.tar.gz
(this is just the patches, you'll need to download the GCC 4.3.5 source as well from gcc.gnu.org)

Binutils may also need Debian patches.
http://ftp.de.debian.org/debian/pool/main/b/binutils-avr/binutils-avr_2.20.1-1.tar.gz
Due VGA library - http://arduino.cc/forum/index.php/topic,150517.0.html

dsh

GCC and BINUTILS with debian patchset work great.

I prepared arch i686 packages:
http://student.if.uj.edu.pl/Filip.Sobalski/binutils-avr-2.20.1-1-i686.pkg.tar.xz
http://student.if.uj.edu.pl/Filip.Sobalski/gcc-avr-4.3.5-1-i686.pkg.tar.xz

For those who use x86_64 here are the PKGBUILDS:
http://student.if.uj.edu.pl/Filip.Sobalski/binutils-avr-debian.tar.gz
http://student.if.uj.edu.pl/Filip.Sobalski/gcc-avr-debian.tar.gz

Thank you!

stimmer

Good work, let's see if this helps the people having trouble in the other thread.
Due VGA library - http://arduino.cc/forum/index.php/topic,150517.0.html

stimmer

The x86_64 PKGBUILDS worked for me on my Virtualbox installation.

I force-installed the Binutils package first, and that was enough to get the linker to output correct code. This suggests the problem is with Binutils rather than GCC. Installing the downgraded GCC as well gave more efficient and shorter code, so it is worth doing both.
Due VGA library - http://arduino.cc/forum/index.php/topic,150517.0.html

igor86

I tried the x86_64 packages. Binutils compiled fine, but gcc-avr spit the following error:

Code: [Select]

checking for suffix of object files... configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[1]: *** [configure-target-libgcc] Error 1
make[1]: Leaving directory `/home/igor/Misc/ArchBuilds/gcc-avr-debian/src/gcc-4.3.5/build'
make: *** [all] Error 2
    Aborting...
??[igor]??[X201]
??[~/Misc/ArchBuilds/gcc-avr-debian]$


I haven't come across this kind of error before (not really a programmer), but if someone knows what this means, please share!

Thanks for preparing the PKGBUILDS dsh1!
-Igor

dsh

#24
Feb 04, 2011, 02:06 pm Last Edit: Feb 04, 2011, 02:17 pm by dsh1 Reason: 1

I tried the x86_64 packages. Binutils compiled fine, but gcc-avr spit the following error:

Code: [Select]

checking for suffix of object files... configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[1]: *** [configure-target-libgcc] Error 1
make[1]: Leaving directory `/home/igor/Misc/ArchBuilds/gcc-avr-debian/src/gcc-4.3.5/build'
make: *** [all] Error 2
   Aborting...
??[igor]??[X201]
??[~/Misc/ArchBuilds/gcc-avr-debian]$


I haven't come across this kind of error before (not really a programmer), but if someone knows what this means, please share!

Thanks for preparing the PKGBUILDS dsh1!
-Igor


Post your config.log please. It will be somewhere in src/gcc-4.3.5



I force-installed the Binutils package first, and that was enough to get the linker to output correct code. This suggests the problem is with Binutils rather than GCC. Installing the downgraded GCC as well gave more efficient and shorter code, so it is worth doing both.


I also had to use force installation. Original Arch packages leave some manpages even if uninstalled, but it shouldn't be a problem.

mkpetch

Thanks for this (I've posted on the other thread started by Igor86 as I have the same problem)

Well I get the same compile error as Igor with the x86_64 debian patched gcc-avr  =(

Since Stimmer mentions the problem seems to be in the binutils-avr package I'm looking into whether I can patch my currently installed binutils-avr 2.21-1 rather than downgrade that and gcc-avr. BTW dsh's debian patched binutils for x86_64 compiles fine for me but I can't even force install it because of currently installed gcc-avr 4.5.2-1 dependencies... sigh.

So yeah, googling around with all the useful pointers from these threads... will post if I get anywhere with patching 2.21-1... maybe this is an upstream problem and I'm not sure how/whether to send a bug report to the relevant Arch package maintainers yet but thanks for all the help!

I'll attach the offending config.log too for the compile errors which was in src/gcc-4.3.5/build/avr/avrxmega2/libgcc/config.log (wierd problem config can't compute suffix of object files

stimmer

#26
Feb 05, 2011, 04:27 am Last Edit: Feb 05, 2011, 04:34 am by stimmer Reason: 1
When I force-installed binutils I also had to tell it to ignore dependencies.

I can't understand why yours won't compile when mine compiled fine. It could be because my install is very fresh and minimal (I only installed the barest minimum to get the IDE running). Have you tried updating your installed packages to the latest versions? The only other difference was that I was compiling as root, which you shouldn't really do (I was running in a virtual machine so was safe).

If it's any help the package it generated is here:
https://docs.google.com/uc?id=0B5O7TidPmOdzNGYxMGRiNmUtYzFjNC00NGQyLTlhNDYtYmVmODJiMDk3OTlm&export=download&hl=en
(I probably won't keep that download around for long...)
Due VGA library - http://arduino.cc/forum/index.php/topic,150517.0.html

dsh


Thanks for this (I've posted on the other thread started by Igor86 as I have the same problem)

Well I get the same compile error as Igor with the x86_64 debian patched gcc-avr  =(

Since Stimmer mentions the problem seems to be in the binutils-avr package I'm looking into whether I can patch my currently installed binutils-avr 2.21-1 rather than downgrade that and gcc-avr. BTW dsh's debian patched binutils for x86_64 compiles fine for me but I can't even force install it because of currently installed gcc-avr 4.5.2-1 dependencies... sigh.

So yeah, googling around with all the useful pointers from these threads... will post if I get anywhere with patching 2.21-1... maybe this is an upstream problem and I'm not sure how/whether to send a bug report to the relevant Arch package maintainers yet but thanks for all the help!

I'll attach the offending config.log too for the compile errors which was in src/gcc-4.3.5/build/avr/avrxmega2/libgcc/config.log (wierd problem config can't compute suffix of object files


This is the problem "Fatal error: unknown MCU: avrxmega2"

I'll look into it further when I find some time.

mkpetch

Yup, force ignore dependencies ie
Code: [Select]
pacman -Udf binutils-avr-2.20.1-1-x86_64.pkg.tar.xz let me try binutils-avr from dsh with the patches applied  :smiley-red:

It works! I've compiled and uploaded the Blink sketch without any additional global var declared and the sketch runs fine now. So I guess I don't need the patched gcc-avr for the moment. The problem is narrowed down to the binutils package it seems.

(no luck of course finding patches for binutils-avr 2.21)

igor86

Awesome!

I pacman -Udf'ed binutils-avr and the blink sketch works fine now (at least on the Uno)! So, no need for gcc-avr (Arch package works fine), we just need these binutils-avr!

Thanks heaps to everyone who spent time to look into these problems. I'll send a message to the Arch User Repository for the arduino package (the package for x86_64).

-Igor

Go Up