ld issue

So I just got my Arduino Mega, and I believe it's hooked up OK (I'm on Gentoo Linux, and it shows up in dmesg and stuff).

Anyway, whenever I try to load a sketch, I just get the message "/usr/libexec/gcc/avr/ld: use the --help option for usage information"

Is there something obvious I'm doing wrong here?

Thanks.

EDIT: My apologies, this appears to be in the wrong section. If somebody could move it to "Software," that would be great.

Weird. You might try compiling and linking something from the command line. If you set build.verbose to true in your Arduino preferences file (you can find the location in the preferences dialog), you'll see the command lines used by Arduino to build your sketch.

Also, do you know which version of avr-gcc you're using?

"avr-gcc -v" returns "gcc version 4.3.4 (Gentoo 4.3.4 p1.0, pie-10.1.5)"

I'm not seeing any calls to ld in the output with verbose turned on.

avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -mmcu=atmega1280 -DF_CPU=16000000L -I/home/ghost/arduino/arduino-0017/hardware/cores/arduino /home/ghost/arduino/arduino-0017/hardware/cores/arduino/wiring_analog.c -o/tmp/build2395569282292272587.tmp/wiring_analog.c.o 
avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -mmcu=atmega1280 -DF_CPU=16000000L -I/home/ghost/arduino/arduino-0017/hardware/cores/arduino /home/ghost/arduino/arduino-0017/hardware/cores/arduino/WInterrupts.c -o/tmp/build2395569282292272587.tmp/WInterrupts.c.o 
avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -mmcu=atmega1280 -DF_CPU=16000000L -I/home/ghost/arduino/arduino-0017/hardware/cores/arduino /home/ghost/arduino/arduino-0017/hardware/cores/arduino/wiring.c -o/tmp/build2395569282292272587.tmp/wiring.c.o 
avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -mmcu=atmega1280 -DF_CPU=16000000L -I/home/ghost/arduino/arduino-0017/hardware/cores/arduino /home/ghost/arduino/arduino-0017/hardware/cores/arduino/wiring_pulse.c -o/tmp/build2395569282292272587.tmp/wiring_pulse.c.o 
avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -mmcu=atmega1280 -DF_CPU=16000000L -I/home/ghost/arduino/arduino-0017/hardware/cores/arduino /home/ghost/arduino/arduino-0017/hardware/cores/arduino/pins_arduino.c -o/tmp/build2395569282292272587.tmp/pins_arduino.c.o 
avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -mmcu=atmega1280 -DF_CPU=16000000L -I/home/ghost/arduino/arduino-0017/hardware/cores/arduino /home/ghost/arduino/arduino-0017/hardware/cores/arduino/wiring_digital.c -o/tmp/build2395569282292272587.tmp/wiring_digital.c.o 
avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -mmcu=atmega1280 -DF_CPU=16000000L -I/home/ghost/arduino/arduino-0017/hardware/cores/arduino /home/ghost/arduino/arduino-0017/hardware/cores/arduino/wiring_shift.c -o/tmp/build2395569282292272587.tmp/wiring_shift.c.o 
avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega1280 -DF_CPU=16000000L -I/home/ghost/arduino/arduino-0017/hardware/cores/arduino /home/ghost/arduino/arduino-0017/hardware/cores/arduino/HardwareSerial.cpp -o/tmp/build2395569282292272587.tmp/HardwareSerial.cpp.o 
avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega1280 -DF_CPU=16000000L -I/home/ghost/arduino/arduino-0017/hardware/cores/arduino /home/ghost/arduino/arduino-0017/hardware/cores/arduino/WMath.cpp -o/tmp/build2395569282292272587.tmp/WMath.cpp.o 
avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega1280 -DF_CPU=16000000L -I/home/ghost/arduino/arduino-0017/hardware/cores/arduino /home/ghost/arduino/arduino-0017/hardware/cores/arduino/Print.cpp -o/tmp/build2395569282292272587.tmp/Print.cpp.o 
avr-ar rcs /tmp/build2395569282292272587.tmp/core.a /tmp/build2395569282292272587.tmp/wiring_analog.c.o 
avr-ar rcs /tmp/build2395569282292272587.tmp/core.a /tmp/build2395569282292272587.tmp/WInterrupts.c.o 
avr-ar rcs /tmp/build2395569282292272587.tmp/core.a /tmp/build2395569282292272587.tmp/wiring.c.o 
avr-ar rcs /tmp/build2395569282292272587.tmp/core.a /tmp/build2395569282292272587.tmp/wiring_pulse.c.o 
avr-ar rcs /tmp/build2395569282292272587.tmp/core.a /tmp/build2395569282292272587.tmp/pins_arduino.c.o 
avr-ar rcs /tmp/build2395569282292272587.tmp/core.a /tmp/build2395569282292272587.tmp/wiring_digital.c.o 
avr-ar rcs /tmp/build2395569282292272587.tmp/core.a /tmp/build2395569282292272587.tmp/wiring_shift.c.o 
avr-ar rcs /tmp/build2395569282292272587.tmp/core.a /tmp/build2395569282292272587.tmp/HardwareSerial.cpp.o 
avr-ar rcs /tmp/build2395569282292272587.tmp/core.a /tmp/build2395569282292272587.tmp/WMath.cpp.o 
avr-ar rcs /tmp/build2395569282292272587.tmp/core.a /tmp/build2395569282292272587.tmp/Print.cpp.o 
avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega1280 -DF_CPU=16000000L -I/home/ghost/arduino/arduino-0017/hardware/cores/arduino /tmp/build2395569282292272587.tmp/Blink.cpp -o/tmp/build2395569282292272587.tmp/Blink.cpp.o 
avr-gcc -Os -Wl,--gc-sections -mmcu=atmega1280 -o /tmp/build2395569282292272587.tmp/Blink.cpp.elf /tmp/build2395569282292272587.tmp/Blink.cpp.o /tmp/build2395569282292272587.tmp/core.a -L/tmp/build2395569282292272587.tmp -lm 

/usr/libexec/gcc/avr/ld: use the --help option for usage information

I guess I don't see how manually compiling would help right now, since the command in question doesn't seem to appear anywhere.

Sorry for taking forever to get back. I thought the one reply was still the spam that was here earlier.

Thanks.

Any ideas?

This appears to be the ld line that's throwing everything off:

/usr/libexec/gcc/avr/ld -m avr5 -Tdata 0x800200 -z now -o /tmp/build3347090075862923848.tmp/Blink.cpp.elf /usr/lib/gcc/avr/4.3.4/../../../../avr/lib/avr51/crtm1280.o -L/tmp/build3347090075862923848.tmp -L/usr/lib/gcc/avr/4.3.4/avr51 -L/usr/lib/gcc/avr/4.3.4/../../../../avr/lib/avr51 -L/usr/lib/gcc/avr/4.3.4 -L/usr/lib/gcc/avr/4.3.4/../../../../avr/lib --gc-sections /tmp/build3347090075862923848.tmp/Blink.cpp.o /tmp/build3347090075862923848.tmp/core.a -lm -lgcc -lc -lgcc

After some experimentation, it seems that the "-z now" bit is what's not working. Calling "avr-ld --help" shows no -z flag, however my system's normal ld does. I would guess I need to recompile binutils with different flags?

I finally fixed my problem. The solution I came up with was to use the unstable versions of packages (follow directions here: http://www.arduino.cc/playground/Linux/Gentoo, but omit the "-S" flag to crossdev).

The problem that arose after the fact was "missing" ldscripts. The solution is here: http://bugs.gentoo.org/show_bug.cgi?id=147155.

For those of you who don't care to read it: ln -s /usr/i686-pc-linux-gnu/avr/lib/ldscripts /usr/i686-pc-linux-gnu/avr/binutils-bin/2.20/ldscripts

Hope that helps somebody eventually.

Thanks for writing up your solution.