[fpc-devel] Cant link - 'memory exhausted'

Peter Vreman peter at freepascal.org
Mon May 30 08:04:53 CEST 2005

> Jonas Maebe wrote:
>> If you want dead code to be stripped from your own written code, you
>> must turn on the generation of smartlinkable code (-CX), and of  course
>> also smartlinking (-XX)
> First off, Im a newbie to FPC, so when I see something on the list, I
> give it a try to see how it affects my code. (And when I run into
> something I dont understand, I ask about it) Seeing the bit about -CX
> and -XX, I gave it a shot.
> My command line:
> fpc -va -XS -CX -XX -O3 -So -Fu~/manndoor/units
> -Fu~/manndoor/units/elecom -Fu~/manndoor/units/unix lord.pas
> Everything compiles .. but then it cant link.
> Searching file /bin/LD... not found
> Searching file /usr/bin/ld... found
> Using util /usr/bin/ld
> lord.pas(1841,1) Error: Can't call the linker, switching to external
> linking
> Error: /usr/local/bin/ppc386 returned an error exitcode (normal if you
> did not specifiy a source file to be compiled)
> (This is something thats been discussed on the list before, but no
> conclusion was achieved). ppas.sh is created, so I run that.
> Without -CX, the program wont link the first time I run ppas.sh, but
> will when I run ppas.sh a second time.
> With -CX, the program compiles, but wont link, ppas.sh is created. I run
> ppas.sh and it still wont link. "libpvol1.a: could not read symbols:
> Memory exhausted" ..
> Whats this mean? Not enough memory available to the linker? 'top' shows
> about 44 megs free.. ("Mem:  1031620k av,  987652k used,   43968k free,
>        0k shrd,  147196k buff")

ld needs a lot of memory when using smartlinking. IIRC smartlinking
lazarus requires 1Gb of memory.

More information about the fpc-devel mailing list