Page 1 of 1

gcc: Internal error: Segmentation fault (program as)

Posted: Thu Feb 10, 2011 1:34 am
by nwp
I cross compiled a gcc using cygwin based on http://wiki.osdev.org/GCC_Cross-Compiler.
I used TARGET=i686-elf.
When trying to compile my code, however, gcc (as) crashes.

GNU C (GCC) version 4.5.2 (i686-elf)
compiled by GNU C version 4.5.2, GMP version 4.3.1, MPFR version 2.4.1-p5, MPC version 0.8
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 747dd349d2a5151cf792b1e7fc4359f6
COLLECT_GCC_OPTIONS='-v' '-std=c99' '-Wno-main' '-fno-builtin' '-c' '-o' 'interrupts.o' '-mtune=generic' '-march=pentiumpro'
/usr/local/lib/gcc/i686-elf/4.5.2/../../../../i686-elf/bin/as.exe --traditional-format -o interrupts.o /tmp/cc0XQD9g.s
i686-elf-gcc: Internal error: Segmentation fault (program as)
Please submit a full bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


There are a hand full of bug reports with this title, but no solutions.
It would be nice if someone told me what I'm doing wrong.

System: Win7x64 (not planning to use x64) with Cygwin and msys with Intel Core I5.

Thanks.

Re: gcc: Internal error: Segmentation fault (program as)

Posted: Thu Feb 10, 2011 2:52 am
by gerryg400
Not sure is this is your problem but the pre-requisites page says you need:

GNU Multiple Precision Library (GMP) version 4.3.2 (or later)
MPFR Library version 2.4.2 (or later)
MPC Library version 0.8.1 (or later)

Make sure you have those. I use gcc 4.5.1 and

GMP 5.0.1
MPFR 2.4.2
MPC 0.8.2

and I use binutils 2.20.1

Re: gcc: Internal error: Segmentation fault (program as)

Posted: Thu Feb 10, 2011 2:57 am
by nwp
Oh, I forgot to mention Binutils. I used version 2.9. And as GCC said, I used GMP version 4.3.1, MPFR version 2.4.1-p5, MPC version 0.8. I'll try it with more current version.

Re: gcc: Internal error: Segmentation fault (program as)

Posted: Thu Feb 10, 2011 3:04 am
by Combuster
nwp wrote:I used version 2.9
2.10 comes after 2.9, and both are like ten years old. Grabbing the bottom download on the list does not work, as the tutorial explained:
Note: The versioning scheme used is that each fullstop separates a full number, i.e. binutils 2.20.0 is newer than 2.9.0. This may be confusing, if you have not encountered this (quite common) versioning scheme yet, when looking at an alphanumerically sorted list of tarballs: The file at the bottom of the list is not the latest version!

Re: gcc: Internal error: Segmentation fault (program as)

Posted: Thu Feb 10, 2011 3:16 am
by nwp
I knew that, I just assumed that the cygwin package manager, which downloads the current package list on startup, would have the current packages.
Also I don't really care about currentness, I just want a c/c++-compiler with a linker that can link elf, coff, aout or something that nasm knows. One would think that the cygwin packages, even when not being current, they would at least be consistent.

Re: gcc: Internal error: Segmentation fault (program as)

Posted: Thu Feb 10, 2011 3:21 am
by Solar
Erm... what?

What has the Cygwin package manager to do with anything?

You missed the minimum required versions, you missed the version numbering of binutils, and now you blame the Cygwin package manager (which wasn't made with people building cross-compilers in mind)?

Re: gcc: Internal error: Segmentation fault (program as)

Posted: Thu Feb 10, 2011 4:09 am
by Combuster
Even so, my 3-year old cygwin installation uses binutils 2.17. It's not possible that the installer gave you 2.9 as the "latest" version, that must have been your misinterpretation.