Forum Discussion

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

make erro when port app

hi all:

I make a app.I got some erro information.

/home/alex/buildroot/build_nios2/staging_dir/bin-ccache/../lib/gcc/nios2-linux-uclibc/3.4.5/../../../../nios2-linux-uclibc/bin/ld.real: warning: cannot find entry symbol _start; defaulting to 00000000

webs.elf2flt(.text+0x30): In function `main':

/home/alex/gahwebserver/ws031202/LINUX/main.c:76: undefined reference to `signal'

webs.elf2flt(.text+0xec): In function `initWebs':

/home/alex/gahwebserver/ws031202/LINUX/main.c:152: undefined reference to `gethostname'

webs.elf2flt(.text+0x128):/home/alex/gahwebserver/ws031202/LINUX/main.c:156: undefined reference to `gethostbyname'

webs.elf2flt(.text+0x17c):/home/alex/gahwebserver/ws031202/LINUX/main.c:160: undefined reference to `memcpy'

webs.elf2flt(.text+0x18c):/home/alex/gahwebserver/ws031202/LINUX/main.c:168: undefined reference to `getcwd'

webs.elf2flt(.text+0x19c):/home/alex/gahwebserver/ws031202/LINUX/main.c:169: undefined reference to `strrchr'

webs.elf2flt(.text+0xfe4):../asp.c:315: global pointer relative offset -146128 at address 0x00000000 out of range -32678 to 32767

+ exit 1

collect2: ld returned 1 exit status

make: *** [webs] 错误 1

[alex@localhost LINUX]$

I think maybe my makefile is worng,

CFLAGS = -DWEBS -DUEMF -DOS="LINUX" -DLINUX -Dfork=vfork -D__uClinux__ $(UMSW) $(DASW) $(SSLSW) $(IFMODSW)

OTHERS = -DB_STATS -DB_FILL -DDEBUG

DEBUG = -g -Wall

IFLAGS = -I..

LDFLAGS = $(SSLLIB) $(IFMODLIB) -nostdlib -Wl,-elf2flt="-s 16000" -Wl,-v -Wl,-d

who can help me? thanks a lot.

3 Replies

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

    Alex,

    Remove the "-nostdlib" from LDFLAGS.

    We don't need "-nostdinc" and "-nostdlib", because they are defualt to uClibc when we do builtroot.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    hi:

    The app source code have a misc.c.

    In the file define : "static int strnlen(char_t *s, unsigned int n);"

    but nios2-uclibc previous declaration it.

    nios2-linux-uclibc-gcc -c -o ../misc.o -g -Wall -DWEBS -DUEMF -DOS="LINUX" -DLINUX -Dfork=vfork -D__uClinux__ -DUSER_MANAGEMENT_SUPPORT -DDIGEST_ACCESS_SUPPORT -I.. ../misc.c

    ../misc.c:61: error: conflicting types for 'strnlen'

    /home/alex/buildroot/build_nios2/staging_dir/bin-ccache/../lib/gcc/nios2-linux-uclibc/3.4.5/../../../../nios2-linux-uclibc/sys-include/string.h:254: error: previous declaration of 'strnlen' was here

    ../misc.c:61: error: conflicting types for 'strnlen'

    /home/alex/buildroot/build_nios2/staging_dir/bin-ccache/../lib/gcc/nios2-linux-uclibc/3.4.5/../../../../nios2-linux-uclibc/sys-include/string.h:254: error: previous declaration of 'strnlen' was here

    make: *** [../misc.o] 错误 1

    [alex@localhost LINUX]$

    Then I commented the define and funcntion in misc.c

    //static int strnlen(char_t *s, unsigned int n);

    /******************************************************************************/

    /*

    * Return the length of a string limited by a given length

    */

    //static int strnlen(char_t *s, unsigned int n)

    //{

    // unsigned int len;

    // len = gstrlen(s);

    // return min(len, n);

    //}

    Then I make again. Make success.

    But I worry about I comment it is not correct.