[SOLVED] Re: malloc error when compiling insn-attrtab.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux