Error compiling for board Arduino/Genuino Uno.

********************
SOLVED - This Topic took a few posts to finally fix so if you want to skip to the solution click here.
Short answer is that I have one of the “new” boards and the current board software (board manager) doesn’t work with it.
********************

Hi.
I am running Arduino 1.8.5 on a Mac
My hardware is an Arduino Uno.

I am trying to do the very first exercise “Blink” in the “Projects Book” that came with the starter kit.
Technically, “Blink” appears to already be loaded on my Arduino so following the manual I attempted to change the delay parameter from 1000 to 100 and upload it.
Every attempt to upload or even “verify” gives me an error message.

collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino/Genuino Uno.

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

I have deleted/re-downloaded and re-run the Arduino software from the Arduino site 3 times now. But it does not change anything.
I have selected the “Arduino/Genuino Uno” board type and the “/dev/cu.usbmodemfa131(Arduino/Genuino Uno)” port.

I spent an hour and a half searching this forum and doing Google searches to try and solve this before I resorted to posting here. Found few links that were closed to this but they seemed to involve PC issues or people who had written their own code and done it wrong.
I am just trying to upload a sketch supplied in the examples.

This is my first experience with Arduino.
Any help would be appreciated.
Thanks.
Gary

Hi,
Welcome to the forum.

We need to see your complete code.

Thanks… Tom… :slight_smile:

Thanks tom. I shall have to add it in multiple posts as I am getting a message that it "exceeds the maximum allowed length"

My code part 1 of ?

Arduino: 1.8.5 (Mac OS X), Board: "Arduino/Genuino Uno"

/Applications/Electronics/Arduino.app/Contents/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ar: dlopen(/Applications/Electronics/Arduino.app/Contents/Java/hardware/tools/avr/bin/../libexec/gcc/avr/4.9.2/liblto_plugin.so, 2): Symbol not found: _environ
  Referenced from: /Applications/Electronics/Arduino.app/Contents/Java/hardware/tools/avr/bin/../libexec/gcc/avr/4.9.2/liblto_plugin.so
  Expected in: /usr/lib/libSystem.B.dylib


/Applications/Electronics/Arduino.app/Contents/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ar: dlopen(/Applications/Electronics/Arduino.app/Contents/Java/hardware/tools/avr/bin/../libexec/gcc/avr/4.9.2/liblto_plugin.so, 2): Symbol not found: _environ
  Referenced from: /Applications/Electronics/Arduino.app/Contents/Java/hardware/tools/avr/bin/../libexec/gcc/avr/4.9.2/liblto_plugin.so
  Expected in: /usr/lib/libSystem.B.dylib


/Applications/Electronics/Arduino.app/Contents/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ar: core/WInterrupts.c.o: plugin needed to handle lto object
/Applications/Electronics/Arduino.app/Contents/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ar: dlopen(/Applications/Electronics/Arduino.app/Contents/Java/hardware/tools/avr/bin/../libexec/gcc/avr/4.9.2/liblto_plugin.so, 2): Symbol not found: _environ
  Referenced from: /Applications/Electronics/Arduino.app/Contents/Java/hardware/tools/avr/bin/../libexec/gcc/avr/4.9.2/liblto_plugin.so
  Expected in: /usr/lib/libSystem.B.dylib

Hi, A blink program should not be that big, just the code?

Attatch it as a ino file.

Breaking it up makes it very hard to read.

Tom... :)

Sorry ... new to this and sometimes can't see the forest for the trees. I was trying to post what I got when I used the "Copy Error Messages" button and THAT is voluminous.

Here is what I believe to be the code

/*
  Blink

  Turns an LED on for one second, then off for one second, repeatedly.

  Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
  it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
  the correct LED pin independent of which board is used.
  If you want to know what pin the on-board LED is connected to on your Arduino
  model, check the Technical Specs of your board at:
  https://www.arduino.cc/en/Main/Products

  modified 8 May 2014
  by Scott Fitzgerald
  modified 2 Sep 2016
  by Arturo Guadalupi
  modified 8 Sep 2016
  by Colby Newman

  This example code is in the public domain.

  http://www.arduino.cc/en/Tutorial/Blink
*/

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(100);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(100);                       // wait for a second
}
[code/]

Uninstall the IDE, delete the arduino15 folder and reinstall.

Arduino15 folder is located at: On Mac OS X: /Users/(username)/Library/Arduino15

On Windows: Arduino IDE 1.6.5r5 and previous: C:\Users(username)\AppData\Roaming\Arduino15 Arduino IDE 1.6.6 and later: C:\Users(username)\AppData\Local\Arduino15

On Linux: /home/(username)/.arduino15 (a.k.a. ~/.arduino15)

Hi, It compiles on IDE 1.8.5 and win7.

As @DrAzzy has suggested it looks like an IDE installation problem.

Tom.. :)

Aha !!!!

I just found this -

Accessing the User Library folder in OS X Mountain Lion and Lion

Mac OS X 10.7 Lion and OS X 10.8 Mountain Lion both hide the ~/Library directory by default, the reason likely being to prevent accidental deletion of critical files that are needed for apps to run.

All you need to do is hit Command+Shift+G from the Mac desktop (or Finder > Go > Go to Folder) and type in ~/Library to temporarily access the Library directory in the Finder. When you are done, close this window and it will no longer be visible.

Hopefully this can help other MAC users.

I will now go delete that preferences folder and see if it fixes the problem!

OK
Deleted everything including the elusive “arduino15” folder and the downloaded IDE zip file.

Re-downloaded the 1.8.5 zip file.

Un-zipped/installed the IDE.

Re-launched the Application, opened the “Blink” example and tried to upload it.

Upload failed due to the exact same error message :frowning:
++++++++++
Okay. Deleted everything again and downloaded 1.8.6 from the “hourly” downloads.
Resulted in the same compiling error.
This is no fun.

It has nothing to do with the sketch. It's related to the use of LTO in recent versions of Arduino AVR Boards. I don't know the specific cause or real solution but here's a workaround:

pert: - Tools > Board > Boards Manager > Arduino AVR Boards(click on it) > select 1.6.11 from the "select version" drop down menu > Install - Wait for the installation to complete and then click the "Close" button

As to the actual cause of the issue I don't know. The LTO stuff that's causing the issue was added in Arduino AVR Boards 1.6.12, this is why you need to go back to Arduino AVR Boards 1.6.11 to fix it.

Hi, Is there an exe installation version of the IDE for the MAC?

Tom.. :)

pert: It has nothing to do with the sketch. It's related to the use of LTO in recent versions of Arduino AVR Boards. I don't know the specific cause or real solution but here's a workaround:

YES ! VICTORY !!!!!!!! pert - you are a super genius! My day just got 100% brighter :)

Tom - if there is an "exe" version, I could not find it.

Thanks to every one who helped me through this. Now for the FUN !

I’m not sure whether you’re the workshop member mentioned or this is just a coincidence but matthijskooijman was kind enough to open an issue in the bug tracker for this “Symbol not found: _environ” problem today:
https://github.com/arduino/Arduino/issues/7074
I see it pop up on the forum from time to time with no better solution than my workaround ever found but it was never reported to the Arduino developers before now because I only report issues I can reproduce and I don’t have a Mac. Hopefully this will lead to a true solution so that you can go back to using the up to date Arduino AVR Boards version. There’s nothing specifically wrong with the older version but the newer compiler version does often reduce memory usage and the newer AVRDUDE version did solve some rare problems.

Enjoy!

So, wanting to be a "Team Player" I uploaded the 1.8.5 IDE to a MacBook Pro running OS 10.8.5 and plugged the same Arduino Uno (with the ATMEGA328P processor) into it.

I ran the IDE with the AVR Boards version 1.6.20 installed and IT WORKED!

So it would seem that AVR 1.6.20 works on OS10.8.5 but NOT on OS10.7.5

Hopefully this is useful data for someone.

Thanks! I had suspected it was something like that since there are many people using the Arduino IDE on Macs with no problems.

(deleted)

This is not a bug. It’s simply that one of the software components used by the Arduino IDE called clang has dropped support for old macOS versions. The only thing Arduino can do about it is to document the minimum required macOS version, which they have done right on the download link:

Mac OS X 10.8 Mountain Lion or newer

If you are set on being able to use the Arduino IDE with older macOS versions then you’d need to submit a patch to clang (after researching all the existing discussion on the topic), manage to get that patch accepted, wait for a new clang release, and then request Arduino to update to the new clang version.

I also have the same problem Pls help me

prathmeshshiva: I also have the same problem Pls help me

If you can't update your macOS version, then you'll need to use Arduino AVR Boards 1.6.11:

  • Tools > Board > Boards Manager
  • Wait for downloads to finish.
  • Click on "Arduino AVR Boards by Arduino".
  • From the dropdown menu, select 1.6.11.
  • Click "Install".
  • Wait for installation to finish.
  • Click "Close".

If you have File > Preferences > Check for updates on startup checked, the Arduino IDE may occasionally notify you that a new version of Arduino AVR Boards is available, you'll need to refrain from updating back to the new Arduino AVR Boards version, otherwise you'll be back to seeing the segmentation fault error again.

I tried this but nothing happen