Page 2 of 3
Re:GCC Cross Compiler error in Cygwin
Posted: Sat Apr 08, 2006 10:10 am
by Solar
Candamir wrote:
Fully separated. I downloaded the *.tar.gz files to my /usr/src and decompressed them there and let them in their default folder. For compiling, I created new directories for them, as described in the FAQ. Is this what you mean?
What did you set PREFIX to? The default mentioned in the tutorial ( /usr/cross ), or something else?
Re:GCC Cross Compiler error in Cygwin
Posted: Sat Apr 08, 2006 4:25 pm
by Candamir
Exactly the same instructions and variables as in the FAQ. BTW, I searched for the file eelf_i386.c, and it didn't exist, but I found a file called eelf_is86.sh... Strange ??? I also tried to compile binutils with a different architecture as target (i386 instead of i586) and it didn't succeed, either. This is really strange... I also took a close look at the error and it is similar (IMHO) to the errors you get when you try to compile this code:
I haven't tried this, I only dimly remember of having a similar problem some time ago...
I must indeed say that this case is a very strange one. Haven't there been cases where building a cross-compiler in Cygwin caused so much trouble?
Re:GCC Cross Compiler error in Cygwin
Posted: Sun Apr 09, 2006 6:20 am
by Solar
There have, but they generally resolved into one of two categories - the toolchain being broken (e.g. outdated or partial Cygwin installations, mixing DJGPP and Cygwin tools, or previous dabbling with the toolchain), or deviating from the FAQ somewhere.
I would recommend a purge / retry: Uninstall both Cygwin and DJGPP, make sure all traces of them in the file system and the environment variables are gone. If you're bold, purge their entries in the registry, too. Then reboot, reinstall Cygwin from scratch, and go through the FAQ page as if you're doing this stuff the first time: Line by line, double-checking everything.
That's not saying you're incompetent or something. I'm doing the same thing if stuff keeps breaking on me - and I'm doing the same thing whenever a thread like this pops up, to make sure the instructions still work.
Re:GCC Cross Compiler error in Cygwin
Posted: Sun Apr 09, 2006 1:16 pm
by Candy
Judging by the errors I'd say that the compiler is doing its work but that the assembler behind it has no clue what's going on. Do you use the correct binutils? Did you change the path and are the new binutils being used?
Re:GCC Cross Compiler error in Cygwin
Posted: Sun Apr 09, 2006 2:56 pm
by Candamir
Why binutils? All this is about the first step described in the FAQ, compiling binutils and I'm using the standard binutils that come with Cygwin. But I'll follow Solar's advice and see...
Thanks
Re:GCC Cross Compiler error in Cygwin
Posted: Sun Apr 09, 2006 4:09 pm
by Candy
Candamir wrote:
Why binutils? All this is about the first step described in the FAQ, compiling binutils and I'm using the standard binutils that come with Cygwin. But I'll follow Solar's advice and see...
Thanks
uh - ok - nevermind, I thought you were further...
Re:GCC Cross Compiler error in Cygwin
Posted: Sun Apr 09, 2006 4:23 pm
by Candamir
Candy wrote:
uh - ok - nevermind, I thought you were further...
I wish ;D;)
Re:GCC Cross Compiler error in Cygwin
Posted: Sun Apr 09, 2006 4:41 pm
by Candamir
Hey, it still didn't work.
Still the same error...
BTW, is it also necessary to create a cross-compiler when working under Linux?
For now, I decided to keep my plain binary kernel, although I /do/ want to use elf... So if anyone hasn't anything better to do and likes to think about this problem
... I'll appreciate any help.
Thanks for your help so far,
Candamir
Re:GCC Cross Compiler error in Cygwin
Posted: Mon Apr 10, 2006 12:31 am
by Solar
Candamir wrote:
Hey, it still didn't work.
Still the same error...
After the complete cleanup / rebuild cycle?
Wow, that's strange...
BTW, is it also necessary to create a cross-compiler when working under Linux?
It is not
necessary at all. It just ensures that your toolchain does the right thing
by default (so that you cannot get trapped by forgetting certain options), it gives you "hard" warnings when you drag in stuff from your host environment, and its the proper first step towards a native toolchain.
You could always use native tools, and set the target explicitly. But once you start complaining about things not working, you'll probably hear the "cross-compiler" recommendation again.
For now, I decided to keep my plain binary kernel, although I /do/ want to use elf... So if anyone hasn't anything better to do and likes to think about this problem
... I'll appreciate any help.
The problem is definitely somewhere in your system setup, or the way you're following the docs (because it works for me here, on two different systems). That makes it pretty hard to find the bug.
If I find the time, I'll write the docs into a "proven good" script. If that fails too, the issue is with your host setup somewhere.
Re:GCC Cross Compiler error in Cygwin
Posted: Mon Apr 10, 2006 3:06 am
by Solar
OK, this script does as told in the FAQ, and
does work on a "clean" Cygwin installation:
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
My environment:
Code: Select all
$ uname -a
CYGWIN_NT-4.0 ---censored--- 1.5.19(0.150/4/2) 2006-01-20 13:28 i686 Cygwin
$ gcc -v
[blub]
gcc version 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125)
If above script does not work for you, please post the output of [tt]echo $PATH[/tt].
Re:GCC Cross Compiler error in Cygwin
Posted: Mon Apr 10, 2006 9:09 am
by Candamir
F*ck!!!
Still the same error... ??? >:(
My output from the following commands:
Code: Select all
$ uname -a
CYGWIN_NT-5.1 ---censored---(;)) 1.5.19(0.150/4/2) 2006-01-20 13:28 i686 Cygwin
Here the only difference is the version of CYGWIN_NT. Is that the Windows internal version number and 4.0 is 2k and 5.1 xp?
Code: Select all
gcc -v
[many things]
gcc version 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125)
Here everything indicates a strong cygwin build. I'll install Ubuntu on my test machine (finally got one
) and see what's going on.
Re:GCC Cross Compiler error in Cygwin
Posted: Mon Apr 10, 2006 1:08 pm
by Solar
Candamir wrote:
Is that the Windows internal version number and 4.0 is 2k and 5.1 xp?
4.0 is NT 4, 5.0 is 2k and 5.1 is XP. But I've done successful builds on XP already, too.
I'll install Ubuntu on my test machine (finally got one
) and see what's going on.
I predict that it'll work flawlessly. I assume something in your Windows / DJGPP / Cygwin setup is seriously broken.
Re:GCC Cross Compiler error in Cygwin
Posted: Sat Apr 15, 2006 2:53 pm
by Candamir
I just read the entire topic again and found myself not having posted one of the answers you requested:
Code: Select all
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:
After that, there comes my Windows path, but with /cygdrive/c/ instead of c:, but no reference to DJGPP nor Cygwin or any other compiler... uh, wait! Any other compiler... Could there be something wrong with Dev-C++ installed, although there's no reference to it in the path nor any other environment variable? I just thought about it right now, but anyway, I don't even use it, but I will next semester, so I installed it but haven't used it yet...
BTW, your bash script requires wget, just in case there's someone that don't knows about it... it must also be downloaded in the Cygwin setup.
Thanks...
Re:GCC Cross Compiler error in Cygwin
Posted: Sat Apr 15, 2006 8:34 pm
by B.E
The problem is that you are trying to get cygwin to do something at it was not designed for. cygwin was designed to be a UNIX-
like envirnment for windows. the default gcc compiler links the cygwin dll to all excutables that it compiles. because cygwin is not a UNIX emulator, rather a "bridge" between the two systems, the cygwin can only link and run COFF format executables. I have tried to build a basic kernal with cygwin, it added extra stuff to the binary so that my kernal would not run. I have not heard of anyone that uses cygwin for OS deving.
Candamir wrote:
If Cygwin wouldn't work, I could also install Linux on my test machine, although it would be very slow, but am I the only scr*wed one that still (has to) uses WinXP/Cygwin?
I don't know what specs you text machine has but it must be atleast a Pentium II 300MHz, and must atleast have 256 MB ram to run windows xp. dependng on which linux distro you install, linux will run faster and be more secure than windows xp. If you think linux will be too slow than try FreeBSD.
That aside, to find out what gcc you are using type at the cygwin shell
this will give you the path to which gcc cygwin is using.
BTW Did you unistall the default gcc compiler before you install the Cross compiler?
Re:GCC Cross Compiler error in Cygwin
Posted: Sat Apr 15, 2006 11:16 pm
by Candamir
Well, I obviously NEVER thought about installing WinXP on my test machine, the first and most important reason being _money_. But anyway, your answer sounds to me as if I had already managed to build a cross-compiler and this cross-compiler would output some file GRUB wouldn't load... Wrong. I can't even build /binutils/ for my cross-compiler... Anyway, I already tested Solar's script under another WinXP machine (Cygwin, obviously) without Dev-C++ and without DJGPP installed - ever.
But anyway, I'll try the entire thing again on Kubuntu (my bro's got his machine running with Kubuntu); can I use the exactly same bash script? Are binutils, bison, flex, gcc, make and wget automatically pre-installed on Ubuntu-based systems? (As it ain't my box, I can't just start downloading things...)
BTW, in the FAQ, it states that one must install bison and flex if one hasn't got a given GCC version (don't remember and FAQ access blocked), but I found Cygwin's version greater than the one mentioned there and as I tried the build process for the first time, it complained about some missing lex files... (and it worked after installing bison and flex)
Thank you anyway,
Candamir