Page 1 of 1

Testing Libraries... failing linking...

Posted: Wed Jun 13, 2007 5:13 pm
by astrocrep
I have built the libk library from vm8086MM on http://my.execpc.com/~geezer/os/index.htm

The library built fine, however, when I try to link against it I get errors such as:

Code: Select all

main.c:(.text+0x23): undefined reference to `_do_printf'
my make file is:

Code: Select all

CC=gcc
CFLAGS=-Wall -O -W -02 -fstrength-reduce -fomit-frame-pointer -fleading-underscore -fno-stack-protector -finline-functions -nostdinc -fno-builtin -I./include -c -o
LD=ld
LDFLAGS=-nostdlib -Tlink.ld -o
ASM=nasm
ASMFLAGS=-f elf -o
SOURCES=start.asm main.c conio.c
OBJS=start.o main.o conio.o
EXECUTABLE=cnex.sys
LIBS	=lib/libk.a

all: $(EXECUTABLE) install clean

$(EXECUTABLE) : $(OBJS)
	$(LD) $(LDFLAGS) $(EXECUTABLE) $(OBJS) $(LIBS)
start.o : start.asm
	$(ASM) $(ASMFLAGS) start.o start.asm
main.o : main.c
	$(CC) $(CFLAGS) main.o main.c
conio.o : conio.c 
	$(CC) $(CFLAGS) conio.o conio.c
clean  :
	rm -rf *.o
install :
	mdel a:cnex.sys 
	mcopy cnex.sys a:

and everything builds fine, just cannot link to the lib :(

Dunno why, anyone got any knowledge in this?

Thanks,
Rich

Posted: Fri Jun 15, 2007 6:01 am
by astrocrep
Ive tried about 40 different things, still cannot get it to link. I removed the Assembler chunks incase that was the issue, I also did an nm on the .a file and saw all of the functions.

Would anyone be interested and playing around with a source ball and seeing if they have any better luck???

Thanks in advance,
Rich

Posted: Fri Jun 15, 2007 2:37 pm
by t0xic
Hey,

Did you mean -fnoleading-underscore? instead of:

Code: Select all

CFLAGS=-Wall -O -W -02 -fstrength-reduce -fomit-frame-pointer -fleading-underscore -fno-stack-protector -finline-functions -nostdinc -fno-builtin -I./include -c -o 
--t0xic

Posted: Fri Jun 15, 2007 5:29 pm
by astrocrep
Yeah I just realized that about 1 hours ago... after agonizing for 2 flippiing days... I am a total tart.

Thanks though, cause you were 100% correct.

-Rich