Linux 当我尝试使用“make”安装某些东西时,为什么我的权限被拒绝?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9106536/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why do I get permission denied when I try use "make" to install something?
提问by CheeseConQueso
I'm trying to install something and it's throwing me an error: Permission denied
when I try to run make
on it.
我正在尝试安装某些东西,但它向我抛出了一个错误:Permission denied
当我尝试make
在它上面运行时。
I'm not too fond of the universal rules of unix/linux and not too fond of user rights either. My best guess is that the user I'm logged in as does not have the privileges to run make
commands, but hopefully it's something else that's not permitting me to install.
我不太喜欢unix/linux的通用规则,也不太喜欢用户权限。我最好的猜测是我登录的用户没有运行make
命令的权限,但希望它是不允许我安装的其他东西。
Why do I get Permission denied
and what should I check or configure in order to attempt permission be granted?
为什么我会得到Permission denied
以及我应该检查或配置什么才能尝试授予权限?
EDIT
编辑
Error Message:
错误信息:
gcc -I. -O3 -o pp-inspector pp-inspector.c
make: execvp: gcc: Permission denied
make: [pp-inspector] Error 127 (ignored)
gcc -I. -O3 -c tis-vnc.c -DLIBOPENSSL -DLIBOPENSSLNEW -DLIBIDN -DHAVE_PR29_H -DLIBMYSQLCLIENT -DLIBPOSTGRES -DHAVE_MATH_H -I/usr/include/mysql
make: execvp: gcc: Permission denied
make: *** [tis-vnc.o] Error 127
采纳答案by Basile Starynkevitch
On many source packages (e.g. for most GNU software), the building system may know about the DESTDIR
makevariable, so you can often do:
在许多源包上(例如对于大多数 GNU 软件),构建系统可能知道DESTDIR
make变量,因此您通常可以这样做:
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).
这种方法的优点是make install
不需要以 root 身份运行,因此您最终不会以 root 身份编译文件(或构建树中的 root 拥有的文件)。
回答by Jarryd
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
给我们完整的错误信息会更有用。如果是为了 make install,那么您可能正在尝试将某些东西安装到系统目录并且您不是 root。如果您有 root 访问权限,那么您可以运行
sudo make install
or log in as root and do the whole process as root.
或以 root 身份登录并以 root 身份执行整个过程。
回答by Drew Noakes
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.
希望能帮助从搜索引擎登陆这里的其他人。
回答by sehe
The problem is frequently with 'secure' setup of mountpoints, such as /tmp
问题经常出现在挂载点的“安全”设置中,例如 /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.
如果它们被挂载noexec
(用cat /etc/mtab
和 或 进行检查sudo mount
),则没有权限从(临时)文件夹中执行任何二进制文件或构建脚本。
E.g. to remount temporarily:
例如暂时重新安装:
sudo mount -o remount,exec /tmp
Or to change permanently, remove noexec
in /etc/fstab
或永久更改,删除noexec
在/etc/fstab
回答by D3473R
Execute chmod 777 -R scripts/
, it worked fine for me ;)
执行chmod 777 -R scripts/
,对我来说效果很好;)