Pages: [1]   Go Down
Author Topic: [solved] Cannot compile for Mega2560 on Gentoo  (Read 3779 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
Code:
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:
Code:
/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?
« Last Edit: February 25, 2012, 07:07:28 am by robelix » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Got it!

Apply the second patch from https://bugs.gentoo.org/show_bug.cgi?id=378387 to crossdev and run "crossdev avr".

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

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 148
Posts: 6103
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you mean there is no serial monitor output?

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

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

To get Serial communication on Mega2560 working:

apply the crossdev-patch from above, then run:
Code:
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)
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 148
Posts: 6103
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
Code:
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.
Code:
=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
Code:
=sys-devel/crossdev-20111221 ~amd64
I checked the versions of packages:
Code:
emerge -vp cross-avr/gcc cross-avr/binutils cross-avr/avr-libc
Then I have installed the crossdev package:
Code:
emerge sys-devel/crossdev
I applied the proposed patch from: https://378387.bugs.gentoo.org/attachment.cgi?id=285901
Code:
cp /usr/bin/crossdev /usr/bin/crossdev.bak
nano -w /usr/bin/crossdev
Then I run this line:
Code:
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:
Code:
avr-gcc --v

Thank you for everything :-))))
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 35
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
Code:
USE="-openmp" crossdev -t avr --binutils 2.21.1 -s4 -S --without-headers

Furthermore the symbolic link is still necessary:
Code:
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
Logged

Pages: [1]   Go Up
Jump to: