简体   繁体   English

“没有规则使目标‘安装’”......但是 Makefile 存在

[英]"No rule to make target 'install'"... But Makefile exists

I am running into issues installing a C++ library.我在安装 C++ 库时遇到问题。 The CMake command is successful and generates the Makefile, but it gives a warning: 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?有任何想法吗?

Could you provide a whole makefile? 你能提供一个完整的makefile吗? But right now I can tell - you should check that "install" target already exists. 但是现在我可以告诉你 - 你应该检查“安装”目标是否已经存在。 So, check Makefile whether it contains a 因此,检查Makefile是否包含

install: (anything there)

line. 线。 If not, there is no such target and so make has right. 如果没有,就没有这样的目标,所以make是正确的。 Probably you should use just "make" command to compile and then use it as is or install yourself, manually. 可能你应该只使用“make”命令进行编译,然后按原样使用它或手动安装。

Install is not any standard of make, it is just a common target, that could exists, but not necessary. 安装不是任何标准的制造,它只是一个共同的目标,可能存在,但不是必需的。

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 . 我收到了相同的错误消息,我的问题是在运行命令make install时我没有在正确的目录中。 When I changed to the directory that had my makefile it worked. 当我更改到具有我的makefile的目录时,它工作了。

So possibly you aren't in the right directory. 所以你可能不在正确的目录中。

I also came across the same error. 我也遇到了同样的错误。 Here is the fix: If you are using Cmake-GUI : 以下是修复:如果您使用的是Cmake-GUI

  1. Clean the cache of the loaded libraries in Cmake. 在Cmake中清理已加载库的缓存。
  2. Configure the libraries. 配置库。
  3. Generate the Unix file. 生成Unix文件。

If you missed the 3rd step: 如果你错过了第3步:

*** No rule to make target `install'. ***没有规则来制作目标`install'。 Stop. 停止。

error will occur. 会发生错误。

Ensure you're in the same directory as with your Makefile .确保您与Makefile位于同一目录中。

Make sure you have cmake确保你有 cmake

cmake -DCMAKE_INSTALL_PREFIX=/usr ..

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM