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

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
fiveayem
Member
Member
Posts: 51
Joined: Sun Aug 14, 2011 8:01 am

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

Post 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.
Kevin
Member
Member
Posts: 1071
Joined: Sun Feb 01, 2009 6:11 am
Location: Germany
Contact:

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

Post 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.
Developer of tyndur - community OS of Lowlevel (German)
fiveayem
Member
Member
Posts: 51
Joined: Sun Aug 14, 2011 8:01 am

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

Post by fiveayem »

Thank you for your answer. Is it possible to change the prefix without building the whole compiler again ?
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

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

Post by bubach »

Sorry for being a bit off-topic, but why? How long does it take to build GCC? :?
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
fiveayem
Member
Member
Posts: 51
Joined: Sun Aug 14, 2011 8:01 am

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

Post by fiveayem »

For me, it takes about 40 minutes.
evoex
Member
Member
Posts: 103
Joined: Tue Dec 13, 2011 4:11 pm

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

Post 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.
fiveayem
Member
Member
Posts: 51
Joined: Sun Aug 14, 2011 8:01 am

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

Post 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.
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

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

Post by bubach »

fiveayem wrote:For me, it takes about 40 minutes.
IMO that's unacceptable, what the hell? I had no idea. :shock:
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
Post Reply