Porting GCC to my 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.
giszo
Member
Member
Posts: 124
Joined: Tue Nov 06, 2007 2:37 pm
Location: Hungary

Post by giszo »

Two more (stupid) questions: :)

#1: Should i add --with-headers to binutils as well or it's only a gcc specific configure parameter?
#2: When i'm trying to compile binutils how jnc100 explained ( with --host=i586-pc-giszOS --target=i586-pc-giszOS) configure runs without failure but when i start make it looks for header files without success. Where should i put the header files of my C library? I've an include directory in .../my_cross_dir, should i place them there?

giszo
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

yes. Did you even *try* that before asking that question?
giszo
Member
Member
Posts: 124
Joined: Tue Nov 06, 2007 2:37 pm
Location: Hungary

Post by giszo »

I've tried both without luck.. I got the same results with error that's why i asked :)

If i add the --with-headers parameter: CC=i586-pc-giszOS-gcc ./configure --host=i586-pc-giszOS --target=i586-pc-giszOS --prefix=/home/giszo/gcc_giszOS_native --disable-nls --with-headers=/path/of/my/C/header/files
i got the following error: *** --with-headers is only supported when cross compiling

If i just drop my libc header files to .../my_cross_dir/include i got a lot of error like this:
checking sys/time.h usability... no
checking sys/time.h presence... no
checking for sys/time.h... no
and so on..
jnc100
Member
Member
Posts: 775
Joined: Mon Apr 09, 2007 12:10 pm
Location: London, UK
Contact:

Post by jnc100 »

giszo wrote:Where should i put the header files of my C library?
Personally, mine go in /usr/cross/i586-pc-tysos/include, where $PREFIX=/usr/cross and $TARGET=i586-pc-tysos (from when I built the cross compiler). Obviously, you need to be sure that your C library contains all the required headers...

Regards,
John.
giszo
Member
Member
Posts: 124
Joined: Tue Nov 06, 2007 2:37 pm
Location: Hungary

Post by giszo »

I just moved the header files from ../my_cross_dir/include to ../my_cross_dir/i586-pc-giszOS/include and now make runs, thanks! I just need to work on my C library a bit more :)
giszo
Member
Member
Posts: 124
Joined: Tue Nov 06, 2007 2:37 pm
Location: Hungary

Post by giszo »

Are there any specification about the standard C library? I mean what functions and in what files has to be defined?
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Post by Solar »

*cough*

Are you serious?

<irony>
Of course not. It is named "standard" to mislead people into thinking it is about a standard collection of functions declared in standard headers...
</irony>

Try the Dinkumware online reference for starters.
Every good solution is obvious once you've found it.
giszo
Member
Member
Posts: 124
Joined: Tue Nov 06, 2007 2:37 pm
Location: Hungary

Post by giszo »

Thanks!
giszo
Member
Member
Posts: 124
Joined: Tue Nov 06, 2007 2:37 pm
Location: Hungary

Post by giszo »

What is the problem with my header file if i got errors like these:
/home/giszo/gcc_giszOS_cross/bin/../lib/gcc/i586-pc-giszOS/4.2.2/../../../../i586-pc-giszOS/include/sys/types.h:45: error: two or more data types in declaration specifiers

In sys/types.h line #45 is the following:
typedef int pid_t;

/home/giszo/gcc_giszOS_cross/bin/../lib/gcc/i586-pc-giszOS/4.2.2/../../../../i586-pc-giszOS/include/sys/types.h:30: error: duplicate 'unsigned'

line #30:
typedef unsigned int uintptr_t;
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Post by Solar »

/home/giszo/gcc_giszOS_cross/bin/../lib/gcc/i586-pc-giszOS/4.2.2/../../../../i586-pc-giszOS/include/sys/types.h:30: error: duplicate 'unsigned'

line #30:
typedef unsigned int uintptr_t;
Check if there happens to be a "#define uintptr_t unsigned..." somewhere...
Every good solution is obvious once you've found it.
giszo
Member
Member
Posts: 124
Joined: Tue Nov 06, 2007 2:37 pm
Location: Hungary

Post by giszo »

Ohh, i haven't thought it but right :) i just drop a #undef uintptr_t before my type definition and it works :)
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Post by Solar »

I'd rather look for where that define is lurking, because that's the root of the problem.

You're supressing symptoms, not solving the problem. Your headers are inconsistent.
Every good solution is obvious once you've found it.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

OOI, how far along is your OS? ...
giszo
Member
Member
Posts: 124
Joined: Tue Nov 06, 2007 2:37 pm
Location: Hungary

Post by giszo »

I didn't tell you that my OS/C library is 100% complete, but at least i compiled binutils and it's running on my OS, but still i've a little problem.

When i run for example "objdump -i" i got only the following:
"BFD header file version (GNU binutils) 2.18 and no more output"

What did i miss? I can't see any supported format by objdump...
Post Reply