Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
21 years ago

What's wrong with the nios-elf-ld ?

When I compile my program, some error happen.

[SOPC Builder]$ make

nios-elf-ld -LC:/altera/quartus41/sopc_builder/bin/nios-gnupro/nios-elf/lib/m32

-LC:/altera/quartus41/sopc_builder/bin/nios-gnupro/lib/gcc-lib/nios-elf/2.9-nios

-010801-20020710/m32 -L../lib -L./librtos32 -e _start -u _start -g -T C:/altera/

quartus41/sopc_builder/bin/excalibur.ld main.o Tasks.o --start-group -l rtos32 -

l nios32 -l c -l m -l gcc --end-group -o main.out

nios-elf-ld: cannot find -lc

make: *** [main.out] Error 1

My makefile is writed like this:

LIBS = --start-group -l rtos32 -l nios32 -l c -l m -l gcc --end-group

GCC_OPTS = -g -m32

main.srec: main.out

nios-elf-objcopy -O srec main.out main.srec

main.out : $(OBJETS)

nios-elf-ld $(LIBPATH) $(LD_OPTS) $(OBJETS) $(LIBS) -o main.out

I don't know what's wrong and how to correct it.

Who can help me?

5 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi, Kerri

    Thank to your help.

    I think the paths in my makefile maybe wrong.

    The problem was heppend when I use Nios Development Kit 3.20 to "make",but now I use Nios 3.02 to make,there is no error. How strange it is !
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hello woody,

    I think your original problem was a missing path, rather than wrong one. The linker could not find "libc.a" because there was no path specified for it; there should have been a "-LC:/altera/quartus41/sopc_builder/bin/nios-gnupro/nios-elf/lib/m32" (or whatever is required to point to the appropriate libc.a, libg.a and libm.a) in your LIBPATH definition. It may be that v3.02 had this in the linker script (excalibur.ld) - it would look something like:

    SEARCH_DIR("/cygdrive/c/altera/quartus41/sopc_builder/bin/nios-gnupro/nios-elf/lib/m32");

    Steve.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by steve360@Aug 13 2004, 10:13 AM

    there should have been a "-lc:/altera/quartus41/sopc_builder/bin/nios-gnupro/nios-elf/lib/m32" (or whatever is required to point to the appropriate libc.a, libg.a and libm.a)

    --- Quote End ---

    This option did in fact appear in the command-line that woody gave in his post. Woody, is this the correct path? If you look in this directory is there a libc.a there? In my installation the files are at c:\altera\kits\nios\bin\nios-gnupro\nios-elf\lib\m32\.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    <div class='quotetop'>QUOTE </div>

    --- Quote Start ---

    This option did in fact appear in the command-line that woody gave in his post.[/b]

    --- Quote End ---

    Oops! Sorry.

    Then both paths are probably wrong. There are two paths that need specifying, one to libgcc.a and the other to libc.a, libg.a and libm.a