gcc 错误:Fatal error error writing to tmp No space left on device

在使用gcc make时报错:Fatal error error writing to tmp No space left on device


finiteVolume/ddtSchemes/EulerDdtScheme/EulerDdtSchemes.C:40: fatal error: error writing to /tmp/ccUN0zCh.s: No space left on device 
LaunderGibsonRSTM/LaunderGibsonRSTM.C:348: fatal error: error writing to /tmp/ccsslpCE.s: No space left on device 
LaunderGibsonRSTM/LaunderGibsonRSTM.C:368: fatal error: error writing to /tmp/ccnEKI2H.s: No space left on device 
faDdtSchemes/EulerFaDdtScheme/EulerFaDdtSchemes.C:42: fatal error: error writing to /tmp/cciY95in.s: No space left on device 

解决方案:

Simply do the following command: 

df /tmp 

You should see something close to 100% of utilization for the partition hosting /tmp. 

Solution 1: if possible, clean up your /tmp directory, or any other directory located on the full disk partition. Remove some temporary files, etc. If you are unsure, ask your local smiling sysadmin. 

Solution 2: it is quite possible that the size of the partition hosting /tmp is too small for the kind of utilization you are doing with your workstation. It happens. On my workstation, I always make sure I have a large /tmp. 

Simply read the man page for g++. Look up the section where they talk about the environment variable TMPDIR. 
Set your TMPDIR environment variable to a directory located on your 35GB free disk space. Restart your compilation. 

That should do the trick. 

我设置TMPDIR    export TMPDIR=/root ,问题解决。

TMPDIR wikipedia解释:

TMPDIR is the canonical Unix environment variable that should be used to specify a temporary directory for scratch space. Most Unix programs will honor this setting and use its value to denote the scratch area for temporary files instead of the common default of /tmp[1][2] or /var/tmp.[3]

Other forms sometimes accepted are TEMPTEMPDIR and TMP, but these alternatives are used more commonly by non-POSIX operating systems or non-conformant programs.

TMPDIR is specified in various Unix and similar standards, e.g. per the Single UNIX Specification.[4]

unset TMPDIR

原文地址:https://www.cnblogs.com/youxin/p/5116219.html