[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

why is the symbol __errno not resolving from libm.a ?

I am trying to build a version of the gpsd GPS daemon program for the etrax 

I am getting this linker error when i try to link the code. The makefile 
first builds a library called "libgspd.a",
and then when it comes time to link to the main program, gpsd, something
in the math library gives this weird error about not finding "__errno".

Can anyone tell me what might be causing this? Is something wrong with ar 
in the cris tools?
Is there some other library I should be putting in the path for statically 

I fixed this temporarily by defining a variable "__errno" in one of the files

i.e.,  "int __errno;"

in one of my files, but that is obviously a hack ...

My makefile is included at the end of this message.

[hqm@localhost ugpsd]$ make
ar -r libgpsd.a netlib.o nmea_parse.o serial.o tm.o em.o
ranlib libgpsd.a
gcc_cris -mlinux -DCRISMMU -muclibc=/home/hqm/axis/axis/devboard_lx/eroot 
-s -static gpsd.o libgpsd.a  -o gpsd -L. -lgpsd  -lm
/home/hqm/axis/axis/devboard_lx/eroot/lib/libm.a(w_fmod.o): In function `fmod':
undefined reference to `__errno'
undefined reference to `__errno'
collect2: ld returned 1 exit status
make: *** [gpsd] Error 1
[hqm@localhost ugpsd]$

include $(APPS)/Rules.elinux

DEST	      = $(prefix)/bin

PROGS	      = gpsd

SRCS	      = gpsd.c

OBJS	      = gpsd.o

all:	$(PROGS)

LIB_OBJECTS = netlib.o nmea_parse.o serial.o tm.o em.o

libgpsd.a: $(LIB_OBJECTS)
	ar -r libgpsd.a $(LIB_OBJECTS)
	ranlib libgpsd.a

#CFLAGS += -g -Wall
$(PROGS): $(OBJS) libgpsd.a
	$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@xxxxxxx. -lgpsd  -lm

install:	$(PROGS)
	@echo Installing $(PROGS) in $(DEST)
	$(INSTALL) -d $(DEST)
	$(INSTALL) -m 0755 $(PROGS) $(SCRIPTS) $(DEST)

	rm -f $(PROGS) *.o core

clobber:	clean
	rm -f tags

	@echo $(HDRS) $(SRCS)

	@ctags -wx $(HDRS) $(SRCS)

tags:	$(HDRS) $(SRCS)
	@ctags $(HDRS) $(SRCS)

	makedepend -Y -- $(CFLAGS) -- $(SRCS) 2>/dev/null

# -------------------------------------------------------------------------
# The following is used to automatically generate dependencies.