cross compiler problem..

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

cross compiler problem..

Post by suthers »

I have finally managed to make a cross compiler through bash.
I uses this script:

Code: Select all

i586-elf-gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -o /MyOS/SOS/kernel.o -c /MyOS/SOS/kernel.c 
i586-elf-ld -T /MyOS/SOS/link.ld -O /MyOS/SOS/kernel.bin /MyOS/SOS/kernel_start.elf /MyOS/SOS/kernel.o 
exit 0 
But it gives me this:

Code: Select all

: No such file or directory
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s: Assembler messages:
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:4: Warning: .type pseudo-op
used outside of .def/.endef ignored.
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:4: Error: junk at end of lin
e, first unrecognized character is `i'
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:14: Warning: .size pseudo-op
 used outside of .def/.endef ignored.
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:14: Error: junk at end of li
ne, first unrecognized character is `i'
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:16: Warning: .type pseudo-op
 used outside of .def/.endef ignored.
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:16: Error: junk at end of li
ne, first unrecognized character is `o'
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:26: Warning: .size pseudo-op
 used outside of .def/.endef ignored.
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:26: Error: junk at end of li
ne, first unrecognized character is `o'
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:28: Warning: .type pseudo-op
 used outside of .def/.endef ignored.
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:28: Error: junk at end of li
ne, first unrecognized character is `u'
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:50: Warning: .size pseudo-op
 used outside of .def/.endef ignored.
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:50: Error: junk at end of li
ne, first unrecognized character is `u'
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:52: Warning: .type pseudo-op
 used outside of .def/.endef ignored.
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:52: Error: junk at end of li
ne, first unrecognized character is `k'
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:100: Warning: .size pseudo-o
p used outside of .def/.endef ignored.
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:100: Error: junk at end of l
ine, first unrecognized character is `k'
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:102: Warning: .type pseudo-o
p used outside of .def/.endef ignored.
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:102: Error: junk at end of l
ine, first unrecognized character is `k'
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:115: Warning: .size pseudo-o
p used outside of .def/.endef ignored.
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:115: Error: junk at end of l
ine, first unrecognized character is `k'
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:117: Warning: .type pseudo-o
p used outside of .def/.endef ignored.
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:117: Error: junk at end of l
ine, first unrecognized character is `a'
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:121: Warning: .size pseudo-o
p used outside of .def/.endef ignored.
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:121: Error: junk at end of l
ine, first unrecognized character is `a'
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:123: Warning: .type pseudo-o
p used outside of .def/.endef ignored.
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:123: Error: junk at end of l
ine, first unrecognized character is `i'
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:131: Warning: .size pseudo-o
p used outside of .def/.endef ignored.
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:131: Error: junk at end of l
ine, first unrecognized character is `i'
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:133: Warning: .type pseudo-o
p used outside of .def/.endef ignored.
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:133: Error: junk at end of l
ine, first unrecognized character is `i'
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:141: Warning: .size pseudo-o
p used outside of .def/.endef ignored.
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:141: Error: junk at end of l
ine, first unrecognized character is `i'
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:143: Warning: .type pseudo-o
p used outside of .def/.endef ignored.
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:143: Error: junk at end of l
ine, first unrecognized character is `h'
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:154: Warning: .size pseudo-o
p used outside of .def/.endef ignored.
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:154: Error: junk at end of l
ine, first unrecognized character is `h'
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:156: Warning: .type pseudo-o
p used outside of .def/.endef ignored.
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:156: Error: junk at end of l
ine, first unrecognized character is `s'
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:168: Warning: .size pseudo-o
p used outside of .def/.endef ignored.
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:168: Error: junk at end of l
ine, first unrecognized character is `s'
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:174: Warning: .type pseudo-o
p used outside of .def/.endef ignored.
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:174: Error: junk at end of l
ine, first unrecognized character is `k'
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:184: Warning: .size pseudo-o
p used outside of .def/.endef ignored.
/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/ccqkC2xT.s:184: Error: junk at end of l
ine, first unrecognized character is `k'
i586-elf-ld: cannot open /MyOS/SOS/kernel.o: No such file or directory
The file does exist, when i access directly using bash and not through a script it finds the file.
Anybody know what the proble is?

Thanks in advance,

Jules
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Post by Solar »

You are running on Cygwin. You access your files unter /MyOS/SOS/, but the error messages refer to "/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/"? How come?
when i access directly using bash and not through a script it finds the file.
Please provide a copy & paste or screenshot of how you cd' into the working directory, call the bash script, and then call directly.

Oh, and try adding "#!/bin/bash" to the top of the script, just to be sure.
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:

Post by suthers »

Here's my the batch file i use:

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\SOS\build.bashrc"
copy /b "bootloader.bin"+"a.out" "SOS v0.0.1.img"
"C:\cygwin\MyOS\bochs-2.0.2\bochs.exe" -q -f "C:\cygwin\MyOS\bochs-2.0.2\bochsrc.txt"
don't see anything wrong with it and i added #!/bin/bash to the beginning of the script and made no diference.
Thanks in advance,

Jules
jnc100
Member
Member
Posts: 775
Joined: Mon Apr 09, 2007 12:10 pm
Location: London, UK
Contact:

Post by jnc100 »

Solar wrote:You are running on Cygwin. You access your files unter /MyOS/SOS/, but the error messages refer to "/cygdrive/c/DOCUME~1/Jules/LOCALS~1/Temp/"? How come?
gcc uses your temporary directory to store the intermediate .s file it produces if you compile direct from .c to .o. You could use the -pipe option to bypass the production of an intermediate file. Don't think its the problem in this case though.

Regards,
John.
User avatar
Zenith
Member
Member
Posts: 224
Joined: Tue Apr 10, 2007 4:42 pm

Post by Zenith »

A few things:

So it seems like, the assembler's choking on the compiler's output... :?

Note that the path /MyOS/* is an absolute path, which points to <cygwin folder>/MyOS/*. Do you really want this? Remember that these kinds of Unix paths are only valid in the bash shell. Make sure you're using this shell!!!
: No such file or directory
Very suspicious...

And does the compile >work< (not just finds the file, but actually builds) when using the bash script?

I had to edit this because two people had already responded before I finished my reply... I am slooooow...
Last edited by Zenith on Fri Apr 25, 2008 3:55 pm, edited 1 time in total.
"Sufficiently advanced stupidity is indistinguishable from malice."
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

Post by suthers »

By adding pipe i got:

Code: Select all

: No such file or directory
{standard input}: Assembler messages:
{standard input}:4: Warning: .type pseudo-op used outside of .def/.endef ignored
.
{standard input}:4: Error: junk at end of line, first unrecognized character is
`i'
{standard input}:14: Warning: .size pseudo-op used outside of .def/.endef ignore
d.
{standard input}:14: Error: junk at end of line, first unrecognized character is
 `i'
{standard input}:16: Warning: .type pseudo-op used outside of .def/.endef ignore
d.
{standard input}:16: Error: junk at end of line, first unrecognized character is
 `o'
{standard input}:26: Warning: .size pseudo-op used outside of .def/.endef ignore
d.
{standard input}:26: Error: junk at end of line, first unrecognized character is
 `o'
{standard input}:28: Warning: .type pseudo-op used outside of .def/.endef ignore
d.
{standard input}:28: Error: junk at end of line, first unrecognized character is
 `u'
{standard input}:50: Warning: .size pseudo-op used outside of .def/.endef ignore
d.
{standard input}:50: Error: junk at end of line, first unrecognized character is
 `u'
{standard input}:52: Warning: .type pseudo-op used outside of .def/.endef ignore
d.
{standard input}:52: Error: junk at end of line, first unrecognized character is
 `k'
{standard input}:100: Warning: .size pseudo-op used outside of .def/.endef ignor
ed.
{standard input}:100: Error: junk at end of line, first unrecognized character i
s `k'
{standard input}:102: Warning: .type pseudo-op used outside of .def/.endef ignor
ed.
{standard input}:102: Error: junk at end of line, first unrecognized character i
s `k'
{standard input}:115: Warning: .size pseudo-op used outside of .def/.endef ignor
ed.
{standard input}:115: Error: junk at end of line, first unrecognized character i
s `k'
{standard input}:117: Warning: .type pseudo-op used outside of .def/.endef ignor
ed.
{standard input}:117: Error: junk at end of line, first unrecognized character i
s `a'
{standard input}:121: Warning: .size pseudo-op used outside of .def/.endef ignor
ed.
{standard input}:121: Error: junk at end of line, first unrecognized character i
s `a'
{standard input}:123: Warning: .type pseudo-op used outside of .def/.endef ignor
ed.
{standard input}:123: Error: junk at end of line, first unrecognized character i
s `i'
{standard input}:131: Warning: .size pseudo-op used outside of .def/.endef ignor
ed.
{standard input}:131: Error: junk at end of line, first unrecognized character i
s `i'
{standard input}:133: Warning: .type pseudo-op used outside of .def/.endef ignor
ed.
{standard input}:133: Error: junk at end of line, first unrecognized character i
s `i'
{standard input}:141: Warning: .size pseudo-op used outside of .def/.endef ignor
ed.
{standard input}:141: Error: junk at end of line, first unrecognized character i
s `i'
{standard input}:143: Warning: .type pseudo-op used outside of .def/.endef ignor
ed.
{standard input}:143: Error: junk at end of line, first unrecognized character i
s `h'
{standard input}:154: Warning: .size pseudo-op used outside of .def/.endef ignor
ed.
{standard input}:154: Error: junk at end of line, first unrecognized character i
s `h'
{standard input}:156: Warning: .type pseudo-op used outside of .def/.endef ignor
ed.
{standard input}:156: Error: junk at end of line, first unrecognized character i
s `s'
{standard input}:168: Warning: .size pseudo-op used outside of .def/.endef ignor
ed.
{standard input}:168: Error: junk at end of line, first unrecognized character i
s `s'
{standard input}:174: Warning: .type pseudo-op used outside of .def/.endef ignor
ed.
{standard input}:174: Error: junk at end of line, first unrecognized character i
s `k'
{standard input}:184: Warning: .size pseudo-op used outside of .def/.endef ignor
ed.
{standard input}:184: Error: junk at end of line, first unrecognized character i
s `k'
i586-elf-ld: cannot open /MyOS/SOS/kernel.o: No such file or directory
So what am i doing wrong?
Thanks in advance,

Jules
User avatar
Zenith
Member
Member
Posts: 224
Joined: Tue Apr 10, 2007 4:42 pm

Post by Zenith »

And where does this:

Code: Select all

i586-elf-gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -o /MyOS/SOS/kernel.o -c /MyOS/SOS/kernel.c
i586-elf-ld -T /MyOS/SOS/link.ld -O /MyOS/SOS/kernel.bin /MyOS/SOS/kernel_start.elf /MyOS/SOS/kernel.o
exit 0 
fit into your batch script?

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\SOS\build.bashrc"
copy /b "bootloader.bin"+"a.out" "SOS v0.0.1.img"
"C:\cygwin\MyOS\bochs-2.0.2\bochs.exe" -q -f "C:\cygwin\MyOS\bochs-2.0.2\bochsrc.txt" 
"Sufficiently advanced stupidity is indistinguishable from malice."
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

Post by suthers »

C:\cygwin\MyOS\SOS\build.bashrc contains my bash script.
Thanks in advance Jules
User avatar
Zenith
Member
Member
Posts: 224
Joined: Tue Apr 10, 2007 4:42 pm

Post by Zenith »

And does the compile >work< (not just finds the file, but actually builds) when using bash directly as opposed to your script? Otherwise, I don't think there should be a problem since your object/source paths are absolute to begin with.

Just trying to figure out if this is a directory problem or a compiler problem...
"Sufficiently advanced stupidity is indistinguishable from malice."
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

Post by suthers »

Ok i went straight through bash without using a script, and used the -pipe option i still got the same thing but without the "No Such File or Directory".
Though i think that has to be wrong because it tries to compile it anyway...
Any ideas whats wrong?
Thanks in advance,

Jules
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

The exact message is contained within the troubleshooting section of GCC Cross-Compiler, so I really suggest you have a look at that.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

Post by suthers »

Ok I've tried to rebuild my cross compiler too fix the problem, because i am definitely using the right compiler...
but now i get an error saying:
'Error: C compiler cannot create executables'
Any ideas whats gone wrong this time.
Thanks in advance,

Jules
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

My guess is that you have overwritten cygwin's toolchain with half a crosscompiling toolchain.
Since you probably don't use cygwin for other purposes, your best bet is to remove it completely, reinstall it, and then follow the tutorial again (this time, without omissions)
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

Post by suthers »

how do i make a my cross compiler without destroying the normal tool chain?
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:

Post by pcmattman »

That's what --prefix is for. It'll install to that folder (I use /usr/cross in cygwin, but you could use anything you want - even a subdirectory of your OS folders).
Post Reply