Skip to content

Compilation (linking?) fails in 1.5.6r2, but ok in 1.5.4 #1901

Closed
@Mbat

Description

@Mbat

I hope this is the correct way of posting an issue found.., I've also posted it in the troubleshooting section of the forum just in case;

I just made the move from 1.5.4 (nightly build, not sure precisely which night) to 1.5.6r2 (not nightly).
My process went as follows;
in 1.5.4, compile and load the code (Mega 2560 target)- OK
download 1.5.6r2 from the arduino site - OK
rename download to Arduino156r2 and move to Applications folder - OK (so as to not overwrite the old arduino image just in case)
open 156r2 and load sketch - OK
Select target board (2560) -OK
build - FAIL, see error below;

Arduino: 1.5.6-r2 (Mac OS X), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

Build options changed, rebuilding all
/Applications/Arduino 156r2.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr6/crtm2560.o: In function `__vector_default':
(.vectors+0xa8): relocation truncated to fit: R_AVR_13_PCREL against symbol`__vector_42' defined in .text section in /Applications/Arduino 156r2.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr6/crtm2560.o

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.

Then I moved back to 1.5.4; and re loaded the sketch, and it still compiles fine.

Other sketches compile fine in both 154 and 156r2.

Any help or suggestions would be appreciated;

MB

Activity

cmaglie

cmaglie commented on Feb 27, 2014

@cmaglie
Member

This is a bug in the gcc compiler. It's a very rare bug and is triggered when a very specific amount of global variable is allocated. We are in the path to upgrade the gcc compiler in a future 1.5.x release, this should definitely solve this issue.

A quick workaround you may try (that worked for me the last time I've got this error) is to add a global variable at the beginning of your sketch even if you don't use it.

Mbat

Mbat commented on Feb 27, 2014

@Mbat
Author

Ok, thanks. I've tried adding a global (int, long, or double) to the top of my sketch and it hasn't made a difference, is there a particular size to avoid?

cmaglie

cmaglie commented on Feb 27, 2014

@cmaglie
Member

Oh well, maybe it wasn't adding a global variable to the beginning, I vaguely remember the solution, so my previous suggestion is probably wrong. A better explanation of the problem is here:

http://stackoverflow.com/questions/8188849/avr-linker-error-relocation-truncated-to-fit

The one that best fit my understanding of the problem is this one:
http://stackoverflow.com/a/18062480

Mbat

Mbat commented on Feb 27, 2014

@Mbat
Author

Thanks for that.. the problem makes sense for me, but the padding solution doesn't seem to work for me for some reason - i tried about 50 different sizes and alignments but nothing worked. I guess i'll live with it until a future release and go back to 1.5.4 for the moment.

Thanks for your help.

matthijskooijman

matthijskooijman commented on Feb 27, 2014

@matthijskooijman
Collaborator

@Mbat, perhaps you could try the nightly version with updated toolchain to confirm that is indeed fixed for you? This build is essentially the ide-1.5.x branch with an updated toolchain, so it's pretty close to the 1.5.6 release.

See: https://groups.google.com/a/arduino.cc/forum/#!topic/developers/21G5w2HbUOg

Mbat

Mbat commented on Feb 27, 2014

@Mbat
Author

OK, will try it...

Mbat

Mbat commented on Feb 27, 2014

@Mbat
Author

I cant seem to get the nightly to run. The mac complains it is "damaged" and only lets me move it to trash. I assume this is a signing issue, and that's apples way of telling me it is incorrectly signed. I don't have a windows machine handy today sorry.

ffissore

ffissore commented on Feb 27, 2014

@ffissore
Contributor

Uhm I see two possible problems: upload failed silently (we had this issue a couple of times with that cloud hosting) or signing. For the record, nightly builds are NOT signed and never will be. Signing obliges us to use the target OSs and we don't have macosx or windows servers: we build on linux the three versions.
You could try enabling the "uncertified developer" thing. In the meanwhile we'll upload a new nightly version.

Mbat

Mbat commented on Feb 27, 2014

@Mbat
Author

Well, the size is about right when it downloads... but I've tried the uncertified developer work around (opening it by right clicking and doing an open from the menu) and that still thinks it's "damaged"

I'm not sure what's going wrong...

BTW; I downloaded it a few times just in case it really got damaged.

Mbat

Mbat commented on Feb 28, 2014

@Mbat
Author

Tried again this morning, to get the latest Nightly, and that is "damaged" (according to OSX) too.
anybody else having this problem or is it just me?

Mbat

Mbat commented on Feb 28, 2014

@Mbat
Author

UPDATE: this is now happening in 1.5.4nightly as well, I assume I've gone past some size limit somewhere. So, any suggestions of workarounds very gratefully received, as my business is stuck until I can compile again or try the new nightly.

ffissore

ffissore commented on Mar 1, 2014

@ffissore
Contributor

macosx nightly has just been restored. can you try again?

Mbat

Mbat commented on Mar 1, 2014

@Mbat
Author

Just tried, and I still get the "Arduino is damaged" message no matter how I access the package. However I can "show package contents" on it without error. I'm not ruling out that this may be me or my mac, and not the binary... (but other app packages do download and run OK)

28 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: ToolchainThe tools used for compilation and uploading to Arduino boardsType: Bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @matthijskooijman@cmaglie@ffissore@Mbat

        Issue actions

          Compilation (linking?) fails in 1.5.6r2, but ok in 1.5.4 · Issue #1901 · arduino/Arduino