[solved] Cannot compile for Mega2560 on Gentoo

Hi!

I've got troubles with my Mega2560 on Gentoo.

First I got several "attempt to use poisoned "SIG_USART1_RECV" messages - downgrading avr-libc from 1.8.0 to 1.7.1 helped.

Then it did not find crtm2561.o libc.a and libm.a - fixed this with:

cd /usr/avr/lib
ln -s avr6/crtm2561.o .
ln -sf avr6/libc.a .
ln -sf avr6/libm.a .

But now I'm stuck with:

/usr/libexec/gcc/avr/ld: skipping incompatible /usr/lib/gcc/avr/4.5.3/libgcc.a when searching for -lgcc
/usr/libexec/gcc/avr/ld: cannot find -lgcc
collect2: ld returned 1 exit status

But this is the onyl avr-libgcc I've got. Has somebody any idea what's going on there?

Got it!

Apply the second patch from 378387 – sys-devel/crossdev - avr multilib support to crossdev and run "crossdev avr".

Then both of my Arduinos - Uno and Mega - work without any symlinks in /usr/avr/lib.

The proposed solution does not work at all. Yes, the sketches compiles without errors, the upload is also done without problems, but when I tried the Examples AnalogReadSerial, DigitalReadSerial, BareMinimum and ASCIITable it wouldn't work.

Does anyone have an idea how to solve this problem? My Linux is Gentoo amd64.
I tried the proposed solution with the Uno, Mega2560 and with the Mega1280.

Do you mean there is no serial monitor output?

Did you try the Blink example? Does the led blink?

To get Serial communication on Mega2560 working:

apply the crossdev-patch from above, then run:

USE="-openmp" crossdev --target avr --gcc 4.6.2 --binutils 2.21.1 --libc 1.7.1 -s4 --without-headers

And make sure the gcc-4.6.2 is used (with gcc-config -l)

Here is a thread covering your poisoned "SIG_USART1_RECV" messages.
http://arduino.cc/forum/index.php/topic,92364.0.html

That is a deprecated format in avr-libc 1.8.0.

Excuse my ignorance of Gentoo, but do they have this Arduino/AVR code in their repository? If they do, maybe you should contact them about getting that fixed.

Yes, it works with the gcc-4.62.
Thanks guys, you are the greatest.
I never tried it with the gcc-4.6.2, but what matters is that works.
But, I still do not have the Serial working with Uno and Mega2560.
I upload the sketch but I never see anything in Serial monitor. The Blink example work fine.
With Mega1280 and Duemilanove everything works now including the Serial communication.

hdias:
But, I still do not have the Serial working with Uno and Mega2560.

Is your problem that you don't see the /dev/ttyACM0 in the arduino IDE?

I read somewhere in Gentoo forums or bugs, that the arduino-1.0 from portage has this problem for some people - So I decided to keep the old, "blue arduino" from the overlay for now.
But I can't find this thread again, sorry.

Now everything works, including the Serial with Uno and Mega2560.

My Gentoo is multilib

I check the /etc/make.conf file:

USE="multilib unicode gtk ..."

First I cleaned all packages:

emerge -C sys-devel/crossdev cross-avr/gcc cross-avr/binutils cross-avr/avr-libc

Then I added these entries in /etc/portage/package.unmask file.

=cross-avr/binutils-2.21.1-r1
=cross-avr/avr-libc-1.7.1
=cross-avr/gcc-4.6.2

and this entry in /etc/portage/package.keywords file

=sys-devel/crossdev-20111221 ~amd64

I checked the versions of packages:

emerge -vp cross-avr/gcc cross-avr/binutils cross-avr/avr-libc

Then I have installed the crossdev package:

emerge sys-devel/crossdev

I applied the proposed patch from: https://378387.bugs.gentoo.org/attachment.cgi?id=285901

cp /usr/bin/crossdev /usr/bin/crossdev.bak
nano -w /usr/bin/crossdev

Then I run this line:

USE="-openmp" crossdev --target avr --gcc 4.6.2 --binutils 2.21.1 --libc 1.7.1 -s4 --without-headers

Finally I checked the version of the avr-gcc:

avr-gcc --v

Thank you for everything :-))))

Hi Gentoo-Mega2560 users!

Actually (2013-03-16) following combination seems to work fine:
sys-devel/crossdev-20120721 (patched with patch from bug report 378387), cross-avr/gcc-4.6.3, avr-libc-1.8.0, cross-avr/binutils-2.21.1, (normally using cross-avr/binutils-2.22-r1 --> but segmentation fault occurred for Mega 2560)

Following code force the using of other binutils package than latest stable:

USE="-openmp" crossdev -t avr --binutils 2.21.1 -s4 -S --without-headers

Furthermore the symbolic link is still necessary:

ln -s /usr/x86_64-pc-linux-gnu/avr/lib/ldscripts /usr/avr/lib/ldscripts

Also the patch of Arduino.h is necessary like described above, add at line 3:
#define AVR_LIBC_DEPRECATED_ENABLE 1

Good luck, Thomas