Click here to Skip to main content
11,412,516 members (64,729 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Embedded C Linux
Hi all,
I'm getting below error while compiling the u-boot standalone application, i have implemented the standalone app which does testing on the peripherals connected. below is the error displayed while compiling the code..Please help out

framework/diag/bit_main.o: In function `atoi':
diag/test/main.c:466: undefined reference to `strlen'
diag/test/main.c:296: undefined reference to `strtok'
diag/test/main.c:297: undefined reference to `strtok'

here is the  Makefile->
 
<pre lang="vb">include $(TOPDIR)/config.mk
 
ELF := test
#COBJS   := $(ELF:=.o)
COBJS += diag/test/main.o
COBJS += diag/test/display.o
COBJS += diag/test/menu.o
LIB    = $(obj)libbitstubs.a
 
LIBAOBJS-$(ARCH)     :=
LIBAOBJS-$(CPU)      :=
 
LIBCOBJS = stubs.o
 
LIBOBJS  = $(addprefix $(obj),$(LIBAOBJS) $(LIBCOBJS))
 
SRCS    := $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(LIBAOBJS:.o=.S)
OBJS    := $(addprefix $(obj),$(COBJS))
 
gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
 
CPPFLAGS += -I..
 
all: $(obj) $(LIB) $(ELF)
 
$(ELF): $(OBJS) $(LIB)
        $(LD) -Ttext $(STANDALONE_LOAD_ADDR) -o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $^ -L$(gcclibdir) -lgcc
#                       $(CC) -o $@ -t $(LIB) -L$(gcclibdir) -lgcc
#                       $(LD) -g -Ttext $(STANDALONE_LOAD_ADDR) \
                        -o $@ -e bit_main $< $(LIB)  \
                        -L$(gcclibdir) -lgcc
#                       $(LD) -g -Ttext $(STANDALONE_LOAD_ADDR) \
                        -o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(OBJS) \
                        -L$(gcclibdir) -lgcc
 
$(LIB):                 $(obj).depend $(LIBOBJS)
                        $(AR) $(ARFLAGS) $@ $(LIBOBJS)
 

 
#########################################################################
 
# defines $(obj).depend target
include $(SRCTREE)/rules.mk
sinclude $(obj).depend
 
#########################################################################
Posted 9-Apr-13 6:49am
Amar_C595

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Looks like you're missing a reference to glibc.
Probably a -llibc required in the Makefile somewhere but that stuff is pretty opaque to me.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 364
1 Sascha Lefévre 200
2 Maciej Los 135
3 ProgramFOX 130
4 Sergey Alexandrovich Kryukov 110
0 Sergey Alexandrovich Kryukov 9,025
1 OriginalGriff 7,247
2 Maciej Los 3,525
3 Abhinav S 3,248
4 Peter Leow 3,059


Advertise | Privacy | Mobile
Web04 | 2.8.150427.1 | Last Updated 9 Apr 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100