[SOLVED] gcc: not sufficient memory to compile, even with -O2 ?
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
gcc: not sufficient memory to compile, even with -O2 ?
Hello, Good morning,
I would like to compile a C program with visibly not sufficiently enought main memory. My machine has the following 256MB DDR-333 SDRAM, 166MHz under Linux Debian Testing.
I have tried with the option -O2 but it still can not compile the C code.
I am out of luck.
I would be pleased if you could tell me how to compile with this given machine.
I hope so much that you would have any further ideas or tricks.
Check for adequate swap space, close off _everything_ not needed for the compile. I ran out once on a link - the compile was ok. I had 128M and 64M of swap, and it used them all before crapping out. Closing everything got me through, but it used 197MB of ram&swap - pretty close!
You need a console, runlevel 3, all background stuff closed. No X, no nothing.
If the gcc command breaks down, it's probably a problem with the software. If it's the link (ld), it may just be linked to too many libs.
I am actually not using a swap (partition) on this machine. There is no swap, only ext2 with / and ext3 with /home. Ok. So let's bring a swap:
I could plug an USB harddrive of 1 TeraBytes. Format it to Swap (create it maybe with fdisk if it works) and edit the /etc/fstab to mount it as swap. (I have to check how on google).
Would you think that it would work, i.o.w. that gcc would work and would compile?
It should work, but I would put swap on the main HDD whenever possible, otherwise you'll have to turn it on manually every time. On such a low RAM machine you need swap. I only run without swap on machines with at least 2-4 GB of RAM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.