Feedback

type to search

when making with g++ , fatal error: can’t open /tmp/ccrkCbcb.s for writing: Permission denied

Asked by

Hi,

I just installed Lenny in “server” configuration.  I am building a simple C++ program with a makefile and it works file, IF I am root.  If not, I get the following error and output:

g++ -Wall -std=c++0x -g -O0 -o gorillas gorillas.cpp
gorillas.cpp:1: fatal error: can’t open /tmp/ccrkCbcb.s for writing: Permission denied
compilation terminated.
make: *** [gorillas] Error 1

the permissions on /tmp/ are as follows:

drwxrwxrwt  6 root root  4096 2011-03-13 00:00 tmp


Any idea what I’m doing wrong?

Thanks

Ean

or Cancel

2 answers

1

gnubyexample [ Editor ]

As your non root user (I’ll use the name someuser in this answer, adjust as appropriate)

mkdir /home/someuser/tmp;
export TMPDIR=/home/someuser/tmp;
g++ -Wall -std=c++0x -g -O0 -o gorillas gorillas.cpp
The gcc documentation has a section on Environment Variables, which is worth a read.

Compiling in some VPS environments and in small form environments, where space is limited is sometimes best done, by you manually specifying TMPDIR before compiling.
or Cancel
1

anonymous

Gnuby,

Thanks that sorted it.  My problem was that I had my umask set backwards and then created stuff as root.  So, nothing worked.  Now it’s fine.  Many thanks.

Ean

or Cancel

Your answer

You need to join Debian to complete this action, click here to do so.