1

For a couple years now I've been building locally xscreensaver using the

 .configure
 make
 sudo make install

combination.

Today however the sudo make install is failing with permission issues:

 sudo make install
 [sudo] password for stephen: 
 make: stat: GNUmakefile: Permission denied
 make: stat: makefile: Permission denied
 make: stat: Makefile: Permission denied
 make: stat: install: Permission denied
 make: *** No rule to make target 'install'.  Stop.

I tried without sudo and there was no difference.

6
  • 1
    Sounds odd, what file system are you using?
    – andrew.46
    Mar 13, 2021 at 6:41
  • @andrew.46 ext4 This is a fresh install of 20.10 , installed yesterday. Mar 13, 2021 at 14:24
  • 1
    I've seen errors like this before when one of the files didn't have the executable bit set.
    – KGIII
    Mar 13, 2021 at 18:50
  • 1
    @KGIII That was it. Makefile was not executable. Mar 13, 2021 at 19:42
  • Yup. That's what I figured it was. I could write it up as an answer, but it'd be relatively short.
    – KGIII
    Mar 13, 2021 at 19:50

1 Answer 1

2

The problem in this case is that the appropriate files don't have the executable bit. If the file needs to be executed, that is run as a program, then it needs to have that bit set.

In this case, to make the application you need 'makefile' to be executable. This is done with:

chmod +x ./<file_name>

Adjust your /path/to/file as needed and then, run your make command again.

sudo make install

'chmod' means to change file mode bits and the +x means executable.

5
  • Why does Makefile have to be executable? Isn't it just a file with instructions for make and not directly executed by itself?
    – palapapa
    Mar 3 at 5:09
  • @palapapa Because the make command may want to put files in protected directories, such as /usr/bin for example. If it needs no elevated permissions, you can run it as your regular user.
    – KGIII
    Mar 3 at 20:15
  • Doesn't setting the executable bit on Makefile just make it so that you can run ./Makefile? But that's not what we want, is it? Isn't sudo make what does the trick here?
    – palapapa
    Mar 4 at 3:43
  • Yes, the +x sets the executable bit. You set that and then run make. That's (sometimes) followed by make install, which may need elevated permissions as it installs the made file(s) into the various system folders. You do not need sudo with just plain make.
    – KGIII
    Mar 4 at 22:12
  • I don't understand. Makefile is not a program, so why does it need to be executable? Doesn't it only need to be readable by make? I also can't find any information on Makefile itself needing to be executable. Your previous comments only address make but not Makefile.
    – palapapa
    Mar 5 at 1:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .