Have to do "sudo make" or else C can't create executables

0

I used to be able to run make like normal, but now I have to run make as super user or else it will fail saying that the c compiler can't create executables. Why did this happen?

tony_sid

Posted 2012-05-02T14:42:24.477

Reputation: 11 651

6You don't have write permissions in the output directory with your current user. – Daniel Beck – 2012-05-02T14:46:40.520

Answers

3

Might be that you did sudo make once by mistake, and now make wont work since it might need to rewrite files or write to dirs which were created under sudo and thus unwritable by normal user.

Karthik T

Posted 2012-05-02T14:42:24.477

Reputation: 2 654

2

There is a distinction between make and make install. Make only compile your stuff, make install copies the executables in the system. Then make install has often to be executed as root (sudo make install) to get write access to destination directories (/bin, /sbin, /usr/bin ...). Stating that make itself fails to compile without root privilege is awkward indeed.

  1. Check that, as a user, you have read and write accesses to (all) the files you are trying to build. Especially if you get the sources from some third-parties (usbkey, web, ...), who knows how the permissions have been set by the author?
  2. Then ensure that you have read and write accesses to the folder where make will create the object files.
  3. Then be specific to us. What's the error make pops you? Do you have some logs to share?

m-ric

Posted 2012-05-02T14:42:24.477

Reputation: 317