GCC Cross compiler in Ubuntu 12.04
-
- Member
- Posts: 37
- Joined: Sat Apr 11, 2015 9:37 am
GCC Cross compiler in Ubuntu 12.04
Hi,
I'm using ubuntu 12.04, and i am a newbie to os devolopment. I have successfully built cross binutils, but i am stuck at making a gcc cross compiler. It will really hhelp me if someone gives a link to a working copy of a gcc cross compiler.
Thanks in advance.
I'm using ubuntu 12.04, and i am a newbie to os devolopment. I have successfully built cross binutils, but i am stuck at making a gcc cross compiler. It will really hhelp me if someone gives a link to a working copy of a gcc cross compiler.
Thanks in advance.
Re: GCC Cross compiler in Ubuntu 12.04
No, I don't think so. (And how can anyone give you a cross compiler when they don't know which processor you are targetting.)
You'll come up against a number of problems during your adventures in OS development. If you are going to give up at the first hurdle and ask others to do the work for you I think your voyage will be a short and boring one. Buckle down and solve your problem with creating a cross compiler. For starters you may want to tell us exactly what commands you typed in and what results you got. Theen it might be possible to make sensible suggestions.
You'll come up against a number of problems during your adventures in OS development. If you are going to give up at the first hurdle and ask others to do the work for you I think your voyage will be a short and boring one. Buckle down and solve your problem with creating a cross compiler. For starters you may want to tell us exactly what commands you typed in and what results you got. Theen it might be possible to make sensible suggestions.
Re: GCC Cross compiler in Ubuntu 12.04
Hello and welcome to forums *blah-blah-blah*,
Is the problem that making the GCC throws an error and compilation terminates? If so, I guess that this may be caused by incompatible versions of binutils and GCC, and I would like to present you these two good articles (however, seems like that you're familiar with the former one):
Also, some errors may be solved by Googling, as some links may point to mailing lists/forums that finally link to a patch.
Edit: Also, be sure that your compiler (usual `gcc' command) can build the GCC version of your choice. I've never faced with a problem that host GCC can't build the target binutils or GCC, so I can't help you in this case.
Is the problem that making the GCC throws an error and compilation terminates? If so, I guess that this may be caused by incompatible versions of binutils and GCC, and I would like to present you these two good articles (however, seems like that you're familiar with the former one):
- GCC Cross-Compiler -- just to ensure that you follow the instructions
- Cross-Compiler Successful Builds
Also, some errors may be solved by Googling, as some links may point to mailing lists/forums that finally link to a patch.
Edit: Also, be sure that your compiler (usual `gcc' command) can build the GCC version of your choice. I've never faced with a problem that host GCC can't build the target binutils or GCC, so I can't help you in this case.
-
- Member
- Posts: 37
- Joined: Sat Apr 11, 2015 9:37 am
Re: GCC Cross compiler in Ubuntu 12.04
I am targeting the i686-elf target, because i have to do so. (It is mentioned in the cross compiler tutorial that grub can boot only elf kernels.)
I guess i can use some bootloader other than grub ?? would that solve my problem ??
I guess i can use some bootloader other than grub ?? would that solve my problem ??
Re: GCC Cross compiler in Ubuntu 12.04
Of course, you can. But it won't solve your problem because GCC and bootloaders are not even related to each other (except that a bootloader might require GCC as a compiler).snasim2002 wrote:I am targeting the i686-elf target, because i have to do so. (It is mentioned in the cross compiler tutorial that grub can boot only elf kernels.)
I guess i can use some bootloader other than grub ?? would that solve my problem ??
What error do you get?
-
- Member
- Posts: 37
- Joined: Sat Apr 11, 2015 9:37 am
Re: GCC Cross compiler in Ubuntu 12.04
Every thing worked fine for me in the gcc cross compiler installation, but at the end i got:
make[1]: *** No rule to make target `../include/ansidecl.h', needed by `regex.o'. Stop.
make[1]: Leaving directory `/home/os/cross/src/gcc/build-i686-pc-linux-gnu/libiberty'
make: *** [all-build-libiberty] Error 2
make: *** No rule to make target `all-target-libgcc'. Stop.
/bin/sh ./mkinstalldirs /home/os/cross/cross /home/os/cross/cross
make[1]: Entering directory `/home/os/cross/src/gcc/fixincludes'
make[1]: *** No rule to make target `install'. Stop.
make[1]: Leaving directory `/home/os/cross/src/gcc/fixincludes'
make: *** [install-fixincludes] Error 2
make: *** No rule to make target `install-target-libgcc'. Stop.
Note that i'm trying to install binutils and gcc at the same directory.
make[1]: *** No rule to make target `../include/ansidecl.h', needed by `regex.o'. Stop.
make[1]: Leaving directory `/home/os/cross/src/gcc/build-i686-pc-linux-gnu/libiberty'
make: *** [all-build-libiberty] Error 2
make: *** No rule to make target `all-target-libgcc'. Stop.
/bin/sh ./mkinstalldirs /home/os/cross/cross /home/os/cross/cross
make[1]: Entering directory `/home/os/cross/src/gcc/fixincludes'
make[1]: *** No rule to make target `install'. Stop.
make[1]: Leaving directory `/home/os/cross/src/gcc/fixincludes'
make: *** [install-fixincludes] Error 2
make: *** No rule to make target `install-target-libgcc'. Stop.
Note that i'm trying to install binutils and gcc at the same directory.
Re: GCC Cross compiler in Ubuntu 12.04
Double-check what you're building - the wiki says not to build libiberty, but instead to build all-gcc and target-libgcc.
Re: GCC Cross compiler in Ubuntu 12.04
snasim2002 wrote:Note that i'm trying to install binutils and gcc at the same directory.
Seems like you've incorrectly built the binutils (as you want to build the binutils and GCC in the same directory). This might help you: http://stackoverflow.com/a/6228588. Follow the instructions in that answer (except configure and make, see below), but don't forget tosnasim2002 wrote:I have successfully built cross binutils, but i am stuck at making a gcc cross compiler.
- change the version numbers of binutils and GCC;
- if you've installed the dependencies (such as mpfr or mpc) using apt-get, you don't need to do any instructions related to them.
Code: Select all
$ ../gcc-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers
---
$ make all-gcc
$ make all-target-libgcc
$ make install-gcc
$ make install-target-libgcc
---
# If the binutils were not installed, run
$ make install # - this will fail. However, binutils will be installed into $PREFIX.
-
- Member
- Posts: 37
- Joined: Sat Apr 11, 2015 9:37 am
Re: GCC Cross compiler in Ubuntu 12.04
Please tell me what you have done for building a gcc cross compiler in ubuntu 12.04 from starting;
including versions of mpc, mpfr, gmp, etc
including versions of mpc, mpfr, gmp, etc
Re: GCC Cross compiler in Ubuntu 12.04
So, the instructions in my previous post are a bit hacky (regarding installing binutils) and I personally prefer building and installing GCC and Binutils separately, as it's more convenient. Yesterday, I've successfully built GCC 5.1.0 and Binutils 2.25 (before that, I was using GCC 4.9.2 and the same version of Binutils, 2.25). The Linux distribution I'm using provides all the dependencies that GCC and Binutils need (GMP, MPFR, MPC, and texinfo; though there are more), so I've installed them using the package manager.snasim2002 wrote:Please tell me what you have done for building a gcc cross compiler in ubuntu 12.04 from starting;
including versions of mpc, mpfr, gmp, etc
If you want versions, then:
- GMP 5.1.3-r1
- MPFR 3.1.2-r1
- MPC 1.0.1
- texinfo 4.13-r2
For instructions, see GCC Cross-Compiler.
-
- Member
- Posts: 37
- Joined: Sat Apr 11, 2015 9:37 am
Re: GCC Cross compiler in Ubuntu 12.04
I have suceessfully compiled my os (without a cross toolchain), it has "print_screen" and "clear_sreen" support. I just modified my linker script a bit.
It ran correctly by GRUB.
It ran correctly by GRUB.
- 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: GCC Cross compiler in Ubuntu 12.04
I guess I should consider you lucky. Ubuntu's own version is heavily patched with OSdev-unfriendly items and doesn't work for most people.snasim2002 wrote:I have suceessfully compiled my os (without a cross toolchain), it has "print_screen" and "clear_sreen" support. I just modified my linker script a bit.
It ran correctly by GRUB.