Forum Discussion

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

multiple definition of `_start'

Hello members of the forum... I am new working with Nios and programming applications C/C++ for that reason I please need the aid an expert who knows, wants and can help me to solve the errors of my small application of test,

The application:# include <stdio.h>

int main(void){

printf("\nThis is a test of the application CPP2...bye\n");

return 0;

}

The error:

make -k all

no emulation specific options.

nios2-elf-gcc -msys-crt0="c:/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.uClibc_1.4.0"/lib/crt0.o -r -d -L"c:/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.uClibc_1.4.0"/lib -o cpp2.bin cpp2.o /cygdrive/c/altera/kits/nios2/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.1/../../../../nios2-elf/lib/libm.a /cygdrive/c/altera/kits/nios2/bin/nios2-gnutools/H-i686-pc-cygwin/bin/../lib/gcc/nios2-elf/3.4.1/libgcc.a "c:/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.uClibc_1.4.0"/lib/libc.a

cpp2.o(.text+0x0): in function `_start&#39;:

: multiple definition of `_start&#39;

c:/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.uClibc_1.4.0/lib/crt0.o(.text+0x0): first defined here

collect2: ld returned 1 exit status

make: *** [cpp2.bin] Error 1

make: Target `all&#39; not remade because of errors.

I will thank for the aid of an expert who has knowledge about how to solve this problem.

13 Replies

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

    Thanks, I tried out your elf2flt_ld script. I didn&#39;t patch it. Now the linker is getting some undefined references....

    nios2-linux-uclibc-g++ hello.cpp -o hello -elf2flt="-s 64000"
    hello.elf2flt(.text+0xc964): In function `__uClibc_fini&#39;:
    : undefined reference to `__fini_array_start&#39;
    hello.elf2flt(.text+0xc968): In function `__uClibc_fini&#39;:
    : undefined reference to `__fini_array_start&#39;
    hello.elf2flt(.text+0xc96c): In function `__uClibc_fini&#39;:
    : undefined reference to `__fini_array_end&#39;

    I didn&#39;t try to execute it, &#39;cos it would probably crash anyway.

    Any thoughts?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    There are two versions of uClibc that we are talking about.

    20060207 or 20060208, the older one, use the elf2flt.ld from elf2flt_ld.zip.

    20060214 or later, the newer one with fini_array, use the patches which I post to busybox.

    But both will crash on libstdc++. I made the patches from normal elf ldscript. Maybe you can try to trace it out.