| Author |
Message |
|
|
Posted: Jul 09, 2007 - 11:41 AM |
|

Joined: Jul 09, 2007
Posts: 2
Location: Budapest, Hungary
|
|
Hi,
I'm sort of new to AVR compiling in General. I'm using an Arduino board, which has an ATMega8 chip on it. I'm not using their IDE, but Makefiles to compile and upload code to the board.
When I create an environment, I have to symlink the ldscripts directory from binutils into the working directory (where the source files are):
Code:
ln -s /usr/lib/binutils/avr/2.16.1/ldscripts
If I don't do this, the cross-compiler linker, /usr/libexec/gcc/avr/ld, will fail to create the elf binary:
Code:
avr-gcc -mmcu=atmega8 -I. -gstabs -DF_CPU=16000000 -I../../usr/arduino -Os -Wall -Wstrict-prototypes -std=gnu99 ../../usr/arduino/pins_arduino.o ../../usr/arduino/wiring.o ../../usr/arduino/WInterrupts.o blink.o ../../usr/arduino/HardwareSerial.o ../../usr/arduino/WRandom.o --output blink.elf
/usr/libexec/gcc/avr/ld: cannot open linker script file ldscripts/avr4.x: No such file or directory
make: *** [blink.elf] Error 1
This is even though there are no direct references to the ldscripts directory from the Makefile or any of the source files.
Is there a possibility to build somehow so that one does not need to symlink the ldscripts directory? |
|
|
| |
|
|
|
|
|
Posted: Jul 09, 2007 - 11:48 AM |
|


Joined: Jul 18, 2005
Posts: 62312
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
Not sure how this relates to a Linux installation but in the WinAVR package the ldscripts are in \winavr\avr\lib\ldscripts - not sure if this helps you locate them in your installation. But if you just use "find -name=avr4.x" you should be able to find where they are lurking.
Cliff |
_________________
|
| |
|
|
|
|
|
Posted: Jul 09, 2007 - 02:17 PM |
|


Joined: Dec 20, 2002
Posts: 7277
Location: Dresden, Germany
|
|
This for sure looks like the entire toolchain wasn't configured
with the same --prefix option. Normally, the compiler should tell
the linker the exact location of these scripts.
You can verify the command-line the compiler driver is using when
calling the linker by adding a -v to the options. |
_________________ Jörg Wunsch
Please don't send me PMs, use email if you want to approach me personally.
Please read the `General information...' article before.
|
| |
|
|
|
|
|
Posted: Jul 10, 2007 - 05:06 PM |
|

Joined: Jul 09, 2007
Posts: 2
Location: Budapest, Hungary
|
|
I've installed avr-gcc by using crossdev on gentoo. the output with -v says:
Code:
$ avr-gcc -v
Reading specs from /usr/lib/gcc/avr/3.4.6/specs
Configured with: /var/tmp/portage/cross-avr/gcc-3.4.6/work/gcc-3.4.6/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/avr/gcc-bin/3.4.6 --includedir=/usr/lib/gcc/avr/3.4.6/include --datadir=/usr/share/gcc-data/avr/3.4.6 --mandir=/usr/share/gcc-data/avr/3.4.6/man --infodir=/usr/share/gcc-data/avr/3.4.6/info --with-gxx-include-dir=/usr/lib/gcc/avr/3.4.6/include/g++-v3 --host=x86_64-pc-linux-gnu --target=avr --build=x86_64-pc-linux-gnu --disable-altivec --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --disable-libunwind-exceptions --disable-libgcj --enable-languages=c,c++ --enable-shared --disable-threads
Thread model: single
gcc version 3.4.6 (Gentoo 3.4.6, ssp-3.4.5-1.0, pie-8.7.9)
whereas ldscripts is under /usr/lib/binutils/avr/2.16.1/ldscripts
does this installation seem wrong? |
|
|
| |
|
|
|
|
|
Posted: Jul 10, 2007 - 05:17 PM |
|


Joined: Dec 20, 2002
Posts: 7277
Location: Dresden, Germany
|
|
Sorry, I meant you add the -v option to the avr-gcc command-line you use
when linking your job. |
_________________ Jörg Wunsch
Please don't send me PMs, use email if you want to approach me personally.
Please read the `General information...' article before.
|
| |
|
|
|
|
|
Posted: Jul 11, 2007 - 08:29 PM |
|


Joined: Mar 01, 2001
Posts: 4953
Location: Rocky Mountains
|
|
|
darkeye wrote:
I've installed avr-gcc by using crossdev on gentoo.
There has to be something wrong with crossdev on gentoo. I have a colleague who has this issue, and there was another recent post on the avr-gcc-list about crossdev with the same problem.
My advice is to build the toolchain yourself and avoid crossdev until somebody fixes it. |
|
|
| |
|
|
|
|
|
Posted: Apr 14, 2009 - 05:20 AM |
|

Joined: Apr 14, 2009
Posts: 1
|
|
I too am new to AVR chips and installed the toolchain using crossdev on Gentoo.
To overcome the linker not finding the ldscripts you can use the -L option to give extra directories. I was surprised as I thought -L was only for directories with binary code to link against.
Code:
avr-gcc -Wl,-Map,AVREnvTest.map -L/usr/lib/binutils/avr/2.19.1/ -mmcu=atmega16 -o"AVREnvTest.elf" ./main.o
man ld for more info on -L |
|
|
| |
|
|
|
|
|
Posted: Apr 14, 2009 - 05:29 PM |
|


Joined: Apr 25, 2004
Posts: 3809
Location: Denmark
|
|
|
|
|
|
|