Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
astrocrep
Member
Posts: 127 Joined: Sat Apr 21, 2007 7:21 pm
Post
by astrocrep » Wed Jun 13, 2007 5:13 pm
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
astrocrep
Member
Posts: 127 Joined: Sat Apr 21, 2007 7:21 pm
Post
by astrocrep » Fri Jun 15, 2007 6:01 am
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
t0xic
Member
Posts: 216 Joined: Sat May 05, 2007 3:16 pm
Location: VA
Contact:
Post
by t0xic » Fri Jun 15, 2007 2:37 pm
Hey,
Did you mean -f
no leading-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
astrocrep
Member
Posts: 127 Joined: Sat Apr 21, 2007 7:21 pm
Post
by astrocrep » Fri Jun 15, 2007 5:29 pm
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