This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Gcc Error


On 22 August 2015 at 07:19, Thomas Dineen wrote:
> Gentle People:
>
>     When Building a rather large project gcc produces the following error:
> "Out of memory for code representation:" See the details below.
>
> What is the best or simplest way to fix this?
>
> 1) Will using 64 bit via the -m64 flag fix this?

That tells the compiler to produce 64-bit output, it doesn't change
how much memory it has available, and is likely to use more memory to
represent the larger pointer types.

> or
> 2) I am currently building the project with single gcc call. (The slow way)
> Due to some legacy issues with GTK/Cairo and extern variables one big build
> seems to work. Would it be better to compile each .C File to a .O file and
> then
> link (Faster way).

Do you mean you've put all the code in a single file? If yes, then of
course splitting it up into smaller files will use less memory.

> 3) I am using an older gcc 3.4.6 on Solaris 10.

Good grief.

> Sun5# !ma
> make TA_Benchs
> Running Target: TA_Bench Sun
> gcc -D_REENTRANT -ggdb -w  -g -c IB_TWS_API.c Read_IB_Callbacks.c
> gcc Main.c  -ggdb -w IB_TWS_API.o Read_IB_Callbacks.o `pkg-config --cflags
> --libs gtk+-2.0 ` -lcurl -lm -lsocket -lnsl -ggdb -w -o TA_Bench.sun
> Assembler: Main.c
>         "/var/tmp//ccVeiKcL.s", line 15324105 : Out of memory for code
> representation
> make: *** [TA_Benchs] Error 1

This error isn't even coming from GCC, it's coming from the assembler,
which is part of Solaris and not part of GCC. It's trying to assemble
a file that is at least 15 million lines long. That's probably your
problem. Try splitting Main.c into smaller files.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]