cygwin script...

Programming, for all ages and all languages.
Post Reply
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

cygwin script...

Post 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
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

Re: cygwin script...

Post 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
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: cygwin script...

Post 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 ;)
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: cygwin script...

Post 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...
Every good solution is obvious once you've found it.
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

Re: cygwin script...

Post 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...
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

Re: cygwin script...

Post 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
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: cygwin script...

Post 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
Post Reply