问题
I am trying to link a file, "lib guile_2.0_la-foreign.o" in order to build guile-2.0.11 on macOS Sierra. The ld command from the make file returns more than a dozen errors similar to
"_ffi_type_float", referenced from:
_fill_ffi_type in lib guile_2.0_la-foreign.o
ld: symbol(s) not found for architecture x86_64
where the "_ffi_type_xxx" varies in the "xxx" position. I have installed libffi with hombrew, and have told CPPFLAGS and LDFLAGS where to find the lib and include directories, but I still get the same error. Where are these symbols to be found?
回答1:
In Makefile, there is an environment variable (LIBFFI_LIBS) that specifies the path to the ffi library. I was missing the flag telling the linker to actually link the library.
I changed its value from LIBFFI_LIBS="-L/usr/local/opt/libffi/lib"
to LIBFFI_LIBS="-L/usr/local/opt/libffi/lib -lffi"
and all errors about undefined ffi symbols have now disappeared.
来源:https://stackoverflow.com/questions/45062678/where-are-ffi-symbols-defined