Pages: [1] 2   Go Down
Author Topic: [SOLVED] How to get avr-gcc 4.3 on Linux?  (Read 5037 times)
0 Members and 1 Guest are viewing this topic.
Göteborg, Sweden
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!

I'm running Arch Linux 64-bit and I have avr-gcc 4.6.0 installed, which can be found in the official repository on Arch. However, apparently there is a bug in this version which makes programs on my Arduino Mega 1280 unable to send and receive signals through the USB cable. I can install programs, but they can't communicate with the computer in Serial Monitor in Arduino. (Hope you understand what I mean.)

I have read that installing 4.3.x of avr-gcc should fix this problem. But I can only find version 4.3.4 of gcc in the AUR (Arch User Repository), and not an older version of avr-gcc.

So my question is: where can I find version 4.3 of avr-gcc? And how do I install it?

// Daniel Jonsson
« Last Edit: June 19, 2011, 01:05:33 pm by MaTachi » Logged

"The old Europe"
Offline Offline
Edison Member
*
Karma: 1
Posts: 2005
Bootloaders suck!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Doesn't 4.3.4 qualify as 4.3.x ?
Logged

• Upload doesn't work? Do a loop-back test.
• There's absolutely NO excuse for not having an ISP!
• Your AVR needs a brain surgery? Use the online FUSE calculator.
My projects: RGB LED matrix, RGB LED ring, various ATtiny gadgets...
• Microsoft is not the answer. It is the question, and the answer is NO!

Göteborg, Sweden
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah. However, I can only find that version of gcc in the AUR, not avr-gcc. But maybe gcc = avr-gcc? I must say that I don't know what the difference is, but I have both gcc and avr-gcc in my /usr/bin/ folder and they are both in version 4.6.0. And when I installed gcc 4.3 from the AUR I got some extra files in this folder called gcc-4.3 and similar, but not an additional avr-gcc file.
« Last Edit: June 18, 2011, 06:19:37 pm by MaTachi » Logged

Portugal
Offline Offline
God Member
*****
Karma: 6
Posts: 962
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I suggest that you read this topic:
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=42631&postdays=0&postorder=asc

or at least its last pages.
Logged

Göteborg, Sweden
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks! That looks interesting. I will try to run the script that is described in the first post of the thread and see if I can install avr-gcc and those other programs to /usr/local/avr.

EDIT: And please tell if this is a good/bad idea, and/or if there are easier ways. The clock is 2:20 am atm, so I will wait with the installation until tomorrow.  smiley
« Last Edit: June 18, 2011, 07:21:46 pm by MaTachi » Logged

"The old Europe"
Offline Offline
Edison Member
*
Karma: 1
Posts: 2005
Bootloaders suck!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah. However, I can only find that version of gcc in the AUR, not avr-gcc.
[...]

Sorry, my bad. I thought I had read avr-gcc 4.3.4.

You can use Bingo's build script. I've used it too. It will get you avr-gcc 4.4.3 + avr-libc 1.7.1 + avr-binutils 2.20, which runs well on my system (mostly). I can't speak for the 'Arduino Mega' though. There are some issues with delay.h, which may or may not affect you. It should be mentioned in the thread on avrfreaks.net as well.

Just make sure you have a backup of your important stuff, as Bingo's script is intended to be run as root. So it may wreck havoc on your system. It worked on mine, but better be safe.
Logged

• Upload doesn't work? Do a loop-back test.
• There's absolutely NO excuse for not having an ISP!
• Your AVR needs a brain surgery? Use the online FUSE calculator.
My projects: RGB LED matrix, RGB LED ring, various ATtiny gadgets...
• Microsoft is not the answer. It is the question, and the answer is NO!

Portugal
Offline Offline
God Member
*****
Karma: 6
Posts: 962
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In the last  pages there is the most actual scripts and also .deb files and patches for the avr-gcc to correct the delay.h problems and other.
Logged

Göteborg, Sweden
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah. However, I can only find that version of gcc in the AUR, not avr-gcc.
[...]

Sorry, my bad. I thought I had read avr-gcc 4.3.4.

You can use Bingo's build script. I've used it too. It will get you avr-gcc 4.4.3 + avr-libc 1.7.1 + avr-binutils 2.20, which runs well on my system (mostly). I can't speak for the 'Arduino Mega' though. There are some issues with delay.h, which may or may not affect you. It should be mentioned in the thread on avrfreaks.net as well.

Just make sure you have a backup of your important stuff, as Bingo's script is intended to be run as root. So it may wreck havoc on your system. It worked on mine, but better be safe.

I followed the steps desribed in Bingo's first post, but I ended up with this error message on step 9:
Code:
/usr/lib/libbfd.a(plugin.o): In function `try_load_plugin':
(.text+0x3c8): undefined reference to `dlopen'
/usr/lib/libbfd.a(plugin.o): In function `try_load_plugin':
(.text+0x3eb): undefined reference to `dlsym'
/usr/lib/libbfd.a(plugin.o): In function `try_load_plugin':
(.text+0x47b): undefined reference to `dlerror'
collect2: ld returned 1 exit status
make[2]: *** [avarice] Error 1
make[2]: Leaving directory `/usr/local/avr/build/avarice-2.10/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/local/avr/build/avarice-2.10/src'
make: *** [all-recursive] Error 1
(./buildavr-no-insight.sh) avarice build failed
Do you know what may be causing this?



In the last  pages there is the most actual scripts and also .deb files and patches for the avr-gcc to correct the delay.h problems and other.
Is it really a good idea to install .deb files on Arch?



EDIT: Saw this post where someone had the same problem http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=830390&sid=65bea712f6d83d0bb8c590a657ae6fff#830390
I will see if I can get it to work now.
« Last Edit: June 19, 2011, 10:02:21 am by MaTachi » Logged

Göteborg, Sweden
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Finally, I managed to finish the installation with Bingo's script! smiley-lol

Now I have a bunch of files in /user/local/avr/, but I'm not really sure where I can find the avr-gcc file (if there is any) and how I'm supposed to make Arduino using it.
Maybe I can rename the avr-gcc file in /usr/bin/ and make a link of the one I have installed (wherever it is located)?
Please tell how you did it madworm. smiley
Logged

"The old Europe"
Offline Offline
Edison Member
*
Karma: 1
Posts: 2005
Bootloaders suck!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I added these lines to '/etc/profile.local':

Code:
PATH=$PATH:/usr/local/avr/bin
export PATH

That's all. Don't forget to restart your session. In case you have another installation of avr-gcc sitting on your machine, you may have to remove it (or at least make that folder unaccessible to the user). Otherwise you'd have to deal with the order of the search path.

With that change you can just start the avr-gcc executables in a console, auto-completion should find it. And of course the Arduino IDE as well.
« Last Edit: June 19, 2011, 10:37:13 am by madworm » Logged

• Upload doesn't work? Do a loop-back test.
• There's absolutely NO excuse for not having an ISP!
• Your AVR needs a brain surgery? Use the online FUSE calculator.
My projects: RGB LED matrix, RGB LED ring, various ATtiny gadgets...
• Microsoft is not the answer. It is the question, and the answer is NO!

Göteborg, Sweden
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for your fast answer!

I added those lines to /etc/profile.local, renamed /usr/bin/avr-gcc to /usr/bin/avr-gcc2 and restarted my computer. I suppose that avr-gcc in the terminal should generate something else than:
Code:
[17:47] daniel@arch ~ $ avr-gcc
bash: avr-gcc: command not found
So, what have I done wrong?

EDIT: I checked in the /usr/local/avr/bin/ folder and I suppose that just renaming avr-gcc isn't enough. I will try to uninstall avr-gcc completely and see what happens.
« Last Edit: June 19, 2011, 11:08:11 am by MaTachi » Logged

"The old Europe"
Offline Offline
Edison Member
*
Karma: 1
Posts: 2005
Bootloaders suck!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It seems like '/etc/profile.local' is not sourced at all, which is odd. Are the permissions correct ? (rw-r--r-- root root)

What's the output of

Code:
echo $PATH


Does '/etc/profile' contain any help-text asking you to use '/etc/profile.local' instead ?

You could add it to '/etc/profile' as well, but I guess it would get overwritten by updates.


BTW, you should get something like this:

Code:
...>avr-gcc --version

avr-gcc (GCC) 4.4.3
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Also I'm not sure it is a good idea to just rename your 'other' avr-gcc binary. You'll have to take care of ALL of it, including the library files! I had expected that avr-gcc would be installed in '/opt'. Then you could just have set the folder unreadable and be done with it. You definitely don't want a mix-up of old and new versions. Better get rid of all the unused stuff.
« Last Edit: June 19, 2011, 11:16:57 am by madworm » Logged

• Upload doesn't work? Do a loop-back test.
• There's absolutely NO excuse for not having an ISP!
• Your AVR needs a brain surgery? Use the online FUSE calculator.
My projects: RGB LED matrix, RGB LED ring, various ATtiny gadgets...
• Microsoft is not the answer. It is the question, and the answer is NO!

Göteborg, Sweden
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The permissions seem to be correct:
Code:
[19:11] daniel@arch /etc $ ls -la | grep profile.local
-rw-r--r--  1 root   root      42 Jun 19 17:39 profile.local

Here is my echo $PATH output:
Code:
[19:12] daniel@arch /etc $ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/java/bin:/opt/java/db/bin:/opt/java/jre/bin:/usr/bin/vendor_perl:/usr/bin/core_perl

And here is the content of my /etc/profile file:
Code:
# /etc/profile

#Set our umask
umask 022

# Set our default path
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"
export PATH

# Load profiles from /etc/profile.d
if test -d /etc/profile.d/; then
for profile in /etc/profile.d/*.sh; do
test -r "$profile" && . "$profile"
done
unset profile
fi

# Source global bash config
if test "$PS1" && test "$BASH" && test -r /etc/bash.bashrc; then
. /etc/bash.bashrc
fi

# Termcap is outdated, old, and crusty, kill it.
unset TERMCAP

# Man is much better than us at figuring this out
unset MANPATH

# dircolors /etc/DIR_COLORS

And yeah, I will try to uninstall avr-gcc and some related stuff.
Logged

"The old Europe"
Offline Offline
Edison Member
*
Karma: 1
Posts: 2005
Bootloaders suck!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It seems the concept of a profile.local file is not implemented there. It should work if you move your newly created file to '/etc/profile.d/' and rename it to something meaningful to you, but with the .sh ending. Like 'avr-gcc-path.sh' or something.
Logged

• Upload doesn't work? Do a loop-back test.
• There's absolutely NO excuse for not having an ISP!
• Your AVR needs a brain surgery? Use the online FUSE calculator.
My projects: RGB LED matrix, RGB LED ring, various ATtiny gadgets...
• Microsoft is not the answer. It is the question, and the answer is NO!

Göteborg, Sweden
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I have uninstalled the packages gcc-avr, avr-libc and binutils-avr now. The packages avrdude, avarice and insight wasn't installed.

EDIT: Ok, I will try that. Thanks.
Logged

Pages: [1] 2   Go Up
Jump to: