gcc cross compiler problem
gcc cross compiler problem
sorry guys, im not too good at this cross compiler stuff.
ok so i did the first part of the gcc cross compiler tutoral, like the part until you get to troubleshooting and what not.
So i went back to the barebones turorial and i try the as -o loader.o loader.s thing and i get the same unrecognized character.
i dont really understand the usage part of the gcc cross compiler tutorial.
what am i missing???????
notes: i have cygwin with the full package.
thank you!
ok so i did the first part of the gcc cross compiler tutoral, like the part until you get to troubleshooting and what not.
So i went back to the barebones turorial and i try the as -o loader.o loader.s thing and i get the same unrecognized character.
i dont really understand the usage part of the gcc cross compiler tutorial.
what am i missing???????
notes: i have cygwin with the full package.
thank you!
Re:gcc cross compiler problem
You have to use your cross-compiler tools. If you used /usr/cross as prefix, that means your cross-compiler tools are not in the search path for executables. 'as' is still the same 'as' that came with Cygwin, which doesn't know about ELF format.simmy wrote: So i went back to the barebones turorial and i try the as -o loader.o loader.s thing and i get the same unrecognized character.
i dont really understand the usage part of the gcc cross compiler tutorial.
what am i missing???????
The cross-compiler 'as' can be accessed as /usr/cross/bin/${TARGET}-as, or /usr/cross/${TARGET}/bin/as.
I would recommend you add /usr/cross/bin to your executable search path, by editing ~/.bash_profile :
Code: Select all
export PATH=$PATH:/usr/cross/bin
Every good solution is obvious once you've found it.
Re:gcc cross compiler problem
so when i followed the tutorial i was suppose to fill in stuff like TARGET, PREFIX, and PATH with my own information i guess?
Re:gcc cross compiler problem
TARGET is the platform you want to target, e.g. i386-elf, i586-elf or the like.
PREFIX is where you want the stuff to be installed, like /usr/cross (recommended to keep things apart from the system toolchain).
The tutorial starts with the very two lines where you set these (Step 1 - Bootstrap, Preparation)...
Later, prior to making the GCC, you extend the path:
This is verbatim, i.e. you don't have to change anything. In fact, the only thing you have to change at all in the tutorial commands is exchanging [tt]binutils-x.xx[/tt] and [tt]gcc-x.x.x[/tt] with the actual versions you use (e.g., binutils-2.16.1 and gcc-4.0.2 or whatever).
PREFIX is where you want the stuff to be installed, like /usr/cross (recommended to keep things apart from the system toolchain).
The tutorial starts with the very two lines where you set these (Step 1 - Bootstrap, Preparation)...
Code: Select all
export PREFIX=/usr/cross
export TARGET=i586-elf
Code: Select all
export PATH=$PATH:$PREFIX/bin
Every good solution is obvious once you've found it.
Re:gcc cross compiler problem
I also have been having problems getting a working cross-tool chain.
First, I tried just using the cross-* setup that is now part of OpenBSD. Everything seemed to build fine, but when I went to create binaries, I always ended up with errors like "unresolved symbol __udivsi3" for symbols that *are* in libgcc (I verified with nm) but somehow not linked.
I compile like this:
gcc -c -o kernel.o -g -I../include kernel.c
ld -o kernel.img -lgcc -nostdlib kernel.o
I'm using -nostdlib, which would normally prevent the linking of libgcc, but when you explicitly link libgcc (with -lgcc), the symbols should be found ...but they're not.
I repeated the process by compiling all my cross tools from source (binutils and gcc) to make sure it wasn't just a problem with the OpenBSD cross-tool setup, but I got the same result. I'm building for arm-unknown-elf. I'm trying to build a kernel image to run directly on hardware (ok, ok, a QEMU Arm emulator).
Any help is appreciated.
First, I tried just using the cross-* setup that is now part of OpenBSD. Everything seemed to build fine, but when I went to create binaries, I always ended up with errors like "unresolved symbol __udivsi3" for symbols that *are* in libgcc (I verified with nm) but somehow not linked.
I compile like this:
gcc -c -o kernel.o -g -I../include kernel.c
ld -o kernel.img -lgcc -nostdlib kernel.o
I'm using -nostdlib, which would normally prevent the linking of libgcc, but when you explicitly link libgcc (with -lgcc), the symbols should be found ...but they're not.
I repeated the process by compiling all my cross tools from source (binutils and gcc) to make sure it wasn't just a problem with the OpenBSD cross-tool setup, but I got the same result. I'm building for arm-unknown-elf. I'm trying to build a kernel image to run directly on hardware (ok, ok, a QEMU Arm emulator).
Any help is appreciated.
Re:gcc cross compiler problem
Because of the way ld handles libraries, you need to put -lgcc last:
ld -o kernel.img -nostdlib kernel.o -lgcc
ld -o kernel.img -nostdlib kernel.o -lgcc
Re:gcc cross compiler problem
ok i get an Error 2 after i install the gcc tools.
during the binutils it says the gcc cross compiling is not working.
same thing during the gcc installation.
is there a way i can get a preconfigured cross compiler?!
i unpacked the .bz2 of both the gcc 4.1.1 and binutils 2.16.1 with 'tar -xjf' and then followed the tutorial.
during the binutils it says the gcc cross compiling is not working.
same thing during the gcc installation.
is there a way i can get a preconfigured cross compiler?!
i unpacked the .bz2 of both the gcc 4.1.1 and binutils 2.16.1 with 'tar -xjf' and then followed the tutorial.
Re:gcc cross compiler problem
I'd daresay some previous attempt at building a crosscompiler either screwed up your PATH, or your system compiler installation, or both, so that the binutils build procedure tries to run a non-functional system compiler.
Your best chance is probably to uninstall Cygwin, reinstall it (rather quickly done if you keep the downloaded packages intact), and try the tutorial again. It does work, I re-verified it with binutils-2.17 and GCC 4.1.1 just this morning.
Your best chance is probably to uninstall Cygwin, reinstall it (rather quickly done if you keep the downloaded packages intact), and try the tutorial again. It does work, I re-verified it with binutils-2.17 and GCC 4.1.1 just this morning.
Every good solution is obvious once you've found it.
Re:gcc cross compiler problem
how do i add /usr/src/cross to my PATH variable?
i can now show you the error i recieved after going to the end of step one of the gcc cross compiling tutorial:
http://216.39.201.3/members/images/error.PNG
i can now show you the error i recieved after going to the end of step one of the gcc cross compiling tutorial:
http://216.39.201.3/members/images/error.PNG
Re:gcc cross compiler problem
export PATH=$PATH:/usr/cross/bin
It's in the tutorial, actually... you might want to add this line to your ~/.profile so it gets executed when you log in...
Oh, and when you report a build error, always report the topmost error, not the last line printed. In your case, the "real" error was:
It's in the tutorial, actually... you might want to add this line to your ~/.profile so it gets executed when you log in...
Oh, and when you report a build error, always report the topmost error, not the last line printed. In your case, the "real" error was:
Code: Select all
make[2]: i586-elf-ar: Command not found
Every good solution is obvious once you've found it.
Re:gcc cross compiler problem
thanks for the advice
any suggestions on how to fix the error...?
any suggestions on how to fix the error...?
Re:gcc cross compiler problem
By adding /usr/cross/bin to your path?
Every good solution is obvious once you've found it.
Re:gcc cross compiler problem
but i recieved this while i was installing gcc,not when trying to use it..