Missing start files in custom toolchain.
Missing start files in custom toolchain.
Hi,
I have been following the guide on the wiki about creating a custom tool chain specifically for my OS. My kernel compiles fine with the new tool chain but when I go to compile a test program, ld complains that it can't find "crtbegin.o". I know the reason for this, it is because my kernel uses a custom linker script that doesn't drag in start files and the like. I also understand that "crtbegin.o" (and probably "crtend.o") come from gcc. My question is, how can I get gcc to generate these files during the build process? Even if they are just asm stubs that do nothing?
Also, if I pass "-nostartfiles" (or something like that) to my custom gcc to build the program it stops complaining about the "crt*.o" files (as expected) but then complains about not being able to find "libgcc".
I have checked the installation directories and neither libgcc or any of the start files (except for crt0 form newlib) are there. It seems that something is missing from my gcc build, but I can't figure out what.
I have been following the guide on the wiki about creating a custom tool chain specifically for my OS. My kernel compiles fine with the new tool chain but when I go to compile a test program, ld complains that it can't find "crtbegin.o". I know the reason for this, it is because my kernel uses a custom linker script that doesn't drag in start files and the like. I also understand that "crtbegin.o" (and probably "crtend.o") come from gcc. My question is, how can I get gcc to generate these files during the build process? Even if they are just asm stubs that do nothing?
Also, if I pass "-nostartfiles" (or something like that) to my custom gcc to build the program it stops complaining about the "crt*.o" files (as expected) but then complains about not being able to find "libgcc".
I have checked the installation directories and neither libgcc or any of the start files (except for crt0 form newlib) are there. It seems that something is missing from my gcc build, but I can't figure out what.
~[Fluidium]~
-
- Posts: 8
- Joined: Sun Aug 12, 2007 12:45 pm
- Location: Feliz, Rio Grande do Sul, Brazil
- Contact:
Re: Missing start files in custom toolchain.
This file is created when you run the command to compile the libgcc, for this run the command:
and then
To finish the compilation of gcc.
Code: Select all
make
Code: Select all
make install
Re: Missing start files in custom toolchain.
I've tried your suggestion and it now complains about not having floating/fixed point support. It seems logical that I would have to add it myself (floating point is rather hardware dependent) but I have no idea where to add it. Google hasn't been any help here.
~[Fluidium]~
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Missing start files in custom toolchain.
in my case floating point stuff works out of the box.
I do however link with ld directly rather than via gcc
I do however link with ld directly rather than via gcc
Re: Missing start files in custom toolchain.
Just touch them. They don't need to contain anything, just exist.Stevo14 wrote:Hi,
I have been following the guide on the wiki about creating a custom tool chain specifically for my OS. My kernel compiles fine with the new tool chain but when I go to compile a test program, ld complains that it can't find "crtbegin.o". I know the reason for this, it is because my kernel uses a custom linker script that doesn't drag in start files and the like. I also understand that "crtbegin.o" (and probably "crtend.o") come from gcc. My question is, how can I get gcc to generate these files during the build process? Even if they are just asm stubs that do nothing?
Also, if I pass "-nostartfiles" (or something like that) to my custom gcc to build the program it stops complaining about the "crt*.o" files (as expected) but then complains about not being able to find "libgcc".
I have checked the installation directories and neither libgcc or any of the start files (except for crt0 form newlib) are there. It seems that something is missing from my gcc build, but I can't figure out what.
Code: Select all
touch $PREFIX/lib/gcc/i686-elf/4.3.0/crt0.o $PREFIX/lib/gcc/i686-elf/4.3.0/crtbegin.o $PREFIX/lib/gcc/i686-elf/4.3.0/crtend.o
Re: Missing start files in custom toolchain.
Thanks, that seems to do the trick. However, it still complains about not finding libgcc. The exact error is:JamesM wrote: Just touch them. They don't need to contain anything, just exist.
Code: Select all
touch $PREFIX/lib/gcc/i686-elf/4.3.0/crt0.o $PREFIX/lib/gcc/i686-elf/4.3.0/crtbegin.o $PREFIX/lib/gcc/i686-elf/4.3.0/crtend.o
Code: Select all
stephen@stephen-laptop ~/P/F/t/p/turtle> make
#
# turtle shell
/home/stephen/Programming/Fluidium/trunk/toolchain/cross/lib/gcc/i586-pc-fluidium/4.3.2/../../../../i586-pc-fluidium/bin/ld: cannot find -lgcc
collect2: ld returned 1 exit status
make: *** [all] Error 1
stephen@stephen-laptop ~/P/F/t/p/turtle>
Here is the actual error. It happens during the configuration process:Combuster wrote:in my case floating point stuff works out of the box.
I do however link with ld directly rather than via gcc
Code: Select all
checking whether decimal floating point is supported... no
checking whether fixed-point is supported... no
*** Configuration i586-pc-fluidium not supported
make[1]: *** [configure-target-libgcc] Error 1
~[Fluidium]~
Re: Missing start files in custom toolchain.
No, you should make a libgcc.
Code: Select all
make all-target-libgcc; make install-target-libgcc
Re: Missing start files in custom toolchain.
Thanks everyone for the help. I've solved these problems by a) targeting i586-elf instead of a custom target which fixes the floating point issue and b) compiling all of gcc ("make all" instead of "make all-gcc") which builds a libgcc (like JamesM pointed out) and fixes the problem with the start files.
~[Fluidium]~
- TyrelHaveman
- Member
- Posts: 40
- Joined: Thu Sep 20, 2007 11:20 pm
- Location: Bellingham, WA
- Contact:
Re: Missing start files in custom toolchain.
Hi,Stevo14 wrote:Thanks everyone for the help. I've solved these problems by a) targeting i586-elf instead of a custom target which fixes the floating point issue and b) compiling all of gcc ("make all" instead of "make all-gcc") which builds a libgcc (like JamesM pointed out) and fixes the problem with the start files.
I just discovered something that might help you even more (in the process of doing the same thing): to get libgcc to compile on your custom target, edit libgcc/config.host to include your OS. To match the style of the toolchain tutorial on the wiki:
Code: Select all
i[3-7]86-*-myos*)
;;
That should probably be added to that wiki page.
Tyrel