public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* malloc error when compiling insn-attrtab.c
@ 2012-03-11  3:15 Jens Bauer
  2012-03-11 13:01 ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: Jens Bauer @ 2012-03-11  3:15 UTC (permalink / raw)
  To: gcc-help

Hi,

I'm having so much trouble compiling gcc-4.6.x (4.6.1, 4.6.2, 4.6.3).

A malloc error occurs when I try to compile 'insn-attrtab.c'.

Here's the last output from my build.
---8<-----8<-----8<-----
gcc -m32 -c   -I/Users/toolchain/arm-toolchain/Source/gmp-5.0.2 -I/Users/toolchain/arm-toolchain/Source/mpfr-3.0.1 -I/Users/toolchain/arm-toolchain/Source/mpc-0.9 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wc++-compat   -DHAVE_CONFIG_H -I. -I. -I/Users/toolchain/arm-toolchain/Source/gcc-4.6.1/gcc -I/Users/toolchain/arm-toolchain/Source/gcc-4.6.1/gcc/. -I/Users/toolchain/arm-toolchain/Source/gcc-4.6.1/gcc/../include -I/Users/toolchain/arm-toolchain/Source/gcc-4.6.1/gcc/../libcpp/include -I/Users/toolchain/arm-toolchain/Packages/gmp/usr/local/myPkg/include -I/Users/toolchain/arm-toolchain/Packages/mpfr/usr/local/myPkg/include -I/Users/toolchain/arm-toolchain/Packages/mpc/usr/local/myPkg/include  -I/Users/toolchain/arm-toolchain/Source/gcc-4.6.1/gcc/../libdecnumber 
-I/Users/toolchain/arm-toolchain/Source/gcc-4.6.1/gcc/../libdecnumber/dpd -I../libdecnumber    insn-attrtab.c -o insn-attrtab.o
cc1(36717) malloc: *** mmap(size=1424994304) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug

cc1: out of memory allocating 1424991708 bytes after a total of 0 bytes
make[1]: *** [insn-attrtab.o] Error 1
make: *** [all-gcc] Error 2
--->8----->8----->8-----

My computer is a PowerMac G5, I'm running Mac OS X 10.5.8; I have nothing 'newer', so I can't try it on an intel based machine.
I use gcc-4.2 (which does _not_ work the same as gcc-4.2 on intel, so it might work fine on intel, even though it fails on PowerPC).

I can compile gcc 4.3.x up to 4.5.x (all inclusive), but 4.6.x is giving me trouble.
Does anyone know how to get me going ?


Love,
Jens

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: malloc error when compiling insn-attrtab.c
  2012-03-11  3:15 malloc error when compiling insn-attrtab.c Jens Bauer
@ 2012-03-11 13:01 ` Jonathan Wakely
  2012-03-12  0:06   ` Jens Bauer
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Wakely @ 2012-03-11 13:01 UTC (permalink / raw)
  To: Jens Bauer; +Cc: gcc-help

On 11 March 2012 03:15, Jens Bauer wrote:
> Hi,
>
> I'm having so much trouble compiling gcc-4.6.x (4.6.1, 4.6.2, 4.6.3).
>
> A malloc error occurs when I try to compile 'insn-attrtab.c'.
>
> Here's the last output from my build.
> ---8<-----8<-----8<-----
> gcc -m32 -c   -I/Users/toolchain/arm-toolchain/Source/gmp-5.0.2 -I/Users/toolchain/arm-toolchain/Source/mpfr-3.0.1 -I/Users/toolchain/arm-toolchain/Source/mpc-0.9 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wc++-compat   -DHAVE_CONFIG_H -I. -I. -I/Users/toolchain/arm-toolchain/Source/gcc-4.6.1/gcc -I/Users/toolchain/arm-toolchain/Source/gcc-4.6.1/gcc/. -I/Users/toolchain/arm-toolchain/Source/gcc-4.6.1/gcc/../include -I/Users/toolchain/arm-toolchain/Source/gcc-4.6.1/gcc/../libcpp/include -I/Users/toolchain/arm-toolchain/Packages/gmp/usr/local/myPkg/include -I/Users/toolchain/arm-toolchain/Packages/mpfr/usr/local/myPkg/include -I/Users/toolchain/arm-toolchain/Packages/mpc/usr/local/myPkg/include  -I/Users/toolchain/arm-toolchain/Source/gcc-4.6.1/gcc/../libdecnumber
> -I/Users/toolchain/arm-toolchain/Source/gcc-4.6.1/gcc/../libdecnumber/dpd -I../libdecnumber    insn-attrtab.c -o insn-attrtab.o
> cc1(36717) malloc: *** mmap(size=1424994304) failed (error code=12)
> *** error: can't allocate region
> *** set a breakpoint in malloc_error_break to debug
>
> cc1: out of memory allocating 1424991708 bytes after a total of 0 bytes

It shouldn't be trying to allocate that much, it looks like an
overflow, or a negative number wrapping to a very large unsigned one.

> make[1]: *** [insn-attrtab.o] Error 1
> make: *** [all-gcc] Error 2
> --->8----->8----->8-----
>
> My computer is a PowerMac G5, I'm running Mac OS X 10.5.8; I have nothing 'newer', so I can't try it on an intel based machine.
> I use gcc-4.2 (which does _not_ work the same as gcc-4.2 on intel, so it might work fine on intel, even though it fails on PowerPC).
>
> I can compile gcc 4.3.x up to 4.5.x (all inclusive), but 4.6.x is giving me trouble.
> Does anyone know how to get me going ?

Since the problem may be in the GCC 4.2 you got from Apple, have you
tried using a different compiler to build 4.6?  I would try using GCC
4.5, which you can build successfully.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: malloc error when compiling insn-attrtab.c
  2012-03-11 13:01 ` Jonathan Wakely
@ 2012-03-12  0:06   ` Jens Bauer
  2012-03-13  1:55     ` [SOLVED] " Jens Bauer
  0 siblings, 1 reply; 4+ messages in thread
From: Jens Bauer @ 2012-03-12  0:06 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: gcc-help

Hi Jonathan,

On Sun, 11 Mar 2012 13:01:01 +0000, Jonathan Wakely wrote:
> On 11 March 2012 03:15, Jens Bauer wrote:
>> 
>> A malloc error occurs when I try to compile 'insn-attrtab.c'.
>> 
>> cc1: out of memory allocating 1424991708 bytes after a total of 0 bytes
> 
> It shouldn't be trying to allocate that much, it looks like an
> overflow, or a negative number wrapping to a very large unsigned one.

I just checked the size of insn-attrtab.c, it's actually 1.4GB! :S

>> My computer is a PowerMac G5, I'm running Mac OS X 10.5.8; I have 
>> nothing 'newer', so I can't try it on an intel based machine.
>> I use gcc-4.2 (which does _not_ work the same as gcc-4.2 on intel, 
>> so it might work fine on intel, even though it fails on PowerPC).
>> 
>> I can compile gcc 4.3.x up to 4.5.x (all inclusive), but 4.6.x is 
>> giving me trouble.
>> Does anyone know how to get me going ?
> 
> Since the problem may be in the GCC 4.2 you got from Apple, have you
> tried using a different compiler to build 4.6?  I would try using GCC
> 4.5, which you can build successfully.

I forgot to mention that this is a cross-compiler I'm building for the ARM target on my Mac.
On my Mac, I have gcc-4.0 and gcc-4.2.
gcc builds fine for ARM, but I do not yet know if it builds for Mac/PowerPC.

2 questions:
1: Wouldn't gcc-4.5 [by default, that is] have the same malloc-problem as 4.2 ?
2: Doesn't Apple compile gcc in a special way, so that it differs from a standard ./configure && make install ?

Anyway, I'm trying (once again) to compile gcc for Mac/PowerPC


Love,
Jens

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [SOLVED] Re: malloc error when compiling insn-attrtab.c
  2012-03-12  0:06   ` Jens Bauer
@ 2012-03-13  1:55     ` Jens Bauer
  0 siblings, 0 replies; 4+ messages in thread
From: Jens Bauer @ 2012-03-13  1:55 UTC (permalink / raw)
  To: Jens Bauer; +Cc: Jonathan Wakely, gcc-help

On Mon, 12 Mar 2012 01:06:15 +0100, Jens Bauer wrote:
> On Sun, 11 Mar 2012 13:01:01 +0000, Jonathan Wakely wrote:
>> On 11 March 2012 03:15, Jens Bauer wrote:
>>> 
>>> A malloc error occurs when I try to compile 'insn-attrtab.c'.
>>> 
>>> cc1: out of memory allocating 1424991708 bytes after a total of 0 bytes
>> 
>> It shouldn't be trying to allocate that much, it looks like an
>> overflow, or a negative number wrapping to a very large unsigned one.
> 
> I just checked the size of insn-attrtab.c, it's actually 1.4GB! :S

This is the most silly way of 'fixing' such errors, but very straight-forward and simple:

I quit all applications (Safari, GyazMail, etc, whatever I could find - except for some minor apps like TextEdit, Terminal and Activity Monitor)

I wrote a small test command-line utility, which tested how large blocks I could 'malloc'. The result was 2GB blocks (0x7fffffff), larger than that, we'd get a negative number (it's kinda silly to make a length-argument a signed integer in my opinion).

Then I tried building gcc-4.6.3 (for ARM) again, and malloc succeeded this time; I finally got a complete ARM build for the very first time on a PPC Mac!
(I'll have to fine-tune it, before I start using it, though - so I'll have to build a number of times still, but now it seems I'm over the worst part)
Thank you all, for the suggestions and help, especially Johathan for the invaluable help you've provided over a long time!

For the people sifting the Web...
Basics are:
* Use gcc-4.2 for compiling, gcc-4.0 will not succeed.
* don't touch the ABI; leave it as is, the default is working fine.
* don't CC='gcc -m32'. The default is fine. You can, of course CC='gcc -mcpu=... -mtune=...'
* don't compile gmp, mpfr and mpc in advance, make a symlink from within gcc's source directory, make sure the names of the symlinks are 'gmp', 'mpfr', 'mpc' and they point to the root of the unpacked library archives; eg. symlink 'gmp' points to 'gmp-5.0.4'; I made some mistakes with the symlinking a couple of times, so if you're getting any errors regarding gmp, mpfr and mpc, it's most likely because your symlinks are incorrect, check them again.

I placed the build directory outside the source directories; I find it much more fun to 'rm -R Build' to get a complete clean, than 'make clean' or unpack the source directory all over. ;)
I built the boot-gcc, then newlib, then the real gcc (without running configure again)


Love,
Jens

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-03-13  1:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-11  3:15 malloc error when compiling insn-attrtab.c Jens Bauer
2012-03-11 13:01 ` Jonathan Wakely
2012-03-12  0:06   ` Jens Bauer
2012-03-13  1:55     ` [SOLVED] " Jens Bauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).