Mac OS compile error: Symbol not found: _environ

Arduino: 1.6.13 Hourly Build 2016/11/11 10:12 (Mac OS X), Board: "Arduino/Genuino Uno"

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

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 read through troubleshooting guide, and updated FTDI chip driver. I keep getting collect2 error. Mac OS X Lion 10.7.5.

Thank you

Enable verbose compile output in settings, try a compile, and post the full text of the error here. I have never seen that error before.

Please enclose it in code tags using the </> button so it's easier for people to read (per how to use this forum thread - see that for more info if needed)

Does the error occur with 1.6.12? I see that you're using an hourly build - if you want the IDE to work, you should use a released version, not the hourly builds. The hourly builds are frequently busted.

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

[code]
/Users/alexlyon/Desktop/Arduino.app/Contents/Java/arduino-builder -dump-prefs -logger=machine -hardware /Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware -tools /Users/alexlyon/Desktop/Arduino.app/Contents/Java/tools-builder -tools /Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr -built-in-libraries /Users/alexlyon/Desktop/Arduino.app/Contents/Java/libraries -libraries /Users/alexlyon/Documents/Arduino/libraries -fqbn=arduino:avr:uno -vid-pid=0X2341_0X0043 -ide-version=10612 -build-path /var/folders/mw/4yn08lt15q19qvq5b8txy71m0000gn/T/arduino_build_526103 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr -prefs=runtime.tools.avr-gcc.path=/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr -verbose /Applications/Arduino 2.app/Contents/Java/examples/01.Basics/Blink/Blink.ino

Detecting libraries used...
"/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10612 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino" "-I/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard" "/var/folders/mw/4yn08lt15q19qvq5b8txy71m0000gn/T/arduino_build_526103/sketch/Blink.ino.cpp" -o "/dev/null"
Generating function prototypes...
"/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10612 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino" "-I/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard" "/var/folders/mw/4yn08lt15q19qvq5b8txy71m0000gn/T/arduino_build_526103/sketch/Blink.ino.cpp" -o "/var/folders/mw/4yn08lt15q19qvq5b8txy71m0000gn/T/arduino_build_526103/preproc/ctags_target_for_gcc_minus_e.cpp"
"/Users/alexlyon/Desktop/Arduino.app/Contents/Java/tools-builder/ctags/5.8-arduino10/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "/var/folders/mw/4yn08lt15q19qvq5b8txy71m0000gn/T/arduino_build_526103/preproc/ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10612 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino" "-I/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard" "/var/folders/mw/4yn08lt15q19qvq5b8txy71m0000gn/T/arduino_build_526103/sketch/Blink.ino.cpp" -o "/var/folders/mw/4yn08lt15q19qvq5b8txy71m0000gn/T/arduino_build_526103/sketch/Blink.ino.cpp.o"
Compiling libraries...
Compiling core...
"/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-gcc" -c -g -x assembler-with-cpp -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10612 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-I/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino" "-I/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard" "/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/wiring_pulse.S" -o "/var/folders/mw/4yn08lt15q19qvq5b8txy71m0000gn/T/arduino_build_526103/core/wiring_pulse.S.o"
"/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-gcc" -c -g -Os -w 


"/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-gcc-ar" rcs  "/var/folders/mw/4yn08lt15q19qvq5b8txy71m0000gn/T/arduino_build_526103/core/core.a" "/var/folders/mw/4yn08lt15q19qvq5b8txy71m0000gn/T/arduino_build_526103/core/WInterrupts.c.o"
/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ar: dlopen(/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/../libexec/gcc/avr/4.9.2/liblto_plugin.so, 2): Symbol not found: _environ
  Referenced from: /Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/../libexec/gcc/avr/4.9.2/liblto_plugin.so
  Expected in: /usr/lib/libSystem.B.dylib


/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ar: /var/folders/mw/4yn08lt15q19qvq5b8txy71m0000gn/T/arduino_build_526103/core/WInterrupts.c.o: plugin needed to handle lto object
"/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-gcc-ar" rcs  "/var/folders/mw/4yn08lt15q19qvq5b8txy71m0000gn/T/arduino_build_526103/core/core.a" "/var/folders/mw/4yn08lt15q19qvq5b8txy71m0000gn/T/arduino_build_526103/core/hooks.c.o"
/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ar: dlopen(/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/../libexec/gcc/avr/4.9.2/liblto_plugin.so, 2): Symbol not found: _environ
  Referenced from: /Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/../libexec/gcc/avr/4.9.2/liblto_plugin.so
"/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-gcc-ar" rcs  "/var/folders/mw/4yn08lt15q19qvq5b8txy71m0000gn/T/arduino_build_526103/core/core.a" "/var/folders/mw/4yn08lt15q19qvq5b8txy71m0000gn/T/arduino_build_526103/core/wiring.c.o"  Expected in: /usr/lib/libSystem.B.dylib



/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ar: WInterrupts.c.o: plugin needed to handle lto object
/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ar: /var/folders/mw/4yn08lt15q19qvq5b8txy71m0000gn/T/arduino_build_526103/core/hooks.c.o: plugin needed to handle lto object
/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ar: dlopen(/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/../libexec/gcc/avr/4.9.2/liblto_plugin.so, 2): Symbol not found: _environ
  Referenced from: /Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/../libexec/gcc/avr/4.9.2/liblto_plugin.so
  Expected in: /usr/lib/libSystem.B.dylib


/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ar: WInterrupts.c.o: plugin needed to handle lto object
/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ar: hooks.c.o: plugin needed to handle lto object
/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ar: /var/folders/mw/4yn08lt15q19qvq5b8txy71m0000gn/T/arduino_build_526103/core/wiring.c.o: plugin needed to handle lto object
"/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-gcc-ar" rcs  "/var/folders/mw/4yn08lt15q19qvq5b8txy71m0000gn/T/arduino_build_526103/core/core.a" "/var/folders/mw/4yn08lt15q19qvq5b8txy71m0000gn/T/arduino_build_526103/core/wiring_analog.c.o"
/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ar: dlopen(/Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/../libexec/gcc/avr/4.9.2/liblto_plugin.so, 2): Symbol not found: _environ
  Referenced from: /Users/alexlyon/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/../libexec/gcc/avr/4.9.2/liblto_plugin.so
  Expected in: /usr/lib/libSystem.B.dylib

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

Reply: yes error is still present with 1.6.12. I also enabled verbose as requested. Hope I have included all that is required.

Thank you

Weird - the compiler's choking as it tries to load the lto plugin, complaining of missing symbol.

I would suggest editing title of thread to something like:

Mac OS compile error: Symbol not found: _environ

The issue has a distinct and unusual error message, and it has nothing to do with uploading - that's the compiler barfing. People generally aren't inclined to help someone with a generic "it won't upload" thread - 9 times out of ten, you click it and they've got a sync error and no clue (because it's their first arduino) - trying to help people with that is rarely a rewarding experience. But your error is a weird one, certainly more interesting - and probably something that has a single solution that we can give the next guy.

Tks advice implemented.

Have the same issue with this version on MacOS 10.7.5.
So i downloaded an older version of Arduino IDE 10.6.3 which runs okay.

Same issue error: OSX, 1.8.0 IDE, AAVR 1.6.16, compiling the default void/void sketch

I have the exact same issue..

I'm on 10.7.5 and need to compile 'Marlin' reprap code.

Marlin requires Arduino IDE >=1.6.8, however 1.6.8+ doesn't compile on Lion.
It has the error identified above.

Has anyone found any solutions to this issue yet?
Thanks.
Paul.

Having the same issue Mac OS X 10.7.5 with unoR3. Did anyone find a solution for this problem?

I found an answer:

pert:
You should be able to fix this by:

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