【问题标题】:"Undefined symbols for architecture x86_64:"“架构 x86_64 的未定义符号:”
【发布时间】:2014-08-07 20:31:44
【问题描述】:

我正在尝试在 mac os x Mavericks 10.9.3 64 位上编译这个库:http://www.openfec.org/downloads.html

我完全按照自述文件进行操作,得到了这个错误:

链接 C 共享库 ../../bin/Release/libopenfec.dylib

   Undefined symbols for architecture x86_64:
      "_of_add_from_multiple_symbols", referenced from:
         _of_linear_binary_code_backward_substitution in of_ml_tool.c.o
      "_of_add_to_symbol", referenced from:
         _of_linear_binary_code_decode_with_new_symbol in of_it_decoding.c.o
         _of_linear_binary_code_simplify_linear_system in of_ml_decoding.c.o
         _of_linear_binary_code_col_forward_elimination_pivot_reordering in of_ml_tool.c.o
         _of_linear_binary_code_apply_gauss_pivoting in of_ml_tool_2.c.o
         _of_linear_binary_code_inject_symbol_in_triangular_system in of_ml_tool_2.c.o
         _of_linear_binary_code_solve_triangular_system in of_ml_tool_2.c.o
         _of_linear_binary_code_invert_dense_system in of_ml_tool_2.c.o
         ...
      "_of_calloc", referenced from...:
         ...

ld:未找到架构 x86_64 的符号
clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)
make[2]: * [../bin/Release/libopenfec.dylib] 错误 1
make[1]: *
[src/CMakeFiles/openfec.dir/all] 错误 2
make: *** [all] 错误 2

我只是按照 OpenFEC 发行版的自述文件(在http://www.openfec.org/downloads.html 找到)。尝试制作时,会出现此错误。 我不知道是什么问题。

这是我解压发行版后所做的:
(1.): mkdir 构建
(2.): cd 构建
(3.): cmake .. -DDEBUG:STRING=OFF
(4.): 制作

有什么想法吗?

编辑:试图强制 cmake 使用 64 位,仍然没有工作。
(试图强制它进入 32 位只是为了踢,也没有工作)

【问题讨论】:

  • “架构 x86_64 的未定义符号”表示该库是为其他架构构建的。库目标架构可以是 32 位(即 i386)。了解如何为 64 位架构 (x86_64) 构建此库。
  • 你可以看看this question 使用 cmake 在 64 位架构中编译。
  • 我做到了,我尝试过。不幸的是,这并没有解决问题。

标签: xcode macos cmake clang dylib


【解决方案1】:

仅供参考,如果没有解决。检查您是否正确链接到您的库。

FIND_LIBRARY(LIB_NAME_LIB lib)
TARGET_LINK_LIBRARIES(my_executable ${LIB_NAME_LIB})

在您的 CMakeLists.txt 文件中。

【讨论】:

  • 我是 CMake 新手,所以在这里我需要一点帮助。我正在为架构 x86_64 获取未定义符号以进行提升。我正在使用 CLion,它使用 Cmake。这是我在 CMakeLists.txt 文件底部的内容: find_package(OpenCV REQUIRED) find_package(Boost 1.55.0 REQUIRED COMPONENTS filesystem thread chrono system atomic program_options) include_directories(${Boost_INCLUDE_DIRS}) add_executable(Oneprint ${SOURCE_FILES}) target_link_libraries(Oneprint ${OpenCV_LIBS}) target_link_libraries(Oneprint ${Boost_LIBRARIES}) 我将如何使用您的上述建议(实际名称或别名)?
猜你喜欢
  • 1970-01-01
  • 2012-07-20
  • 1970-01-01
  • 2015-08-23
  • 2014-05-27
  • 2017-07-06
  • 2016-06-20
  • 2016-06-14
  • 2017-08-25
相关资源
最近更新 更多