【问题标题】:Cmake error while building a package构建包时出现 Cmake 错误
【发布时间】:2014-01-24 07:40:56
【问题描述】:

好吧,我不知道发生了什么?我只是在我的 macbook 上遵循一些说明(显然是针对 ubuntu 操作系统)。

在最后一步之前一切都很好。

当我执行make 时,我看到以下错误:

Linking CXX executable ../../bin/test-wordcount
ld: warning: path '/usr/local/lib/libprotobuf.dylib' following -L not a directory
ld: warning: path '/usr/local/lib/libzmq.dylib' following -L not a directory
Undefined symbols for architecture x86_64:
  "_del_curterm", referenced from:
      terminalHasColors(int) in libLLVMSupport.a(Process.o)
  "_set_curterm", referenced from:
      terminalHasColors(int) in libLLVMSupport.a(Process.o)
  "_setupterm", referenced from:
      terminalHasColors(int) in libLLVMSupport.a(Process.o)
  "_tigetnum", referenced from:
      terminalHasColors(int) in libLLVMSupport.a(Process.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bin/test-wordcount] Error 1
make[1]: *** [test/wordcount/CMakeFiles/test-wordcount.dir/all] Error 2
make: *** [all] Error 2

我错过了什么?

我的 Cmakelists.txt 文件 http://collabedit.com/8vc7s

【问题讨论】:

  • 那是你自己的项目吗?如果不是,它是什么版本的项目?如果是您自己的,请尝试将 CMakeLists.txt 中的 -L 替换为 -l(小写 L)。
  • @user2799037:我在 CMakeLists.txt 中没有看到任何 -L :(
  • 如何添加库?应该使用 `add_library CMake 会自动添加正确的 -L/-l。
  • @user2799037 :我很抱歉烦人.. 但这是我的文件:collabedit.com/8vc7s 我应该添加什么...我应该在哪里添加..
  • 我无法访问您的链接。一般来说,最好通过编辑将源的相关部分发布到问题中。也许您的问题与警告无关。您在其中一个 cmets OS X 中提到。也许这也是您的问题:stackoverflow.com/q/16352833

标签: c++ makefile cmake


【解决方案1】:

我知道这是一个旧堆栈,但在寻求此问题的解决方案时,它会出现在前几次搜索命中中。

在 OSX 中,您可能必须将“ncurses”添加到目标链接库。即:

TARGET_LINK_LIBRARIES (myProject ncurses ${LLVM_LIBRARY} [...你所有的图书馆])

【讨论】:

    【解决方案2】:

    您正在使用标头 term.h,但包含这些(导出的)符号(del_curterm,...)的库不在您的 LD 路径 term.h 上。找到适合您平台的库,安装它并将其添加到 -L swich 中。

    另见关于不存在目录的 ld 警告

    【讨论】:

    • 感谢您的回复..我正在使用山狮 OSX..?如何为我的平台安装 term.h 以及在哪里添加 -L 开关.. 很抱歉提出这样的基本问题
    • 试试你系统的包管理器(我没有那个操作系统)。 -L swich 是由 CMAKE 添加的,但可能安装的包最终会在 /usr/local/lib 或已经包含的某个地方
    • 嗨..再一次..这是文件collabedit.com/8vc7s我不知道在哪里添加什么? :(你能看一下文件并提出建议吗
    猜你喜欢
    • 2013-05-25
    • 2017-09-16
    • 1970-01-01
    • 2021-08-28
    • 2019-02-03
    • 2017-04-08
    • 2018-07-24
    • 1970-01-01
    • 2016-06-17
    相关资源
    最近更新 更多