Page 1 of 1

gcc-cross compile error

Posted: Sat Jan 17, 2009 6:27 am
by xDDunce
hiya,

i recently ran into a problem with my code, and upon searching through the forums, i found the solution was a cross compiler. so i set off trying to make a cross compiler (AGAIN!!!) and all was fine. until i reached the configuration of the gcc package.

i am following the wiki tutorial for the cross compiler, and the first section (binutils) went perfect. all things compiled and configured fine. but then upon running the gcc configuration file, i get the following error:

Code: Select all

../gcc-4.2.4/configure: line 7498: cmp: command not found
a little research i did shows that it is a file comparison program. what i dont understand is how there is no cmp program in the cygwin application. is there a cmp.exe program for the cygwin shell?(hidden in the depths of teh interweb) or am i doomed? im currently searching through the cygwin install package to see if there is anything there.

i have seen so many people say "oh yes, it compiled fine for me in cygwin under windows!" but so far i see no evidence.

thanks in advance!

James.

Re: gcc-cross compile error

Posted: Sat Jan 17, 2009 7:34 am
by xDDunce
ok, 1 error down :D

gcc now configures fine, but does not compile. i run "make all-gcc" and get this error message:

Code: Select all

../../gcc-4.2.4/gcc/cp/Make-lang.in: 179: *** target pattern contains no '%' Stop.
as far as i can see, the only way to fix that is to edit the make file itself :(

Re: gcc-cross compile error

Posted: Sat Jan 17, 2009 10:43 am
by xDDunce
all sorted... i migrated to Mac OS X for my environment! simple :P

Re: gcc-cross compile error

Posted: Mon Jan 19, 2009 1:44 pm
by GlassX
That's what I'm about to do... I can't do anything in Cygwin either... Thank god I have a MacBook.

Did you used the instructions on the wiki page? Hope it works for me :(

Re: gcc-cross compile error

Posted: Mon Jan 19, 2009 3:43 pm
by xDDunce
i havent finished migrating yet. i have my cross compiler set up. it worked first time. just followed the wiki tutorial for making the cross compiler. but now i need to replace the current gcc with my cross compiler, but cant figure out how :( havent spent much time on it though to be honest. been getting my website on the go :D

if you manage to migrate successfully, please let me know? so i have someone to fall back on :lol: lol!

cheers!

James.

Re: gcc-cross compile error

Posted: Mon Jan 19, 2009 6:28 pm
by GlassX
Newsflash... After a few hours, the built-in GCC compiler still "can't compile executables".

Edit: Apparently there's a bug on the Xcode installer. I had to reinstall it because, sometimes, some libraries aren't copied properly...

Re: gcc-cross compile error

Posted: Tue Jan 20, 2009 1:37 am
by Solar
Those errors are actually new to me... and no, it doesn't have anything to do with Cygwin, actually the Tutorial was written for Cygwin and generalized only later.

Right now I don't have the time to try to reproduce your errors, but:
xDDunce wrote:but now i need to replace the current gcc with my cross compiler, but cant figure out how :(
GCC Cross-Compiler#Usage

Re: gcc-cross compile error

Posted: Tue Jan 20, 2009 5:57 am
by xDDunce
thanks solar, but that doesnt work. if i do that, then every time i run gcc from the terminal then it runs the xcode gcc. also if i use the -b or -V options, i get an error saying either: -b must come at beginning of command (for -b) and for -V it tries to run some imaginary binary from where the xcode gcc tools are installed. if i use both then i just get the -b error again.

so god damn confused :(

Re: gcc-cross compile error

Posted: Tue Jan 20, 2009 7:41 am
by Solar
Erm...

The wiki says to add /usr/cross/bin to your PATH. That directory should contain files named [TARGET]-gcc, [TARGET]-as etc, with [TARGET] being i586-pc-elf or somesuch.

"gcc" should still invoke /usr/bin/gcc, since there is no "gcc" in /usr/cross/bin. Not the last dozen times I tried...

Re: gcc-cross compile error

Posted: Tue Jan 20, 2009 7:54 am
by xDDunce
well i just spent half hour trying to work it out, and i got it running :D but... my source doesn't compile because it cannot see my include files for some strange reason.

im running a bash script call compile.sh:

Code: Select all

#!/bin/sh
# # # # # # # # # # # # # # # # # # # # #
i586-elf-gcc -o main.o    -c '/Volumes/SOURCES/XD-OS/source/version 0.0.03/CPP/main.cpp'    -ffreestanding -nostdlib -fno-builtin -fno-rtti -fno-exceptions -I '/Volumes/SOURCES/XD-OS/source/version 0.0.03/includes'
i586-elf-gcc -o video.o   -c '/Volumes/SOURCES/XD-OS/source/version 0.0.03/CPP/video.cpp'   -ffreestanding -nostdlib -fno-builtin -fno-rtti -fno-exceptions -I '/Volumes/SOURCES/XD-OS/source/version 0.0.03/includes'
i586-elf-gcc -o sys.o     -c '/Volumes/SOURCES/XD-OS/source/version 0.0.03/CPP/system.cpp'  -ffreestanding -nostdlib -fno-builtin -fno-rtti -fno-exceptions -I '/Volumes/SOURCES/XD-OS/source/version 0.0.03/includes'
i586-elf-gcc -o kernel.o  -c '/Volumes/SOURCES/XD-OS/source/version 0.0.03/CPP/kernel.cpp'  -ffreestanding -nostdlib -fno-builtin -fno-rtti -fno-exceptions -I '/Volumes/SOURCES/XD-OS/source/version 0.0.03/includes'
i586-elf-gcc -o globals.o -c '/Volumes/SOURCES/XD-OS/source/version 0.0.03/CPP/globals.cpp' -ffreestanding -nostdlib -fno-builtin -fno-rtti -fno-exceptions -I '/Volumes/SOURCES/XD-OS/source/version 0.0.03/includes'
i586-elf-gcc -o stdlib.o  -c '/Volumes/SOURCES/XD-OS/source/version 0.0.03/CPP/stdlib.cpp'  -ffreestanding -nostdlib -fno-builtin -fno-rtti -fno-exceptions -I '/Volumes/SOURCES/XD-OS/source/version 0.0.03/includes'
i586-elf-gcc -o GDTC.o    -c '/Volumes/SOURCES/XD-OS/source/version 0.0.03/CPP/GDT.cpp'     -ffreestanding -nostdlib -fno-builtin -fno-rtti -fno-exceptions -I '/Volumes/SOURCES/XD-OS/source/version 0.0.03/includes'
i586-elf-gcc -o IDTC.o    -c '/Volumes/SOURCES/XD-OS/source/version 0.0.03/CPP/IDT.cpp'     -ffreestanding -nostdlib -fno-builtin -fno-rtti -fno-exceptions -I '/Volumes/SOURCES/XD-OS/source/version 0.0.03/includes'
i586-elf-gcc -o ISR.o     -c '/Volumes/SOURCES/XD-OS/source/version 0.0.03/CPP/ISR.cpp'     -ffreestanding -nostdlib -fno-builtin -fno-rtti -fno-exceptions -I '/Volumes/SOURCES/XD-OS/source/version 0.0.03/includes'
i586-elf-gcc -nostdlib -nostdinc -fno-builtin -fno-stack-protector -c -o support.o '/Volumes/SOURCES/XD-OS/source/version 0.0.03/C/standard.c' -I '/Volumes/SOURCES/XD-OS/source/version 0.0.03/includes'
nasm -f elf -o boot.o '/Volumes/SOURCES/XD-OS/source/version 0.0.03/ASM/main.asm'
nasm -f elf -o GDTasm.o '/Volumes/SOURCES/XD-OS/source/version 0.0.03/ASM/GDT.asm'
nasm -f elf -o IDTasm.o '/Volumes/SOURCES/XD-OS/source/version 0.0.03/ASM/IDT.asm'
ld -T link.ld -o '/Volumes/SOURCES/XD-OS/source/version 0.0.03/cd/kernel.sys'
i have set up PATH by calling export PATH= etc. etc... and all of these commands return the same errors. they run, but they cannot find any of my includes, despite me giving them the FULL PATH to their location. what is going wrong??

Re: gcc-cross compile error

Posted: Tue Jan 20, 2009 10:50 am
by Combuster
have you checked that that directory actually exists?

Re: gcc-cross compile error

Posted: Wed Jan 21, 2009 8:43 am
by xDDunce
yes, i am sure the directory exists. i've been staring at it for the past few days...

i'm now regretting my choice of converting to C++ :( :lol:

Re: gcc-cross compile error

Posted: Sat Jan 24, 2009 12:06 pm
by xDDunce
ok, so im almost finished. i have gcc working, but whenever i run nasm it claims not to be able to find the file... is there a way to pause the bash execution like in windows batch files? i think it's trying to do everything faster than the USB controller can keep up with (keeping my OS on a usb stick so i never leave it behind and can work on it around college).