Page 1 of 1

OS specific toolchain is failing to build binutils

Posted: Wed Apr 22, 2015 3:04 pm
by heat
Hey guys :D ,
I'm trying to compile an OS specific toolchain following the wiki's tutorial,but I am having a problem compiling binutils.

I am using:
Binutils 2.24
GCC 4.9.2

I am compiling the new toolchain using Cygwin x86-64 version.I have setup the build strictly from the wiki, multiple times.

I'm having a problem with making ld: ldemul.o:ldemul.c:(.data+0x0): undefined reference to `ld_elf_i386_spartanos_emulation'

Configured with:

Code: Select all

./binutils-2.24/configure --prefix=C:/i686-spartanos --target=i686-spartanos --with-sysroot=/cygdrive/c/Users/Pedro/SpartanOS/sysroot --disable-nls --disable-werror 2<&1 |tee binutils_configure.log
Note: Some parts of the log are a bit broken because i used make with the -j option.

Build Log

Code: Select all

http://pastebin.com/YMBd7Prp
Please help me because i am stuck in this for days. [-o<

Re: OS specific toolchain is failing to build binutils

Posted: Wed Apr 22, 2015 3:58 pm
by iansjack
You have to configure gcc to support your os: http://wiki.osdev.org/OS_Specific_Toolchain

If you are creating a cross-compiler to compile your OS (as opposed to one to run on your OS) just use one of the standard target triplets.

Re: OS specific toolchain is failing to build binutils

Posted: Wed Apr 22, 2015 4:20 pm
by heat
I have already followed the tutorial. My problem is in building successfully binutils. Also, shouldn't the OS specific toochain be to also build the OS?

Re: OS specific toolchain is failing to build binutils

Posted: Wed Apr 22, 2015 4:52 pm
by kzinti
iansjack answered both of your questions. Read his reply again.

Re: OS specific toolchain is failing to build binutils

Posted: Thu Apr 23, 2015 12:47 am
by iansjack
Judging from your previous posts, I do not believe that you are yet at the stage where you need to produce a C compiler that targets your OS, which is what you arle unsuccessfully trying to do. And, from your reply, I don't think that you even bothered to read the link I provided.

Re: OS specific toolchain is failing to build binutils

Posted: Thu Apr 23, 2015 2:21 am
by xenos
A few words of clarification, because this was apparently mixed up in the previous posts:
  • You normally start with a bare metal toolchain, which has a bare metal target such as i686-elf or x86_64-elf. This is used to compile your OS kernel, and you can use it to compile drivers and a basic C library as well.
  • Once you have a C library, either written yourself or ported, you can switch to an OS specific toolchain. This toolchain will be used to compile programs that run on your OS, i.e., it is targeted to your OS, so it will have a target of the form i686-youros or x86_64-youros. Once you have this, you can also use it to compile your OS kernel and libraries by explicitly telling it to not include any C libraries and stuff. Note that also this toolchain does not run on your OS, but targets your OS.
  • A toolchain that actually runs on your OS would require porting it to the OS, so you would have to compile binutils / gcc using the OS specific toolchain mentioned above.
So if you wish to compile an OS specific toolchain, you should be at step 2 right now. Otherwise, you should compile a bare metal toolchain.

Re: OS specific toolchain is failing to build binutils

Posted: Thu Apr 23, 2015 7:36 am
by heat
So, basically you said i need to develop my kernel and implement standard C library (input,memory allocation,..) before I try to make an OS specific toolchain ?

Also, thanks for all the help orientating me to the right direction,I'm new in this OSDeving stuff.
And can you please help me to solve this error ? I want to know what caused the error and how to solve it, so I don't need to ask again.