【问题标题】:Unable to find some boost libraries on ubuntu when compiling file编译文件时无法在ubuntu上找到一些boost库
【发布时间】:2016-08-11 13:47:18
【问题描述】:

我正在尝试编译此存储库:https://github.com/graehl/carmel

有一个用于编译的标准 makefile。

虽然我已经安装了boost库“libboost-all-dev”,但遇到这样的错误:

/usr/bin/ld: cannot find -lboost_random-mt
/usr/bin/ld: cannot find -lboost_timer-mt
/usr/bin/ld: cannot find -lboost_chrono-mt
/usr/bin/ld: cannot find -lboost_system-mt
collect2: error: ld returned 1 exit status
../graehl/graehl.mk:331: recipe for target 'bin/linux/carmel' failed
make: *** [bin/linux/carmel] Error 1

我该如何解决这个问题?

谢谢,

【问题讨论】:

    标签: c++ linux ubuntu gcc boost


    【解决方案1】:

    如果您的系统中有所需的软件包,请尝试使用此命令搜索。因此,如果有的话,您可以尝试编译项目,同时注意您的引导库是如何安装的。在 README.md 中写着:

    cd carmel; make -j 4 install BOOST_SUFFIX=-mt INSTALL_PREFIX=/usr/local
    # BOOST_SUFFIX= depends on how your boost libraries are installed - ls /usr/lib/libboost*.so
    (prerequisites: GNU Make (3.8) C++ compiler (GCC 5, clang 3.7, or visual studio 2015 will do) and Boost, which you probably already have on your linux system; for Mac, you can get them from Homebrew. For windows: MSVC2015 should work; you can also use cygwin or mingw.
    

    【讨论】:

    • 谢谢卡利诺。但我有所有的先决条件。
    • 你能告诉我“dpkg -L libboost-all-dev”的输出吗
    • 例如,首先你必须发现靴子库在哪里:使用 "dpkg -S boost_random-mt" 。我正在使用我的输出:“/usr/lib/x86_64-linux-gnu/libboost_random.so.1.58.0”。然后你必须启动 make 命令为:cd carmel; make -j 4 install BOOST_SUFFIX=-mt /usr/lib/x86_64-linux-gnu INSTALL_PREFIX=/usr/local
    【解决方案2】:

    所以我认为问题在于您没有告诉链接器引导库在哪里。 我想然后我读了这个问题Question 所以使用这个命令你可以知道库在哪里。

    dpkg -S <name of library>
    

    例如:

    dpkg -S boost_random 
    

    对于 -lboost_random-mt

    【讨论】:

    • 对不起,我在这个操作系统问题上有点不擅长。如何彻底解决问题?
    • 在 make 文件中有一些变量包含引导库路径。您必须使用 dpkg -S 命令发现库的路径并设置这些变量。
    • 例如?对不起,我在这个问题上完全是傻瓜。
    • 我的意思是,在 makefile 中。
    • 当你使用 make 命令时,你可以知道变量是怎样的:所以如果你写 cd carmel; make -j 4 install BOOST_SUFFIX=-mt /usr/lib/x86_64-linux-gnu INSTALL_PREFIX=/usr/local BOOST_SUFFIX 是 -mt /usr/lib/x86_64-linux-gnu
    猜你喜欢
    • 2013-12-30
    • 1970-01-01
    • 1970-01-01
    • 2011-10-16
    • 1970-01-01
    • 1970-01-01
    • 2016-12-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多