0

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?

John
  • 31
  • 3
  • Did you actually link the library when building your application? With `-lffi`? – Lightness Races in Orbit Jul 12 '17 at 16:04
  • Did you follow the instructions on how to properly link Guile? https://www.gnu.org/software/guile/manual/guile.html#Linking-Guile-into-Programs perhaps (though I'm not sure which "guile" you're referring to) – Lightness Races in Orbit Jul 12 '17 at 16:05
  • The linking is done via a Makefile that is generated via a configure file. The configure file, in turn, is generated using auto tools, and the whole process starts from a download of guile-2.0.11 package from the GitHub repository and running the autogen.sh script file found in that package. More details of the options to the configure command and output from make can be found here: [link] (https://stackoverflow.com/questions/45013549/build-of-guile-2-0-11-on-macos-sierra-fails-undefined-symbols-for-architecture) – John Jul 13 '17 at 12:19

1 Answers1

0

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.

apaderno
  • 28,547
  • 16
  • 75
  • 90
John
  • 31
  • 3