Linux CMake 错误:此项目中使用了以下变量,但它们被设置为 NOTFOUND

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10717798/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 06:26:54  来源:igfitidea点击:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND

linuxcmakeconfigure

提问by Muhammad Assad

I am trying to configure the whalebotcrawler with the tar file whalebot-0.02.00.tar.gz. I have extracted it correctly with:

我正在尝试whalebot使用 tar 文件配置爬虫whalebot-0.02.00.tar.gz。我已经正确提取了它:

root@Admin1:~/dls# tar xvzf whalebot-0.02.00.tar.gz

After that I want to configure it with:

之后我想配置它:

root@Admin1:~/dls/whalebot# ./configure

It gives me error:

它给了我错误:

bash: ./configure: No such file or directory

bash: ./configure: 没有那个文件或目录

also I have run the command:

我也运行了命令:

root@Admin1:~/dls/whalebot# cmake ./

It gives me the following result:

它给了我以下结果:

root@Admin1:~/dls/whalebot# cmake ./
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Boost version: 1.44.0
-- Found the following Boost libraries:
-- filesystem
-- system
-- thread
-- program_options
-- date_time
CMake Warning (dev) at webspider/CMakeLists.txt:25 (link_directories):
This command specifies the relative path

../statsem_string/bin

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.

CMake Warning (dev) at webspider/CMakeLists.txt:25 (link_directories):
This command specifies the relative path

../3dparty/google-url

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.

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
HTMLCXX_LIBRARY
linked by target "whalebot" in directory /root/dls/whalebot/webspider

-- Configuring incomplete, errors occurred!

How do I proceed?

我该如何进行?

采纳答案by Fraser

It appears that CMake is unable to find the htmlcxx library.

CMake 似乎无法找到 htmlcxx 库。

In the whalebot documentation, htmlcxx is listed as a dependency.

whalebot 文档中,htmlcxx 被列为依赖项。


You need to download htmlcxx, unzip it, then install it:


您需要下载 htmlcxx,解压,然后安装:

cd <path to unzipped htmlcxx>
./configure --enable-static=on --enable-shared=off
make
sudo make install

You may need to add #include <cstddef>to the top of html/tree.hto get it to build successfully. It will install to usr/local/by default.

您可能需要添加#include <cstddef>到顶部html/tree.h以使其成功构建。它将usr/local/默认安装到。


You also need icuinstalled if you don't already have it:


如果你还没有icu,你还需要安装它:

sudo apt-get install libicu-dev



Finally, you can now build and install whalebot. Again, making might fail if you have a reasonably up-to-date boost installation.

最后,您现在可以构建和安装鲸鱼机器人。同样,如果您有合理的最新 boost 安装,制作可能会失败。

In line 57 of webspider/src/webspider_options.cpp, you need to replace boost::filesystem::initial_path().native_directory_string()with boost::filesystem::initial_path().string(). Then you should be good to build and install:

在 的第 57 行中webspider/src/webspider_options.cpp,您需要替换boost::filesystem::initial_path().native_directory_string()boost::filesystem::initial_path().string()。那么你应该很好地构建和安装:

cd <path to unzipped whalebot>
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
sudo make install

This too will install to usr/local/by default.

这也将usr/local/默认安装到。