"Undefined symbols for architecture x86_64:"

h4x0rjax picture h4x0rjax · Jun 17, 2014 · Viewed 24.3k times · Source

I am attempting to compile this library on mac os x Mavericks 10.9.3 64-bit: http://www.openfec.org/downloads.html

I followed the README exactly, and got this error:

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

I simply followed the README for OpenFEC's distro (found at http://www.openfec.org/downloads.html). When attempting to make, this error arises. I have no idea what the problem is.

This is what I did after untarring the distribution:
(1.): mkdir build
(2.): cd build
(3.): cmake .. -DDEBUG:STRING=OFF
(4.): make

Any ideas?

Edit: Attempted to force cmake to use 64-bit, still didn't work.
(Tried to force it into 32-bit just for kicks, also didn't work)

Answer

zcourts picture zcourts · Oct 27, 2014

FYI, if this wasn't resolved. Check that you're linking to your libraries properly.

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

In your CMakeLists.txt file.