Page 1 of 1

cross compiler on XP

Posted: Sun Jun 18, 2006 12:50 pm
by Bob the Avenger
I've been trying to follow http://www.mega-tokyo.com/osfaq/GCC%20Cross-Compiler and build a native cross compiler for my OS, but I've been having trouble with "../binutils-x.xx/configure --target=$TARGET --prefix=$PREFIX --disable-nls". Because of difficulties with setting $TARGET and $PREFIX i've been trying:
"../binutils-x.xx/configure --target=i586-elf --prefix=C:\cross --disable-nls"

The error i have been getting is '''../binutils-x.xx/configure' is not recognised as an internal or external command, operable program or batch file"

I tried using Cygwin, but it doesnt recognise DJGPP, so i was unable to bootstrap GCC. This has really got me stumped so any help is welcome, please.

Re:cross compiler on XP

Posted: Sun Jun 18, 2006 1:11 pm
by Candamir
As first step, I'd recommend you to uninstall DJGPP, as it is also available in Cygwin, because your Windows Path is also included in the Cygwin path. Next, you have to run setup.exe again and select a few additional packages from the developer's group: gcc-core, make, bison and flex. If you were previously osdeving under Windows and now plan to shift to Cygwin, I'd also recommend you to uninstall your Windows NASM and download the aequivalent Cygwin package.

Obviously, a sh script is not recognized as an executable under the windows shell, so you have to use Cygwin. But I think the most important step you have to do is to uninstall DJGPP or remove it from your path when working in Cygwin.

I also had lots of trouble with my cross-compiler, but finally, I managed to do it with a script provided by SOLAR:

Code: Select all

# Preparation
rm -rf /usr/cross
export PREFIX=/usr/cross
export TARGET=i386-elf
cd /usr/src
mkdir -p solar_build/build-binutils solar_build/build-gcc
cd solar_build
wget http://ftp.gnu.org/gnu/binutils/binutils-2.16.1.tar.bz2
wget http://ftp.gnu.org/gnu/gcc/gcc-4.0.3/gcc-core-4.0.3.tar.bz2
wget http://ftp.gnu.org/gnu/gcc/gcc-4.0.3/gcc-g++-4.0.3.tar.bz2
tar xjf binutils-2.16.1.tar.bz2
tar xjf gcc-core-4.0.3.tar.bz2
tar xjf gcc-g++-4.0.3.tar.bz2

# Binutils
cd build-binutils
../binutils-2.16.1/configure --target=$TARGET --prefix=$PREFIX --disable-nls
make all install

# GCC
cd ../build-gcc
export PATH=$PATH:$PREFIX/bin
../gcc-4.0.3/configure --target=$TARGET --prefix=$PREFIX --disable-nls --enable-languages=c,c++ --without-headers
make all-gcc install-gcc
I'd also recommend you to read the article in the FAQ again, as at the beginning, there is a section that tells you to remove DJGPP.

Note: For this script to work, you also have to download the wget package within setup.exe - but I forgot in which group the package is located, I believe to remember that there's a group of internet packages...

Hope this helps,

Candamir

Re:cross compiler on XP

Posted: Sun Jun 18, 2006 2:37 pm
by Bob the Avenger
thanks, i'll try what you've said. I did remove DJGPP while using cygwin, but re-installed it when trying with command.exe

Re:cross compiler on XP

Posted: Sun Jun 18, 2006 3:49 pm
by Midas
If the error you get actually references binutils-x.xx then that means you've forgotten to replace the letter x with the right numbers. For example, you might be looking for ../binutils-2.16.1/configure. :-) Otherwise, I apologise!

Re:cross compiler on XP

Posted: Sun Jun 18, 2006 4:37 pm
by Bob the Avenger
thats a typo in my post, it is binutils 2.16.1, and now i've got back from my wild goose chase i can get on with trying this

Re:cross compiler on XP

Posted: Sun Jun 18, 2006 5:45 pm
by Bob the Avenger
Its worked, thank you Candamir, also Solar too. I wish toffee on you both

Re:cross compiler on XP

Posted: Sun Jun 18, 2006 9:45 pm
by Solar
The thanks should go to Midas, not me. ;)

Re:cross compiler on XP

Posted: Sun Jun 18, 2006 11:19 pm
by Candamir
Ooops :o

Re:cross compiler on XP

Posted: Mon Jun 19, 2006 5:26 am
by Bob the Avenger
thank you too, Midas, i wish you much toffee also