Why do I get permission denied when I try use “make” to install something?

后端 未结 5 388
走了就别回头了
走了就别回头了 2021-02-01 04:47

I\'m trying to install something and it\'s throwing me an error: Permission denied when I try to run make on it.

I\'m not too fond of the unive

相关标签:
5条回答
  • 2021-02-01 04:49

    On many source packages (e.g. for most GNU software), the building system may know about the DESTDIR make variable, so you can often do:

     make install DESTDIR=/tmp/myinst/
     sudo cp -va /tmp/myinst/ /
    

    The advantage of this approach is that make install don't need to run as root, so you cannot end up with files compiled as root (or root-owned files in your build tree).

    0 讨论(0)
  • 2021-02-01 04:54

    Execute chmod 777 -R scripts/, it worked fine for me ;)

    0 讨论(0)
  • 2021-02-01 04:54

    The problem is frequently with 'secure' setup of mountpoints, such as /tmp

    If they are mounted noexec (check with cat /etc/mtab and or sudo mount) then there is no permission to execute any binaries or build scripts from within the (temporary) folder.

    E.g. to remount temporarily:

     sudo mount -o remount,exec /tmp
    

    Or to change permanently, remove noexec in /etc/fstab

    0 讨论(0)
  • 2021-02-01 04:54

    I had a very similar error message as you, although listing a particular file:

    $ make
    make: execvp: ../HoughLineExtractor/houghlineextractor.hh: Permission denied
    make: *** [../HoughLineAccumulator/houghlineaccumulator.o] Error 127
    
    $ sudo make
    make: execvp: ../HoughLineExtractor/houghlineextractor.hh: Permission denied
    make: *** [../HoughLineAccumulator/houghlineaccumulator.o] Error 127
    

    In my case, I forgot to add a trailing slash to indicate continuation of the line as shown:

    ${LINEDETECTOR_OBJECTS}:\
        ../HoughLineAccumulator/houghlineaccumulator.hh  # <-- missing slash!!
        ../HoughLineExtractor/houghlineextractor.hh
    

    Hope that helps someone else who lands here from a search engine.

    0 讨论(0)
  • 2021-02-01 05:07

    Giving us the whole error message would be much more useful. If it's for make install then you're probably trying to install something to a system directory and you're not root. If you have root access then you can run

    sudo make install
    

    or log in as root and do the whole process as root.

    0 讨论(0)
提交回复
热议问题