Page 1 of 1

[GCC] Has anyone successfully ported GCC for their OS ?

Posted: Sat Feb 18, 2012 9:07 am
by fiveayem
Hello,

Having built an OS Specific Toolchain following the tutorial on the Wiki, I would like now to run GCC on my own OS to go self-hosted.

I could see by looking at the topic "What does your OS look like? (Screen Shots..)" that some members of this forum had managed to do it.

Could anyone explain me how I should proceed ? I have tried many times unsuccessfully.

(I especially don't know how to deal with paths. Indeed, when I launch the configure script for configuring the GCC build, I set the 'prefix' option to '/mnt/mydisk', which is the location where the disk image used by my OS is mounted. Thus, when executing on my OS, GCC fetches the specs file in '/mnt/mydisk/lib/gcc/i586-pc-myos/', and then it can't find it.)

I'd really need a detailed procedure. The GCC version I used to build the OS Specific Toolchain is 4.4.3, while the version of GCC used in my OS Specific Toolchain is 4.6.1. The GCC version I'm trying to run on my OS is also 4.6.1.

Thanks for your help and sorry for my English.

Re: [GCC] Has anyone successfully ported GCC for their OS ?

Posted: Sat Feb 18, 2012 9:42 am
by Kevin
I think if you actually managed to build it and it just doesn't find its files on your OS, you're very close already, so I don't think you need an explanation for the whole procedure. :)

You need to set the prefix as seen when running on your OS, probably --prefix=/lib/gcc/i586-pc-myos/ in your case. For installing it, use the DESTDIR variable to tell the Makefile about your mount point, something like make DESTDIR=/mnt/mydisk install.

Re: [GCC] Has anyone successfully ported GCC for their OS ?

Posted: Sat Feb 18, 2012 9:49 am
by fiveayem
Thank you for your answer. Is it possible to change the prefix without building the whole compiler again ?

Re: [GCC] Has anyone successfully ported GCC for their OS ?

Posted: Sat Feb 18, 2012 10:33 am
by bubach
Sorry for being a bit off-topic, but why? How long does it take to build GCC? :?

Re: [GCC] Has anyone successfully ported GCC for their OS ?

Posted: Sat Feb 18, 2012 10:51 am
by fiveayem
For me, it takes about 40 minutes.

Re: [GCC] Has anyone successfully ported GCC for their OS ?

Posted: Sat Feb 18, 2012 11:26 am
by evoex
fiveayem wrote:For me, it takes about 40 minutes.
Meaning it would've been done by the time you posted this post, if you hadn't asked the question. That said, you might try to find the path in every file and replace it with the new path (I think sed must be able to do it). But it might not work, so I reckon you're better off taking the 40 minutes to recompile.

Re: [GCC] Has anyone successfully ported GCC for their OS ?

Posted: Sat Feb 18, 2012 12:18 pm
by fiveayem
Ok, now I have set the prefix to '/usr/local' and set the DESTDIR variable to '/mnt/mydisk' when installing GCC, Binutils and Newlib. Now GCC tries to search the file '/usr/local/../lib/gcc/i586-pc-myos/4.6.1/specs'. But it doesn't find it, as the '/mnt/mydisk/usr' directory only contains 'local', and doesn't have 'lib' son directory.

Re: [GCC] Has anyone successfully ported GCC for their OS ?

Posted: Sat Feb 18, 2012 12:34 pm
by bubach
fiveayem wrote:For me, it takes about 40 minutes.
IMO that's unacceptable, what the hell? I had no idea. :shock: