installing newlib?

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.
Post Reply
hazardoxide
Member
Member
Posts: 26
Joined: Thu Dec 13, 2007 12:31 pm

installing newlib?

Post by hazardoxide »

ok. I have cygwin with gcc, and binutils. i downloaded newlib. how do i add it to use it with gcc?
If bill gates had a dollar for everytime windows crashed...oh wait... he does.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

There are several methods.

1) Add your glue code to the libgloss directory and make newlib (A la the wiki article)

2) What I do. Compile newlib with target architecture i586-elf. It will compile but won't contain any glue code so won't work as yet. I then compile my userland libraries, make a new directory (tmp) and:

* copy the newlib .a file into /tmp.
* extract the newlib .a file (remember it's just a tar archive).
* copy all the .o files generated from my userland compilation into /tmp
* cd /tmp && tar -cf libc.a *.o && ranlib libc.a
* copy tmp/libc.a to wherever my gcc/lib symbolic link for libc.a points to.
* hey presto! rm -Rf /tmp and you're all done!

The slight advantage to this method is (a) Its quicker to build because I don't have to rebuild newlib every time (make NEVER seems to get depedencies fully correct) and (b) I don't have to have the entire newlib source tree in subversion, which is slow enough as it is.

Cheers,

JamesM

PS: This may look like a dirty hack, but look at the newlib makefiles - this is how they do it!
Post Reply