Menu

Anyone having trouble with avr-gcc linker?

Henry
2011-08-05
2012-07-07
  • Henry

    Henry - 2011-08-05

    I've just downloaded the AVR plugin for Eclipse and am having a problem with
    the command that is being composed at the linker stage. FWIW - I'm using
    Helios, Ubuntu 11, and avr-gcc 4.3.5. avr-gcc linker seems to be upset with
    the command syntax for specifying libraries and doesn't appear to want the -l
    specified (that's dash lowercase ell). I'm trying to add a reference to the
    core.a file that I snagged from an arduino sketch and copied into my eclipse
    project as libArduinoCoreUno.a. Here is the linker command that the AVR plugin
    is trying to run and the results:

    avr-gcc -Wl,-Map,ProtoShieldTest.map -L"/home/henryberg/workspace-
    helios/ProtoShieldTest" -mmcu=atmega328p -o"ProtoShieldTest.elf" ./main.o
    -llibArduinoCoreUno.a

    /usr/lib/gcc/avr/4.3.5/../../../avr/bin/ld: cannot find -llibArduinoCoreUno.a

    If I replace the -l with the full path to the library file, I'm able to run
    the command successfully on the command line which makes me wonder if the -l
    option has been removed from avr-gcc

    This command works:

    avr-gcc -Wl,-Map,ProtoShieldTest.map -L"/home/henryberg/workspace-helios/ProtoShieldTest" -mmcu=atmega328p -o"ProtoShieldTest.elf"  ./main.o   /home/henryberg/workspace-helios/ProtoShieldTest/libArduinoCoreUno.a
    
     
  • Thomas Holland

    Thomas Holland - 2011-08-05

    Hi,

    in the build settings for the "AVR C++ Linker" you need to add your
    libArduinoCoreUno.a without the 'lib' at the beginning and without the '.a' at
    the end, just 'ArduinoCoreUno'.

    Both the 'lib' prefix and the '.a' suffix are automatically added by the
    linker.

    I just tested it and it works without problems (see screenshot below)

    Cheers,

    Thomas

     
  • Henry

    Henry - 2011-08-05

    Yes indeed, that got rid of the error, thanks!

     

Log in to post a comment.