Page 1 of 1

cygwin script...

Posted: Wed Jul 09, 2008 10:35 am
by suthers
Firstly: Yay, I finally managed to build a cross compiler!!! YAY....
But I managed to build it, but not on my laptop, on my desktop that doesn't have all my laptops problems....
Well anyway here's my problem, I managed to build the cross compiler, but now I want to use it (surprisingly :lol: ).
So I use this as a batch file to assemble my bootloader, the ASM part of my kernel, call cygwin and pass it my script then make the floppy image... and finally start bochs to show me the results....
Here it is:

Code: Select all

"C:\cygwin\MyOS\nasm-0.98.35-win32\nasm.exe" -o bootloader.bin bootloader.asm -f bin
"C:\cygwin\MyOS\nasm-0.98.35-win32\nasm.exe" -o kernel_start.elf kernel_start.asm -f elf -w+gnu-elf-extensions
C:\cygwin\bin\bash.exe --login -i "C:\cygwin\MyOS\virginix\build.bashrc"
copy /b "bootloader.bin"+"a.out" "SOS v0.0.1.img"
"C:\Program Files\Bochs-2.3.6\bochs.exe" -q -f "C:\Program Files\Bochs-2.3.6\bochsrc.txt"
PAUSE
And then here's my bash screen:

Code: Select all

#!/bin/bash
i586-elf-gcc --Wall -O -fstrength-reduce -fomit-frame-pointer -fno-builtin -c -o /MyOS/virginix/kernel.o /MyOS/virginix/kernel.c
i586-elf-ld -Map /MyOS/virginix/kernel.map.txt -T /MyOS/virginix/link.ld -O /MyOS/virginix/kernel.bin /MyOS/virginix/kernel_start.elf /MyOS/virginix/kernel.o
exit 0 
But for some reason I get these errors:

Code: Select all

: No such file or directoryx/kernel.c
i586-elf-gcc: no input files
: No such file: No such file or directory
the names of the files which are not present are over by the other output for some reason...
I checked all the files referred to in the script and their all right....
Can't figure this out...
Thanks in advance,

Jules

Re: cygwin script...

Posted: Wed Jul 09, 2008 12:51 pm
by suthers
Weird, when I run gcc manually, it gives me cannot exec 'cc1' no such file or directory...
So if found it in "/lib/gcc/i686-pc-cygwin/" and moved it to "/bin"
Now when I enter the command manually it gives me the error: "unknown command line argument: "-fWall", I can't see that anywhere....
Same problem as before when I do it manually....
Anybody see any thing I'm doing wrong?
Thanks in advance,

Jules

Re: cygwin script...

Posted: Wed Jul 09, 2008 5:42 pm
by pcmattman
DO NOT move the things into /bin! Instead, add the path to your cross compiler "bin" directory to the PATH, like the wiki article says to do ;)

Re: cygwin script...

Posted: Fri Jul 11, 2008 6:21 am
by Solar
Sorry to repeat that, but the whole thing is a bit touchy - which is why I (and others) insist you follow the tutorial to the letter.

GCC is a front-end, which delegates the real work to various backends - in the case of C input, cpp (preprocessor), cc1 (compiler), as (assembler) and ld (linker). The cc1.exe you copied from /lib/gcc/i686-pc-cygwin, thus, is a C compiler targeting i686-pc-cygwin, i.e. not a cross-compiler at all...

Re: cygwin script...

Posted: Sat Jul 12, 2008 9:45 am
by suthers
CROSS CO0MPILER GOOOOOOOOOOOOOOOOODNESS YAY....
Sorry, I've been trying to build one for ages, but on my laptop, but seeing how messed up it is, I'm not surprised to see that it works on my desktop...
But thanks, managed to make it work and I've tested, it, it compiles with no errors/warnings (though the cross compiler gcc doesn't append _ to the beginning of its function names, so I just passed about half an hour deleting _ from my asm sources....) and best of all, the thing actually uses the addresses that ld gives it, so no more variables overwriting each other YAY
I've decided to just put all the files that contain my tools to the PATH variables, so now I don't need cygwin scripts, just use it through a batch file....
Now to see if it works on my laptop...
Thanks for all the help,

Jules

P.S. If I know my luck it won't work on my laptop :cry:

edit: also, weirdly the size of my kernel has significantly diminished.... from 24 to 13K... weird :?:
second edit: When emulating on bochs 2.3.7, the parallel port (LPT1) IRQ fires occasional...

Re: cygwin script...

Posted: Sat Jul 12, 2008 10:30 am
by suthers
update: surprisingly, it actually worked on my laptop.... :D
I still can't build a cross compiler on it, but I've got a working cross compiler on it, which is really all that counts, now I can get back to developing my OS yay :D
Thanks for all the help,

Jules

Re: cygwin script...

Posted: Sun Jul 13, 2008 5:15 am
by AJ
Hi,

I'm one of those who had major headaches getting a cross-compiler to work on Cygwin initially, despite being certain that I had followed all the steps. I finally got it working by using a different download mirror and have never had a problem since (since 4.1.2, I have updated my cross compiler on each GCC release).

I have never tried going back to the original mirror I was using to see if the download was actually broken. My messages to anyone stuck building the cross compiler are:
  • Persist
  • Follow the instructions to the letter (once you know it works, you can play with alternative settings / install locations).
  • Try a different mirror - it seemed to work for me!
Cheers,
Adam