Problem with cross-compiler compiling under Cygwin

Programming, for all ages and all languages.
Sham
Posts: 5
Joined: Wed Jan 26, 2011 11:47 am

Problem with cross-compiler compiling under Cygwin

Post by Sham »

Hello, I have an problem, obviously. Problem is when i try to make cross-compiler for cygwin i get message like this:

Code: Select all

Cannot find fixincl
Makefile:4213: recipe for target `stmp-fixinc' failed
make[1]: *** [stmp-fixinc] Error 1
make[1]: Leaving directory `/home/Jani/cross/source/build-gcc/gcc'
Makefile:3908: recipe for target `all-gcc' failed
make: *** [all-gcc] Error 2
and this is while i am trying to do "make all-gcc" if anyone is wondering. So does anyone have any idea what i should be doing so i can get around this error (Telling to go with linux is not answer here, because i want to use my more powerful computer for OSdeving) so, please help me and everyone who "will" answer this, Thank you!
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: Problem with cross-compiler compiling under Cygwin

Post by sortie »

Hi,

Hopefully there isn't a bug in the GCC cross-compiler article. I wrote the latest revision, but as I don't use Windows, I was unable to test it with Cygwin. I've heard of people succeeding since then, I think though. That said, my guess is that you are doing someone wrong. Are you following the tutorial's instructions to the letter? Please read it more carefully. Note that you cannot use the binutils and gcc source code that cygwin uses, you should use the official binutils and gcc source code.

The problem seems to be related to fixincludes, which is a script that GCC uses to forcefully "fix" headers on its target system (such that they are more standards compliant). You are building a fully freestanding compiler (i586-elf-gcc) and it has no system root that contains headers for your OS (it's not needed, yet), so fixincludes shouldn't be run. This makes me wonder if you have accidentally used the wrong configure line. Could you post the ./configure line you used for GCC with variables expanded? You remembered to pass --without-headers right? Additionally, please attach more output from Make, there may be something further up that you missed. Please also double-check that you have installed all the dependencies for GCC.

If you deviated somehow from the tutorial, please tell us immediately.

Edit:
cross-compiler for cygwin
Do you mean "cross-compiler inside the cygwin environment" - or are you trying to build a cygwin compiler that produces executables for cygwin? If you are doing the latter, this means you are not building a cross-compiler and things will explode much like this.
User avatar
iansjack
Member
Member
Posts: 4689
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Problem with cross-compiler compiling under Cygwin

Post by iansjack »

Telling to go with linux is not answer here, because i want to use my more powerful computer for OSdeving
I'm not quite sure what you mean here. TBH, you would find a lot more help available if you did use Linux, as that is what so many other people use. And it would probably make better use of your powerful computer than Cygwin does.

But each to their own. (It's just that it seems you may be labouring under a misapprehension.) If you want to use Cygwin that's fine but just be aware that support will not be as good as under Linux.
User avatar
Jvac
Member
Member
Posts: 58
Joined: Fri Mar 11, 2011 9:51 pm
Location: Bronx, NY

Re: Problem with cross-compiler compiling under Cygwin

Post by Jvac »

@sortie thank you it works on cygwin.

Code: Select all

$ /cygdrive/d//cygwin/usr/local/i386-jos-elf/bin/gcc --version
gcc (GCC) 4.5.1
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Code: Select all

$ cd jos

myPC ~/6.828/jos
$ make
+ as kern/entry.S
+ cc kern/entrypgdir.c
+ cc kern/init.c
+ cc kern/console.c
+ cc kern/monitor.c
+ cc kern/printf.c
+ cc kern/kdebug.c
+ cc lib/printfmt.c
+ cc lib/readline.c
+ cc lib/string.c
+ ld obj/kern/kernel
+ as boot/boot.S
+ cc -Os boot/main.c
+ ld boot/boot
boot block is 382 bytes (max 510)
+ mk obj/kern/kernel.img

myPC ~/6.828/jos
$
The OP is definitely making a mistake.

@skorpion

try these instructions mit tools with combination of the SortieWikiSample

It should work. Good Luck....
"The best way to prepare for programming is to write programs, and
to study great programs that other people have written." - Bill Gates


Think beyond Windows ReactOS®
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: Problem with cross-compiler compiling under Cygwin

Post by sortie »

Jvac: Uh. You are not using a cross-compiler! Try use i586-elf-gcc and friends instead.
User avatar
Jvac
Member
Member
Posts: 58
Joined: Fri Mar 11, 2011 9:51 pm
Location: Bronx, NY

Re: Problem with cross-compiler compiling under Cygwin

Post by Jvac »

sortie wrote:Jvac: Uh. You are not using a cross-compiler! Try use i586-elf-gcc and friends instead.

Code: Select all

my PC~

//this command invokes my cross compiler for the shell session
$ export PATH="/cygdrive/d/cygwin/usr/local/i386-jos-elf/bin:$PATH"


my PC~

//this command invokes the cross compiler to compile myOS
$ cd /cygdrive/d/cygwin/home/myOS//Configure/System/Integrator

my PC~
/cygdrive/d/cygwin/home/myOS//Configure/System/Integrator
$ make

rm -f *.map *.out core *_ctdt.s *..c Choices Choices.bin
rm -f [_a-m]*.[ilyCSso] [A-M]*.[ilyCSso]
rm -f [_n-z]*.[ilyCSso] [N-Z]*.[ilyCSso]
rm -f BROWSE browsefiles
rm -f tagfiles etags TAGS
rm -f msfiles mifiles
rm -f Choices *Star.cc *Star.h *.a
rm -f RAMDiskInfo.h vdisk0
rm -f zpipe
#rm -f D/[_a-m]* D/[A-M]*
#rm -f D/[_n-z]* D/[N-Z]*
rm -f D/*.dep
rm -f Make.dependencies

mkdir -p D && touch D/.exists
Creating Make.dependencies
Finished creating Make.dependencies

Generating BlockAllocatorStar
Generating CharacterInputStreamStar
Generating ClassStar
Generating ClassConstructorStar
Generating ConstructorDescriptorStar
Generating DomainStar
Generating FreeRunningTimerStar
Generating InputStreamStar
Generating MemoryObjectCacheStar
Generating MemoryObjectStar
Generating MemoryObjectViewStar
Generating MemoryRangeStar
Generating NameServerStar
Generating OutputStreamStar
Generating ObjectProxyManagerStar
Generating PhysicalMemoryRangeStar
Generating ProcessStar
Generating ProxyTableCopyStar
Generating SemaphoreStar
Generating SymbolicLinkStar
Generating SystemInterfaceStar
Generating TimerStar
Generating TimingInterfaceStar
Generating VersionObjectStar
Generating VMInterfaceStar
Generating RecordStreamStar
Generating FixedRecordFileStar
Generating FixedRecordStreamStar
Generating VariableRecordFileStar
Generating VariableRecordStreamStar
Generating RelativeRecordFileStar
Generating RecordFileStar
Generating IndexedRecordFileStar
Generating ELFDictionaryStar
Generating ELFContainerStar
Generating DiskStar
Generating FileObjectStar
Generating FileSystemInterfaceStar
Generating MemoryObjectContainerStar
Generating MemoryObjectDictionaryStar
Generating MountTableStar
Generating PersistentMemoryObjectStar
Generating PersistentArrayStar
Generating PersistentArrayStreamStar
Generating AutoloadPersistentObjectStar
Generating PersistentClassStar
Generating FileIndexStar
Generating PersistentIntArrayStar
Compiling BlockAllocatorStar.cc
You were saying?

Please explain
"The best way to prepare for programming is to write programs, and
to study great programs that other people have written." - Bill Gates


Think beyond Windows ReactOS®
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:

Re: Problem with cross-compiler compiling under Cygwin

Post by Combuster »

You didn't demonstrate anything.

I still don't see explicit invocations of 1586-elf-gcc - or even i386-jos-elf-gcc.

(Therefore it didn't happen... :wink:)
"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
Jvac
Member
Member
Posts: 58
Joined: Fri Mar 11, 2011 9:51 pm
Location: Bronx, NY

Re: Problem with cross-compiler compiling under Cygwin

Post by Jvac »

@Combuster

i386-jos-elf-gcc example, believe me it works
Attachments
jos.jpg
"The best way to prepare for programming is to write programs, and
to study great programs that other people have written." - Bill Gates


Think beyond Windows ReactOS®
User avatar
Jvac
Member
Member
Posts: 58
Joined: Fri Mar 11, 2011 9:51 pm
Location: Bronx, NY

Re: Problem with cross-compiler compiling under Cygwin

Post by Jvac »

In fact just run into a problem with my ARM i686-pc cross using cygwin.

Code: Select all


myPC ~ myOS/Configure/Libraries/GeneralPurpose/arm
$ make

Creating Make.dependencies
Finished creating Make.dependencies
Compiling ../../../../Libraries/GeneralPurpose/Portable/Assert.cc
i686-pc-linux-gnu-g++.exe: error: unrecognized command line option '-mpoke-function-name'
i686-pc-linux-gnu-g++.exe: error: unrecognized command line option '-mapcs'
i686-pc-linux-gnu-g++.exe: error: unrecognized command line option '-mfpu=fpa'
../../../ARM.mk:84: recipe for target `Assert.o' failed
make: *** [Assert.o] Error 1
According to the 3.17.2 ARM Options on the gcc website these are ok.

here are the ARMOPTS from my make file.

Code: Select all

ARMOPTS = -msoft-float -mpoke-function-name -mapcs -march=armv5te -mfpu=fpa -fnon-call-exceptions -fasynchronous-unwind-tables
Any idea guys what is causing this?
"The best way to prepare for programming is to write programs, and
to study great programs that other people have written." - Bill Gates


Think beyond Windows ReactOS®
User avatar
xenos
Member
Member
Posts: 1119
Joined: Thu Aug 11, 2005 11:00 pm
Libera.chat IRC: xenos1984
Location: Tartu, Estonia
Contact:

Re: Problem with cross-compiler compiling under Cygwin

Post by xenos »

Are you kidding? You are giving ARM options to an i686-pc-linux-gnu targeted compiler? i686? Seriously?
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS
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:

Re: Problem with cross-compiler compiling under Cygwin

Post by Combuster »

Jvac wrote:i386-jos-elf-gcc example
screenshot wrote:cc (...)
cc (...)
cc (...)
Image

It says "cc", not "i386-jos-elf-gcc". i.e. the same as with XenOS: Learn to invoke the correct compiler.
"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
Owen
Member
Member
Posts: 1700
Joined: Fri Jun 13, 2008 3:21 pm
Location: Cambridge, United Kingdom
Contact:

Re: Problem with cross-compiler compiling under Cygwin

Post by Owen »

It says "+ cc", which tells me that the standard makefile output was suppressed and "pretty" output used instead. I.E. the rule looks like

Code: Select all

%.o: %.c
    @echo +cc $@
    @my-gcc -c -o $@ $< $(CFLAGS)
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:

Re: Problem with cross-compiler compiling under Cygwin

Post by Combuster »

Or it looks like... a better implementation?

Code: Select all

%.o: %.c
        @echo + $(CC) $@
        @$(CC) $(CFLAGS)  $< -o $@
After all, the only thing he demonstrated is an attempt at adding the crosscompiler to the path and being unable to read. (both error messages and my earlier point that he didn't prove anything) :wink:
"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
Jvac
Member
Member
Posts: 58
Joined: Fri Mar 11, 2011 9:51 pm
Location: Bronx, NY

Re: Problem with cross-compiler compiling under Cygwin

Post by Jvac »

Combuster wrote:Or it looks like... a better implementation?

Code: Select all

%.o: %.c
        @echo + $(CC) $@
        @$(CC) $(CFLAGS)  $< -o $@
After all, the only thing he demonstrated is an attempt at adding the crosscompiler to the path and being unable to read. (both error messages and my earlier point that he didn't prove anything) :wink:
Combuster wrote:It says "cc", not "i386-jos-elf-gcc". i.e. the same as with XenOS: Learn to invoke the correct compiler.
Guess you are right. Back to the lab to re-study compilers.

Thanks for the explanation guys.

Ill be back....... :)
"The best way to prepare for programming is to write programs, and
to study great programs that other people have written." - Bill Gates


Think beyond Windows ReactOS®
User avatar
Jvac
Member
Member
Posts: 58
Joined: Fri Mar 11, 2011 9:51 pm
Location: Bronx, NY

Re: Problem with cross-compiler compiling under Cygwin

Post by Jvac »

My mistake :mrgreen:

I forgot to invoke the command make v=1 to call for my i386-jos-elf compiler.

Code: Select all



myPC ~
$ cd 6.828

myPC ~/6.828
$ cd jos

my PC ~/6.828/jos
$ make v=1
echo "   -O1 -fno-builtin -I. -MD -fno-omit-frame-pointer -Wall -Wno-format -Wno                                                                                                    -unused -Werror -gstabs -m32 -fno-stack-protector -DJOS_KERNEL -gstabs" | cmp -s                                                                                                     obj/.vars.KERN_CFLAGS || echo "   -O1 -fno-builtin -I. -MD -fno-omit-frame-poin                                                                                                    ter -Wall -Wno-format -Wno-unused -Werror -gstabs -m32 -fno-stack-protector -DJO                                                                                                    S_KERNEL -gstabs" > obj/.vars.KERN_CFLAGS
+ as kern/entry.S
i386-jos-elf-gcc -pipe -nostdinc    -O1 -fno-builtin -I. -MD -fno-omit-frame-poi                                                                                                    nter -Wall -Wno-format -Wno-unused -Werror -gstabs -m32 -fno-stack-protector -DJ                                                                                                    OS_KERNEL -gstabs -c -o obj/kern/entry.o kern/entry.S
+ cc kern/entrypgdir.c
i386-jos-elf-gcc -pipe -nostdinc    -O1 -fno-builtin -I. -MD -fno-omit-frame-poi                                                                                                    nter -Wall -Wno-format -Wno-unused -Werror -gstabs -m32 -fno-stack-protector -DJ                                                                                                    OS_KERNEL -gstabs -c -o obj/kern/entrypgdir.o kern/entrypgdir.c
echo "" | cmp -s obj/.vars.INIT_CFLAGS || echo "" > obj/.vars.INIT_CFLAGS
+ cc kern/init.c
i386-jos-elf-gcc -pipe -nostdinc    -O1 -fno-builtin -I. -MD -fno-omit-frame-poi                                                                                                    nter -Wall -Wno-format -Wno-unused -Werror -gstabs -m32 -fno-stack-protector -DJ                                                                                                    OS_KERNEL -gstabs  -c -o obj/kern/init.o kern/init.c
+ cc kern/console.c
i386-jos-elf-gcc -pipe -nostdinc    -O1 -fno-builtin -I. -MD -fno-omit-frame-poi                                                                                                    nter -Wall -Wno-format -Wno-unused -Werror -gstabs -m32 -fno-stack-protector -DJ                                                                                                    OS_KERNEL -gstabs -c -o obj/kern/console.o kern/console.c
+ cc kern/monitor.c
i386-jos-elf-gcc -pipe -nostdinc    -O1 -fno-builtin -I. -MD -fno-omit-frame-poi                                                                                                    nter -Wall -Wno-format -Wno-unused -Werror -gstabs -m32 -fno-stack-protector -DJ                                                                                                    OS_KERNEL -gstabs -c -o obj/kern/monitor.o kern/monitor.c
+ cc kern/printf.c
i386-jos-elf-gcc -pipe -nostdinc    -O1 -fno-builtin -I. -MD -fno-omit-frame-poi                                                                                                    nter -Wall -Wno-format -Wno-unused -Werror -gstabs -m32 -fno-stack-protector -DJ                                                                                                    OS_KERNEL -gstabs -c -o obj/kern/printf.o kern/printf.c
+ cc kern/kdebug.c
i386-jos-elf-gcc -pipe -nostdinc    -O1 -fno-builtin -I. -MD -fno-omit-frame-poi                                                                                                    nter -Wall -Wno-format -Wno-unused -Werror -gstabs -m32 -fno-stack-protector -DJ                                                                                                    OS_KERNEL -gstabs -c -o obj/kern/kdebug.o kern/kdebug.c
+ cc lib/printfmt.c
i386-jos-elf-gcc -pipe -nostdinc    -O1 -fno-builtin -I. -MD -fno-omit-frame-poi                                                                                                    nter -Wall -Wno-format -Wno-unused -Werror -gstabs -m32 -fno-stack-protector -DJ                                                                                                    OS_KERNEL -gstabs -c -o obj/kern/printfmt.o lib/printfmt.c
+ cc lib/readline.c
i386-jos-elf-gcc -pipe -nostdinc    -O1 -fno-builtin -I. -MD -fno-omit-frame-poi                                                                                                    nter -Wall -Wno-format -Wno-unused -Werror -gstabs -m32 -fno-stack-protector -DJ                                                                                                    OS_KERNEL -gstabs -c -o obj/kern/readline.o lib/readline.c
+ cc lib/string.c
i386-jos-elf-gcc -pipe -nostdinc    -O1 -fno-builtin -I. -MD -fno-omit-frame-poi                                                                                                    nter -Wall -Wno-format -Wno-unused -Werror -gstabs -m32 -fno-stack-protector -DJ                                                                                                    OS_KERNEL -gstabs -c -o obj/kern/string.o lib/string.c
echo "-m elf_i386 -T kern/kernel.ld -nostdlib" | cmp -s obj/.vars.KERN_LDFLAGS |                                                                                                    | echo "-m elf_i386 -T kern/kernel.ld -nostdlib" > obj/.vars.KERN_LDFLAGS
+ ld obj/kern/kernel
i386-jos-elf-ld -o obj/kern/kernel -m elf_i386 -T kern/kernel.ld -nostdlib obj/k                                                                                                    ern/entry.o obj/kern/entrypgdir.o obj/kern/init.o obj/kern/console.o obj/kern/mo                                                                                                    nitor.o obj/kern/printf.o obj/kern/kdebug.o  obj/kern/printfmt.o  obj/kern/readl                                                                                                    ine.o  obj/kern/string.o /usr/local/lib/gcc/i386-jos-elf/4.5.1/libgcc.a -b binar                                                                                                    y
i386-jos-elf-objdump -S obj/kern/kernel > obj/kern/kernel.asm
i386-jos-elf-nm -n obj/kern/kernel > obj/kern/kernel.sym
+ as boot/boot.S
i386-jos-elf-gcc -pipe -nostdinc    -O1 -fno-builtin -I. -MD -fno-omit-frame-poi                                                                                                    nter -Wall -Wno-format -Wno-unused -Werror -gstabs -m32 -fno-stack-protector -DJ                                                                                                    OS_KERNEL -gstabs -c -o obj/boot/boot.o boot/boot.S
+ cc -Os boot/main.c
i386-jos-elf-gcc -pipe -nostdinc    -O1 -fno-builtin -I. -MD -fno-omit-frame-poi                                                                                                    nter -Wall -Wno-format -Wno-unused -Werror -gstabs -m32 -fno-stack-protector -DJ                                                                                                    OS_KERNEL -gstabs -Os -c -o obj/boot/main.o boot/main.c
+ ld boot/boot
i386-jos-elf-ld -m elf_i386 -N -e start -Ttext 0x7C00 -o obj/boot/boot.out obj/b                                                                                                    oot/boot.o obj/boot/main.o
i386-jos-elf-objdump -S obj/boot/boot.out >obj/boot/boot.asm
i386-jos-elf-objcopy -S -O binary -j .text obj/boot/boot.out obj/boot/boot
perl boot/sign.pl obj/boot/boot
boot block is 382 bytes (max 510)
+ mk obj/kern/kernel.img
dd if=/dev/zero of=obj/kern/kernel.img~ count=10000 2>/dev/null
dd if=obj/boot/boot of=obj/kern/kernel.img~ conv=notrunc 2>/dev/null
dd if=obj/kern/kernel of=obj/kern/kernel.img~ seek=1 conv=notrunc 2>/dev/null
mv obj/kern/kernel.img~ obj/kern/kernel.img

myPC ~/6.828/jos
$

Sweet :P
"The best way to prepare for programming is to write programs, and
to study great programs that other people have written." - Bill Gates


Think beyond Windows ReactOS®
Post Reply