Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to compile with make | fatal error No space left on device

Situation: Just installed linux, Trying to learn to code c. Gets set up with sudo apt-get install build-essential. Open nano type in my code

#include <stdio.h>

int main(int argc, char *argv[])
{
        puts("Hello World.\n");
        return 0;
}

open another console tab, types in make ex1 then my world spins downward into the darkest abyss i have yet to experience on my first linux distro.

ragnar@ragnar:~/Documents/C$ make ex1
cc -Wall -g    ex1.c   -o ex1
ex1.c:7:1: fatal error: error closing /tmp/cc8d7Oap.s: No space left on device
 }
 ^
compilation terminated.
make: *** [ex1] Error 1


ragnar@ragnar:~/Documents/C$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdb5       4.0G  3.8G     0 100% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
udev            7.9G  8.0K  7.9G   1% /dev
tmpfs           1.6G  1.4M  1.6G   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            7.9G  8.1M  7.9G   1% /run/shm
none            100M   28K  100M   1% /run/user
/dev/sdb2        96M   29M   68M  30% /boot/efi
/dev/sdb7        11G  248M  9.5G   3% /home

all help is appreciated.

like image 808
bannji Avatar asked Jul 18 '15 17:07

bannji


1 Answers

The partition containing the root folder (/) is 100% full. The root folder currently also contains the /tmp folder, which is used during compilation to store temporary files. As the root folder and with this the tmp folder is full, this fails.

To get around this either add more space, or reorganise the existing one.

As a workaround do

mkdir ~/tmp
export TMPDIR=~/tmp

and retry compilation.


A flexible way to organise a file system is using seperate partitions for

/
/usr
/home
/var
/tmp

A lazy approach would be to link /tmp/ to /var/tmp. This however might cause issues as in terms of clean-up the OS might handle the content in /var/tmp different from the content in /tmp. That is the content of /tmp/ would get deleted on each boot where as /var/tmp wouldn't.

like image 97
alk Avatar answered Oct 25 '22 03:10

alk