Arduino 1.0 and Gentoo

It has been a while since I used my Arduino.
Of course when I go to use it there is a new version of the software out 1.0.
As expected it won’t work out of the box on Gentoo.
Make sure you give my existing article a read though if you have other issues.

I had to change two things.

1)

I got the following error :-


~/arduino-1.0/hardware/arduino/cores/arduino/Print.cpp: In member function ‘size_t Print::print(const __FlashStringHelper*)’:
~/arduino-1.0/hardware/arduino/cores/arduino/Print.cpp:44:9: error: ‘prog_char’ does not name a type
~/arduino-1.0/hardware/arduino/cores/arduino/Print.cpp:47:23: error: ‘p’ was not declared in this scope

It appears that Print.ccp is using depricated typedef.
avr-libc v1.8.0 and up have deprecated the “prog_char” type def and now its recommended to use of “char PROGMEM”.

So lets fix that…
Bash open the the “Print.ccp” file for me this is located at :-
~/arduino-1.0/hardware/arduino/cores/arduino/Print.cpp

On line 42 you will find the offending secion :-

size_t Print::print(const __FlashStringHelper *ifsh)
{
 const prog_char *p = (const prog_char *)ifsh;
 size_t n = 0;
 while (1) {
 unsigned char c = pgm_read_byte(p++);
 if (c == 0) break;
 n += write(c);
 }
 return n;
}

Lets replace that section with one that supports new versions of avr-libc :-

size_t Print::print(const __FlashStringHelper *ifsh)
{
 const char PROGMEM *p = (const char PROGMEM *)ifsh;
 size_t n = 0;
 while (1) {
 unsigned char c = pgm_read_byte(p++);
 if (c == 0) break;
 n += write(c);
 }
 return n;
}

2)
After that I now got the following error :-
/usr/libexec/gcc/avr/ld: cannot open linker script file ldscripts/avr5.x: No such file or directory

Hmm we’ve seen this shit before, check my existing article.
Easy fix as root create the following symlink:-
# ln -s /usr/x86_64-pc-linux-gnu/avr/lib/ldscripts /usr/avr/lib/ldscripts

Done. If your lucky it should work correctly now!

Advertisements

One Response to “Arduino 1.0 and Gentoo”

  1. THANK YOU! This article fixed my project!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: