Yes, it could. Although I shudder thinking of the work doing all the cross-posts.Also, could this conversation be moved to its own thread? ;D
GCC Cross-Compiler issues
GCC Cross-Compiler issues
Ytinasni wrote in Writing a GRUB kernel:

Every good solution is obvious once you've found it.
Re:GCC Cross-Compiler issues
beyond infinity wrote:
Curufir wrote:
Solar wrote:Ha - a piece of cake! tell me what to do despite all the reading if it insists on problems with 'libibiblio.o' and sorta. I've gotten only so much as a fart compiled in cygwin when trying to build a cross compiler for doing some osdeving in lunch break at work.![]()
Colonel Kernel wrote:I admit that I haven't checked the validity of the Wiki page for a couple of weeks, but last time I did I made sure it worked exactly as described on three different machines.
I will verify the validity with a current source set ASAP.
I then posted that I verified the correctness of the Wiki how-to with current versions of Cygwin, binutils, and GCC, in the process offending beyond infinity without meaning to, which led to a couple of not-so-friendly posts, which have been sorted out in the meantime so I see no point in repeating them here.FWIW, I followed those instructions many months ago and didn't have any trouble creating a cross-compiler on Cygwin. I may have installed flex & bison with Cygwin just as a matter of habit though.
Curufir wrote:
I had problems trying to compile the C++ package a while ago (I ended up building only the C compiler). Unfortunately I can't remember the exact version it was screwed up on.
Every good solution is obvious once you've found it.
Re:GCC Cross-Compiler issues
The Unbeliever wrote:
Solar wrote:Okay, I'm getting there. I've downloaded, and 'make'd binutils 2.15. I've tried doing it with GCC, but it goes so far, seems to work, then spits out thousands upon thousands of errors (exceeding my screen buffer of 9999 lines). Here's a copy of the last few.
Any ideas? Thanks for the help so far, you've been great.Code: Select all
insn-conditions.c:2665: error: initializer element is not constant insn-conditions.c:2665: error: (near initialization for `insn_conditions[483]') insn-conditions.c:2668: error: initializer element is not constant insn-conditions.c:2668: error: (near initialization for `insn_conditions[484]') insn-conditions.c:2670: error: initializer element is not constant insn-conditions.c:2670: error: (near initialization for `insn_conditions[485]') insn-conditions.c:2672: error: initializer element is not constant insn-conditions.c:2672: error: (near initialization for `insn_conditions[486]') insn-conditions.c:2674: error: initializer element is not constant insn-conditions.c:2674: error: (near initialization for `insn_conditions[487]') insn-conditions.c:2676: error: initializer element is not constant insn-conditions.c:2676: error: (near initialization for `insn_conditions[488]') insn-conditions.c:2678: error: initializer element is not constant insn-conditions.c:2678: error: (near initialization for `insn_conditions[489]') insn-conditions.c:2679:5: missing terminating " character insn-conditions.c:2680: error: stray '\' in program insn-conditions.c:2680: error: parse error before "n" insn-conditions.c:2682: error: stray '\' in program insn-conditions.c:2684: error: stray '\' in program insn-conditions.c:2686: error: stray '\' in program insn-conditions.c:2688: error: stray '\' in program insn-conditions.c:2689:40: missing terminating " character insn-conditions.c:2690: warning: missing initializer insn-conditions.c:2690: warning: (near initialization for `insn_conditions[490]. value') insn-conditions.c:2690: error: initializer element is not constant insn-conditions.c:2690: error: (near initialization for `insn_conditions[490]') insn-conditions.c:2697: error: initializer element is not constant insn-conditions.c:2697: error: (near initialization for `insn_conditions[491]') make[1]: *** [insn-conditions.o] Error 1 make[1]: Leaving directory `/usr/src/build-gcc/gcc' make: *** [all-gcc] Error 2
beyond infinity wrote:Sorry, no... first time I get to see that. (And here I was, considering that how-to to be watertight for over a year... )Any ideas?
Poseidon wrote:@unbeliever: Hm. The only hint I can give is: try to download the package once again. Maybe the download 's got a hiccup.
If this oesn't help either, then I am clueless too. For me, the binutils compile went just fine.
The Unbeliever wrote:i had also problems with compiling it, don't remember which errors it said to me.
beyond infinity wrote:Thanks, I'll throw a six and start again, maybe I made a typo at some point, or downloaded the wrong file.
If other people have got the thing working, the odds are that I've made a mistake somewhere.![]()
Well - here I go with the next attempt at making a cross compiler (binutils are already compiled for elf target):
environment: w2k with cygwin (bison & flex & gcc present)
1. downloaded gcc-3.4.3.tar.bz2 (previously I have only fetched gcc-3.4.3-core.tar.bz2)
2. created directory build_gcc
3. unpacked gcc package.
4. typed: export PREFIX=/usr/cross
5. typed: export TARGET=i586-elf
6. changed to directory build_gcc.
7. typed: export PATH=$PATH:$PREFIX/bin
8. typed: ../gcc-3.4.3/configure --target=$TARGET --prefix=$PREFIX --disable-nls --enable-languages=c --without-headers --with-newlib
the configure command went fine without issues.
9. typed: make all-gcc install-gcc
currently it does what ever checks make is doing for the target make all-gcc.
too long msg - cnt'd
Every good solution is obvious once you've found it.
Re:GCC Cross-Compiler issues
beyond infinity continued:
Here is the result of the attempt:
all went fine until this:
I admit that I have mixed up libibiblio with libiberty (which has caused me some trouble too) - and that this error is not the error which I have got with gcc-3.4.3-core - but the error remains. The steps I have taken are written in the post above. If they are faulty pls tell. I have followed the guide step by step (and it isn't too much to read is it?)Code: Select all
EXTRA_MULTILIB_PARTS='' \ SHLIB_LINK='' \ SHLIB_INSTALL='' \ SHLIB_EXT='' \ SHLIB_MULTILIB='' \ SHLIB_MKMAP='' \ SHLIB_MKMAP_OPTS='' \ SHLIB_MAPFILES='' \ SHLIB_NM_FLAGS='-pg' \ MULTILIB_OSDIRNAMES='' \ mkinstalldirs='/bin/sh ../../gcc-3.4.3/gcc/mkinstalldirs' \ /bin/sh mklibgcc > tmp-libgcc.mk mv tmp-libgcc.mk libgcc.mk TARGET_CPU_DEFAULT="" \ HEADERS="ansidecl.h" DEFINES="" \ /bin/sh ../../gcc-3.4.3/gcc/mkconfig.sh tconfig.h /cygdrive/d/build_gcc/gcc/xgcc -B/cygdrive/d/build_gcc/gcc/ -B/usr/cross/i586-el f/bin/ -B/usr/cross/i586-elf/lib/ -isystem /usr/cross/i586-elf/include -isystem /usr/cross/i586-elf/sys-include -O2 -DIN_GCC -DCROSS_COMPILE -W -Wall -Wwrite- strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isyste m ./include -I. -I. -I../../gcc-3.4.3/gcc -I../../gcc-3.4.3/gcc/. -I../../gcc-3 .4.3/gcc/../include -g0 -finhibit-size-directive -fno-inline-functions -fno-ex ceptions -fno-zero-initialized-in-bss -fno-unit-at-a-time -fPIC \ -Dinhibit_libc -c ../../gcc-3.4.3/gcc/crtstuff.c -DCRT_BEGIN \ -o crtbegin.o /cygdrive/c/DOKUME~1/XXX/LOKALE~1/Temp/ccR6GwaQ.s: Assembler messages: /cygdrive/c/DOKUME~1/XXX/LOKALE~1/Temp/ccR6GwaQ.s:2: Error: junk at end of l ine, first unrecognized character is `,' /cygdrive/c/DOKUME~1/XXX/LOKALE~1/Temp/ccR6GwaQ.s:4: Warning: .type pseudo-o p used outside of .def/.endef ignored. /cygdrive/c/DOKUME~1/XXX/LOKALE~1/Temp/ccR6GwaQ.s:4: Error: junk at end of l ine, first unrecognized character is `_' /cygdrive/c/DOKUME~1/XXX/LOKALE~1/Temp/ccR6GwaQ.s:7: Error: junk at end of l ine, first unrecognized character is `,' /cygdrive/c/DOKUME~1/XXX/LOKALE~1/Temp/ccR6GwaQ.s:9: Warning: .type pseudo-o p used outside of .def/.endef ignored. /cygdrive/c/DOKUME~1/XXX/LOKALE~1/Temp/ccR6GwaQ.s:9: Error: junk at end of l ine, first unrecognized character is `_' /cygdrive/c/DOKUME~1/XXX/LOKALE~1/Temp/ccR6GwaQ.s:12: Error: junk at end of line, first unrecognized character is `,' /cygdrive/c/DOKUME~1/XXX/LOKALE~1/Temp/ccR6GwaQ.s:14: Warning: .type pseudo- op used outside of .def/.endef ignored. /cygdrive/c/DOKUME~1/XXX/LOKALE~1/Temp/ccR6GwaQ.s:14: Error: junk at end of line, first unrecognized character is `_' /cygdrive/c/DOKUME~1/XXX/LOKALE~1/Temp/ccR6GwaQ.s:16: Error: junk at end of line, first unrecognized character is `,' /cygdrive/c/DOKUME~1/XXX/LOKALE~1/Temp/ccR6GwaQ.s:18: Warning: .type pseudo- op used outside of .def/.endef ignored. /cygdrive/c/DOKUME~1/XXX/LOKALE~1/Temp/ccR6GwaQ.s:18: Error: junk at end of line, first unrecognized character is `_' /cygdrive/c/DOKUME~1/XXX/LOKALE~1/Temp/ccR6GwaQ.s:23: Warning: .type pseudo- op used outside of .def/.endef ignored. /cygdrive/c/DOKUME~1/XXX/LOKALE~1/Temp/ccR6GwaQ.s:23: Error: junk at end of line, first unrecognized character is `_' /cygdrive/c/DOKUME~1/XXX/LOKALE~1/Temp/ccR6GwaQ.s:26: Error: junk at end of line, first unrecognized character is `,' /cygdrive/c/DOKUME~1/XXX/LOKALE~1/Temp/ccR6GwaQ.s:28: Warning: .type pseudo- op used outside of .def/.endef ignored. /cygdrive/c/DOKUME~1/XXX/LOKALE~1/Temp/ccR6GwaQ.s:28: Error: junk at end of line, first unrecognized character is `p' /cygdrive/c/DOKUME~1/XXX/LOKALE~1/Temp/ccR6GwaQ.s:31: Error: unknown pseudo- op: `.local' /cygdrive/c/DOKUME~1/XXX/LOKALE~1/Temp/ccR6GwaQ.s:32: Error: junk at end of line, first unrecognized character is `,' /cygdrive/c/DOKUME~1/XXX/LOKALE~1/Temp/ccR6GwaQ.s:35: Warning: .type pseudo- op used outside of .def/.endef ignored. /cygdrive/c/DOKUME~1/XXX/LOKALE~1/Temp/ccR6GwaQ.s:35: Error: junk at end of line, first unrecognized character is `_' /cygdrive/c/DOKUME~1/XXX/LOKALE~1/Temp/ccR6GwaQ.s:77: Error: unknown pseudo- op: `.local' /cygdrive/c/DOKUME~1/XXX/LOKALE~1/Temp/ccR6GwaQ.s:78: Error: junk at end of line, first unrecognized character is `,' /cygdrive/c/DOKUME~1/XXX/LOKALE~1/Temp/ccR6GwaQ.s:80: Warning: .type pseudo- op used outside of .def/.endef ignored. /cygdrive/c/DOKUME~1/XXX/LOKALE~1/Temp/ccR6GwaQ.s:80: Error: junk at end of line, first unrecognized character is `f' make[1]: *** [crtbegin.o] Error 1 make[1]: Leaving directory `/cygdrive/d/build_gcc/gcc' make: *** [all-gcc] Error 2
Despite this I have been gruffy and inpolite. I have acted in an irritably way. So I ask Solar for forgiving.
tnx @ bubach, haven't seen that. *rofl*
Every good solution is obvious once you've found it.
Re:GCC Cross-Compiler issues
Pype.Clicker wrote:
Solar wrote:From The Unbeliever:Any ideas? Thanks for the help so far, you've been great.Code: Select all
insn-conditions.c:2665: error: initializer element is not constant insn-conditions.c:2665: error: (near initialization for ... insn-conditions.c:2680: error: stray '\' in program insn-conditions.c:2680: error: parse error before "n" insn-conditions.c:2682: error: stray '\' in program insn-conditions.c:2684: error: stray '\' in program insn-conditions.c:2686: error: stray '\' in program insn-conditions.c:2688: error: stray '\' in program insn-conditions.c:2689:40: missing terminating " character insn-conditions.c:2690: warning: missing initializer insn-conditions.c:2690: warning: (near initialization for `insn_conditions[490]. value') make[1]: *** [insn-conditions.o] Error 1 make[1]: Leaving directory `/usr/src/build-gcc/gcc' make: *** [all-gcc] Error 2
That sounds like a wrong-gcc-version problem to me. (e.g. newer GCC doesn't at all likes things like
Code: Select all
printf("hello world");
while older GCC still accepted to translate it into
Code: Select all
printf("hello\nworld");
Pype.Clicker wrote:@ BI:
Still unable to reproduce.
But this here looks suspicious:
Code: Select all
/cygdrive/c/DOKUME~1/XXX/LOKALE~1/Temp/ccR6GwaQ.s:2: Error: junk at end of line, first unrecognized character is `,'
This looks as if the as used is configured for a different target than the GCC generating the assembler code.
I've seen this error message before when people tried to assemble the BareBones assembler with a GNU as not targeted at ELF, which chokes on .comm stack, STACKSIZE, 32 as the third argument to .comm is only recognized for ELF targets.
Would you mind double-checking your binutils setup?
beyond infinity wrote:could it be that BI should cross-build the whole binutils (as, ld, etc.) before he attemps to cross-compile gcc, but failed to do so ?
I've managed to cross compile the binutils. But it is pretty possible that there 's borked something, so I'm building them again.
I just don't get, why it does compiling and linking fine all the while for about a quarter of an hour and then, before finishing, goes haywire with assembler stuff??!!
Further: isn't the cross-compiled binutils stuff intended to link cross compiled elf binaries? To my understanding, the cross-compiler outputs elf-stuff but in itself should be deployed as a pe binary - if being run on a windoes/cygwin machine.
Anyway ... it's happily compiling now.
Every good solution is obvious once you've found it.
Re:GCC Cross-Compiler issues
beyond infinity wrote:
beyond infinity wrote:Odd ...
despite indicating PREFIX=/usr/cross, all the binutils binaries are stuffed into /bin, with an i586-elf- prefix. hm. Gonna check this. Upon previous attempt there 's been that directory /usr/cross, with the binaries in it.
Well, let's see.
BTW, I've reinstalled cygwin binutils yesterday just to make sure they are the correct ones, but it still refused to build the file in question.
And there still shows up the same error as shown above, despite rebuilding the binutils. *me scratches head*
Now, let's see: what could be wrong there? Permissions on directories? redirecto(symlink) pointing to the wrong executable?
Ytinasni wrote:again me .... I could as well append to the previous message, but here I've noticed something:
in the very last paragraph of config run, it spits out lines along: checking for i586-elf-ld: i586-elf-ld, where previously it gave simply: checking for i586-elf-ld: no. It could be a difference.
[edit]crap happens. It still gives this odd error.[/edit]
From the wiki page:9. typed: make all-gcc install-gcc
Since we could not select a plain ELF target, GCC stubbornly insists on compiling some OS dependent libraries, which of course does not work because we don't have them in our OS. The use of the -k option to make forces the build process to continue nevertheless, ignoring the errors. So far, this seems to work.
Discussing the line immediately preceding it (emphasis mine)
make -k all-gcc install-gcc
Does this help at all?
[edit]Also, could this conversation be moved to its own thread? ;D[/edit]
Every good solution is obvious once you've found it.
Re:GCC Cross-Compiler issues
beyond infinity wrote:
And I am still clueless as I am utterly unable to reproduce aforementioned errors (yet still trying)... :-\
Now we have a seperate thread for figuring out people's problems with the GCC Cross-Compiler how-to.I wouldna mind if we move this to a thread of its own.
as for the hint: I gonna give it a check.![]()
And I am still clueless as I am utterly unable to reproduce aforementioned errors (yet still trying)... :-\
Every good solution is obvious once you've found it.
-
distantvoices
- Member

- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
- Contact:
Re:GCC Cross-Compiler issues
I'm compiling at the moment. Now i have a proper /usr/cross & /usr/cross/bin -- all filled in with fine nice executables and other files.
Maybe the -k option does the trick. *hm*
Maybe the -k option does the trick. *hm*
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
BlueillusionOS iso image
- Pype.Clicker
- Member

- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:GCC Cross-Compiler issues
hey, Solar, seems you haven't noticed the "split" button 
Re:GCC Cross-Compiler issues
*groan*
Actually I've seen it, but didn't think about what it might be good for.
::)
OK, next time.

Actually I've seen it, but didn't think about what it might be good for.
::)
OK, next time.
Every good solution is obvious once you've found it.
-
distantvoices
- Member

- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
- Contact:
Re:GCC Cross-Compiler issues
Ha!
I've got it. It has compiled, linked and installed.
The one important thing you *HAVE* to do is:
before giving make a kick!
You have to *create* these directories, because make won't do it for you, if I've got this behaviour right. I've deployed binutils before creating these directories, and in a sudden, the files appeared in /bin, where I didn't expect them to be inspite of the PREFIX given in configure.
So in short: if you experience weird assembler messages near the end of compilation, maybe creating the directories /usr/cross and /usr/cross/bin beforehand is of help? For me it is, and I didn't need -k.
I've also extended $PATH with /usr/cross/bin from the beginning of the binutils-deployment on.
My apologies to Solar. This strangeness isn't necessarily to show up in each and every config.
Stay safe.
I've got it. It has compiled, linked and installed.
The one important thing you *HAVE* to do is:
Code: Select all
mkdir /usr/cross
mkdir /usr/cross/bin
You have to *create* these directories, because make won't do it for you, if I've got this behaviour right. I've deployed binutils before creating these directories, and in a sudden, the files appeared in /bin, where I didn't expect them to be inspite of the PREFIX given in configure.
So in short: if you experience weird assembler messages near the end of compilation, maybe creating the directories /usr/cross and /usr/cross/bin beforehand is of help? For me it is, and I didn't need -k.
I've also extended $PATH with /usr/cross/bin from the beginning of the binutils-deployment on.
My apologies to Solar. This strangeness isn't necessarily to show up in each and every config.
Stay safe.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
BlueillusionOS iso image
Re:GCC Cross-Compiler issues
I wasn't too friendly about it either, so I think that's mutally settled.beyond infinity wrote:My apologies to Solar. This strangeness isn't necessarily to show up in each and every config.
However, I am not really sure this actually is the core of the problem. On every machine I tested so far, /usr/cross is automatically created during the 'make install' - that includes Win98SE, WinNT, and Win2k. I still suspect a glitch somewhere in the procedure. Ah well, my CPU here feels bored anyways, so I'll have 'make's running for some time I guess.
Every good solution is obvious once you've found it.
Re:GCC Cross-Compiler issues
OK, tracked that "junk at end of line" error that beyond infinity complained about. That happens when you forgot to set --prefix=$PREFIX during the binutils configure.
Will add that to the Troubleshooting.
Will add that to the Troubleshooting.
Every good solution is obvious once you've found it.
-
distantvoices
- Member

- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
- Contact:
Re:GCC Cross-Compiler issues
or have buildt in some typo. *gg*
I've had to type that ../...configure ... line at least three times ere I 've got it right, and still no "/usr/cross" directory showed up. Maybe some typo I didn't perceive. I 've given it a kick and it worked after all.
I've had to type that ../...configure ... line at least three times ere I 've got it right, and still no "/usr/cross" directory showed up. Maybe some typo I didn't perceive. I 've given it a kick and it worked after all.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
BlueillusionOS iso image
- Pype.Clicker
- Member

- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:GCC Cross-Compiler issues
hmm ... i was trying to put information about va_arg() in the FAQ, and i realise that the way GCC support it seems to vary from systems to systems. toying with pointers directly doesn't seem a nice way to do it and the __builtin_next_arg() of 2.95.3 seems to be replaced by __builtin_va_start() and __builtin_va_next() ... on 3.x
I thought i found the info initially in the glib, but it rather appears to be something that is _natively_ bound to GCC ... (e.g. in /gcc-lib/<system>/<version>/include/stdarg.h)
Iirc, my own compiler settings (not using a cross compiler here) prevent me to use files in that place so i had to re-write my own stdarg (which was the main reason for turning Clicker to (L)GPL in first place).
So i'm now wondering ... could a cross-compiler be set up so that #include <stdarg.h> still works ?
I also see "unwind.h" there, so that might be interresting for ppl doing C++ too ...
I thought i found the info initially in the glib, but it rather appears to be something that is _natively_ bound to GCC ... (e.g. in /gcc-lib/<system>/<version>/include/stdarg.h)
Iirc, my own compiler settings (not using a cross compiler here) prevent me to use files in that place so i had to re-write my own stdarg (which was the main reason for turning Clicker to (L)GPL in first place).
So i'm now wondering ... could a cross-compiler be set up so that #include <stdarg.h> still works ?
I also see "unwind.h" there, so that might be interresting for ppl doing C++ too ...