【问题标题】:CMake Error: The following variables are used in this project, but they are set to NOTFOUNDCMake 错误:此项目中使用了以下变量,但它们设置为 NOTFOUND
【发布时间】:2012-05-29 20:59:38
【问题描述】:

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

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

之后我想配置它:

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

它给了我错误:

bash: ./configure: 没有这样的文件或目录

我也运行了命令:

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

它给了我以下结果:

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!

我该怎么做?

【问题讨论】:

    标签: linux cmake configure


    【解决方案1】:

    CMake 似乎无法找到 htmlcxx 库。

    在whalebot documentation 中,htmlcxx 被列为依赖项。


    你需要download htmlcxx,解压,然后安装:

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

    您可能需要将#include &lt;cstddef&gt; 添加到html/tree.h 的顶部才能使其成功构建。默认安装到usr/local/。


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

    sudo apt-get install libicu-dev
    


    最后,您现在可以构建和安装whalebot。同样,如果您安装了相当最新的 boost 安装,则制作可能会失败。

    在webspider/src/webspider_options.cpp 的第57 行,您需要将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
    

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

    【讨论】:

    • 如何附加该 htmlcxx 库,我是 linux 新手,所以请不要介意 thnx
    • 感谢您的帮助,它现在正在工作并且构建成功。现在在构建之后运行鲸鱼机器人的下一步是什么......
    • @MuhammadAssad 很高兴它有效。关于鲸鱼机器人的使用,您应该能够通过在命令提示符中输入 whalebot 并使用适当的参数来执行它。如果您对其使用有任何疑问或疑问,我再次建议您参考文档here 和here。
    • 感谢帮助。基本上我需要将这个鲸鱼爬虫程序集成到我的搜索引擎项目中,该项目将在 C#.net 中实现。首先,我将编译和配置whalebot,然后与搜索引擎项目集成,该项目将在C#.net 中实现......
    【解决方案2】:

    检查你是否在 CMakeLists 中写过 find_library(..) 或 find_path(.),然后将其替换为 find_package(..)。

    它解决了我的错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-16
      • 2023-02-10
      • 2018-06-05
      相关资源
      最近更新 更多