架构 x86_64 的未定义符号:

7

我正在尝试在Mac OS X Mavericks 10.9.3 64位上编译此库:http://www.openfec.org/downloads.html

我按照README的说明进行,但出现了以下错误:

Linking C shared library ../../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: 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/Release/libopenfec.dylib] Error 1
make[1]: *
[src/CMakeFiles/openfec.dir/all] Error 2
make: *** [all] Error 2

我只是按照OpenFEC的发行版README(在http://www.openfec.org/downloads.html找到)进行操作。当尝试进行make时,出现了这个错误。 我不知道问题出在哪里。
解压分发文件后,我做了以下步骤: (1.): mkdir build (2.): cd build (3.): cmake .. -DDEBUG:STRING=OFF (4.): make 有什么想法吗?
编辑:尝试强制cmake使用64位,仍然没有用。 (为了好玩尝试强制使用32位,也没有用)

"Undefined symbols for architecture x86_64" 意味着该库是为其他架构构建的。该库目标架构可能是32位(即i386)。找出如何将此库构建为64位架构(x86_64)。 - Raviprakash
你能否看一下这个问题:使用cmake在64位架构上编译的问题。链接 - Raviprakash
我试了一下,但很遗憾它没有解决问题。 - h4x0rjax
1个回答

2

提供信息,如果这个问题没有解决。请检查你是否正确地链接到你的库。

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

在你的 CMakeLists.txt 文件中。

我对CMake还不熟悉,所以需要一点帮助。我正在使用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})我遇到了Undefined symbols for architecture x86_64的问题,涉及了boost库。请问我该如何使用您的建议(实际名称或别名)? - Patricia

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接