Page 1 of 1

Help on the OS specific toolchain

Posted: Mon Jan 26, 2015 4:53 am
by mohammedisam
Hi again :D
I followed the tutorial on building the GCC cross compiler and the OS specific toolchain. But when I try to build binutils, make gives me an error:

Code: Select all

configure: error: *** unknown target vector bfd_elf32_i386_vec
make[1]: *** [configure-bfd] Error 1
make[1]: Leaving directory `/home/MIMA/src/detour-build-binutils'
make: *** [all] Error 2
I think the problem originated from bfd/config.bfd. The tutorial says add these lines:

Code: Select all

  i[3-7]86-*-myos*)
    targ_defvec=bfd_elf32_i386_vec
    targ_selvecs=
    targ64_selvecs=bfd_elf64_x86_64_vec
    ;;
#ifdef BFD64
  x86_64-*-myos*)
    targ_defvec=bfd_elf64_x86_64_vec
    targ_selvecs=bfd_elf32_i386_vec
    want64=true
    ;;
#endif
which I added exactly, with the hange of myos to the name of my os, right?
The configure scipt ran with no errors. I am trying to build from binutils 2.25 and gcc 4.9.2, on a 64bit Fedora Linux host.
Any idea about how to solve this? I pulled my hair out trying to figure what the problem is.
many thanx :D

Re: Help on the OS specific toolchain

Posted: Mon Jan 26, 2015 9:19 am
by sortie
I haven't updated that tutorial since the release of binutils 2.24. I had trouble with binutils 2.25 when I tried rebasing my local changes on it, but I go further than the OS Specific Toolchain does. Can you see if binutils 2.24 works for you?

Any help updating it to also handle binutils 2.25 or confirmation that the current instructions do work for 2.25 - that would be much appreciated. It's hard to say if the OP made a mistake or if the tutorial is faulty.

(Btw - congratulations on coming so far that you want a OS specific toolchain!)

Re: Help on the OS specific toolchain

Posted: Mon Jan 26, 2015 1:08 pm
by mohammedisam
Hi sortie
I got myself a working kernel with a shell including basic commands, command history, ... But I know I can't go forever adding more functionality by gluing modules to the kernel!! at some point I have to be able to load executables and execute them. I have a working module that reads FAT systems and a *virtually* working ELF loader (not tested yet), so I need to compile my C programs to my OS in order to use them.

I downloaded binutils 2.24 and it compiled well. But gcc is not compiling. Make tells it can't find stdio.h although it is there in the /usr/include in my sysroot! :shock:

Code: Select all

../../../detour-gcc-4.9.2/libgcc/../gcc/tsystem.h:87:19: fatal error: stdio.h: No such file or directory
 #include <stdio.h>
                   ^
compilation terminated.
make[1]: *** [_muldi3.o] Error 1
make[1]: Leaving directory `/home/MIMA/src/detour-build-gcc/i686-detour/libgcc'
make: *** [all-target-libgcc] Error 2
What's happening? I didn't change the default include directory.

Re: Help on the OS specific toolchain

Posted: Tue Jan 27, 2015 1:44 pm
by sortie
See http://wiki.osdev.org/Hosted_GCC_Cross-Compiler if you haven't on instructions on how to build a cross-compiler for a hobby system with a minial user-space libc. This is how you're supposed to build your OS specific toolchain. I think your problem is that you haven't installed the standard library headers before building gcc.

Edit: Oh wait, you say it's there. Can you post the exact commands you used (with environment variables expanded) to build the cross-compiler? I suspect it isn't locating your system root properly or is searching the wrong directory, or you somehow configured it wrong.

Re: Help on the OS specific toolchain

Posted: Fri Jan 30, 2015 11:18 am
by mohammedisam
Yes sir, I finally got it working!
For some odd reason, gcc was not detecting my sysroot although I checked that I supplied it correctly to gcc. Anyhow I removed all the building & source dirs, re-unpacked the sources, configured and built it nicely.
Thanx for ur help & support man, appreciate it.
=D>