Page 1 of 1
Creating OS development toolchain
Posted: Tue Aug 12, 2008 9:17 am
by Vonigol
Hello,
I am following OSDEV's tutorial "OS Specific toolchain" (
http://wiki.osdev.org/OS_Specific_Toolchain) tyring to create a development toolchain for my OS. I am following the tutorial precisely, step-by-step, observing all recomendations and rules. However, the make process for newlib fails with the following message:
ln sys/crt0.o crt0.o >/dev/null 2>/dev/null || cp sys/crt0.o crt0.o
cp: cannot stat `sys/crt0.o': No such file or directory
make[5]: *** [crt0.o] Error 1
make[5]: Leaving directory `/home/myos/myos/build/build-newlib/i386-pc-myos/newlib/libc'
Can anyone point me to the possible source of problem?
Thanks.
Best,
Alex
Re: Creating OS development toolchain
Posted: Tue Aug 12, 2008 9:29 am
by quok
I've never built newlib myself for any platform, or attempted to port it to my OS, but I do believe that crt0.S (which compiles in to crt0.o) is one of those files that you have to supply yourself, as it is usually quite specific to your OS.
Of course, if you're not at the point of porting applications over to your OS yet, you don't need to bother with newlib at all. I followed that same tutorial when I just wanted to retarget gcc for my kernel development. I find having i686-pc-myos-gcc a lot more convenient than simply having i686-elf-gcc or something similar that you would get when following the other cross compiling tutorials.
Re: Creating OS development toolchain
Posted: Tue Aug 12, 2008 12:09 pm
by Solar
Dunno about newlib either, but "crt" stands for "C RunTime", and contains the startup code for your executable. As such, it is highly OS-specific, and might require you supplying it instead of coming pre-build by newlib.
Check...
1) that it really isn't there and this is not just some typo somewhere ("find . -name "crt*");
2) crt0.o being build or *not* being build might be mentioned sometime earlier during the build process, and / or the docs...
Re: Creating OS development toolchain
Posted: Tue Aug 12, 2008 12:32 pm
by Vonigol
Hello guys,
Thanks for your replies. But, I think, there is some misunderstanding here.
As I said in my post earlier, I followed the tutorial _PRECISELY_. It means that crt0.S (among with other files including configure.in and Makefile.am) was created in the same way as it is directed in the tutorial (in the folder ../newlib/libc/sys/myos). The only differnce between my case and the tutorial is that the last stage (building the newlib) unexpectedly fails.
The make process tries to access the crt0.o file that hasn't been built yet. I checked the log file (the output of the make process). It doesn't refer to crt0 before this error. That is why the file crt0.o is not built. So it seems that the Makefile for my OS was not generated correctly by automake tools. What can be the reason of such behavior? According to the tutorial, it shoiuld be fine. I use the newer newlib than in the tutorial. Can it be the reason?
Best regards,
Alex
Re: Creating OS development toolchain
Posted: Wed Aug 13, 2008 3:32 am
by Marven Lee
I had a similar problem with Newlib 1.14 and I might have had the same problem in 1.15. There was an explanation on the Newlib mailing list archive but I can't seem to find it anymore.
I believe it was something to do with crt0.o and other object files not being allowed to be the end target of Automake, thought don't quote me.
Anyway I remember that a solution was to create an empty dummy.S file (or could use crt0.S) then add EXTRA_lib_a_SOURCES = dummy.S to the makefile.am as follows. dummy.S and crt0.S doesn't need adding to the lib_a_SOURCES. This is what I use with Newlib 1.15.
Code: Select all
AUTOMAKE_OPTIONS = cygnus
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
AM_CCASFLAGS = $(INCLUDES)
noinst_LIBRARIES = lib.a
lib_a_SOURCES = \
blah1.c \
blah2.c \
blah3.c
EXTRA_lib_a_SOURCES = dummy.S
lib_a_CCASFLAGS = $(AM_CCASFLAGS)
lib_a_CFLAGS = $(AM_CFLAGS)
all: crt0.o
ACLOCAL_AMFLAGS = -I ../../..
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
install-data-local:
$(mkinstalldirs) $(DESTDIR)$(tooldir)/include/netinet; \
for i in $(srcdir)/netinet/*.h; do \
$(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/netinet/`basename $$i`; done
Then update the configure/makefile.in using the following from the sys/myosname directory.
Code: Select all
aclocal -I ../../..
autoconf
automake --cygnus --add-missing Makefile
Edit: Just had a look at the wiki page and it's more or less the same as mine. I can only think that MAY_SUPPLY_SYSCALLS isn't defined.
Re: Creating OS development toolchain
Posted: Wed Aug 13, 2008 8:24 am
by Vonigol
Thanks Marven!
This is for I needed. The problem is solved. I regret that I didn't post this message earlier. Two days were wasted when I tried to figure out the problem by myself ...
Best regards,
Alex