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.
This produces "undefined reference" errors to all of my system calls (read, write, etc.). I have followed the tutorial closely and put them in the file syscalls.c so I'm not sure why they are not being found. If I understand it correctly, they should be in a file lib.a which I cannot locate. I didn't see any errors during the make process.
EDIT:
I want to add that library functions which do not depend on system calls (e.g. atoi, strlen, strcmp) are working fine.
I'm trying to compile the library manually now and it looks like there must have been some errors that slipped by me during the make process. I'm resolving them now.
You need to produce object files from the functions you have created and create a library from them. Then include that library in your list of libraries to link against. Alternatively, you can just use "ar" to add the object files to libc.a (for static linking). That way you just have to link against libc.
If you follow the OS Specific Toolchain article properly, it will create a toolchain which will compile that program no problem - no extra libraries or weird linking required. Go through the process step by step, and make sure you run the proper autoconf and autoreconf commands when needed.
Edit:
If I understand it correctly, they should be in a file lib.a which I cannot locate.
Yes. This will be created from the objects compiled in the sys/myos directory. It will be added to libc.a
Just as a matter of interest, you don't have to go through the full process that JamesM describes. Once you have libc.a you can add, or refresh, object files to it with the command:
That way, if you make a change to foo it's very simple to update the library file.
I like to use the basic utilities at times rather than going through the full autoconf route. It's easy, efficient, and it gives me a better grasp of what is happening.