C++ “没有规则可以使目标'安装'”......但是Makefile存在
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35672364/
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
"No rule to make target 'install'"... But Makefile exists
提问by Sean
I am running into issues installing a C++ library. The CMakecommand is successful and generates the Makefile, but it gives a warning:
我在安装 C++ 库时遇到问题。该CMake的命令是成功的,产生的Makefile,但它给出了一个警告:
CMake Warning (dev) at CMakeLists.txt:27 (LINK_DIRECTORIES):
This command specifies the relative path
../usr/local/lib
as a link directory.
Policy CMP0015 is not set: link_directories() treats paths relative to the
source dir. Run "cmake --help-policy CMP0015" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
Line 27 in CMakeLists.txt is
CMakeLists.txt 中的第 27 行是
Boost_LIBRARY_DIR_DEBUG:PATH=/usr/local/lib
I don't see why this warning would cause me any issues. But when I run make install, I get an error:
我不明白为什么这个警告会给我带来任何问题。但是当我运行 make install 时,出现错误:
make: *** No rule to make target `install'. Stop.
Any ideas?
有任何想法吗?
采纳答案by Tomir Rogi Szawok
Could you provide a whole makefile? But right now I can tell - you should check that "install" target already exists. So, check Makefile whether it contains a
你能提供一个完整的makefile吗?但是现在我可以告诉您 - 您应该检查“安装”目标是否已经存在。因此,检查 Makefile 是否包含
install: (anything there)
line. If not, there is no such target and so make has right. Probably you should use just "make" command to compile and then use it as is or install yourself, manually.
线。如果没有,就没有这样的目标,所以 make 是正确的。可能您应该只使用“make”命令进行编译,然后按原样使用或手动安装。
Install is not any standard of make, it is just a common target, that could exists, but not necessary.
安装不是 make 的任何标准,它只是一个常见的目标,可以存在,但不是必需的。
回答by Jamie
I was receiving the same error message, and my issue was that I was not in the correct directory when running the command make install
. When I changed to the directory that had my makefile it worked.
我收到了相同的错误消息,我的问题是运行命令时我不在正确的目录中make install
。当我切换到包含我的 makefile 的目录时,它可以工作。
So possibly you aren't in the right directory.
所以可能你不在正确的目录中。
回答by FutureJJ
I also came across the same error. Here is the fix: If you are using Cmake-GUI:
我也遇到了同样的错误。这是修复:如果您使用的是Cmake-GUI:
- Clean the cache of the loaded libraries in Cmake.
- Configure the libraries.
- Generate the Unix file.
- 清理 Cmake 中加载库的缓存。
- 配置库。
- 生成 Unix 文件。
If you missed the 3rd step:
如果您错过了第 3 步:
*** No rule to make target `install'. Stop.
*** 没有使目标“安装”的规则。停止。
error will occur.
会发生错误。