2

我一直在尝试编译一个使用ctypesand的最新应用程序sqlexpr,但是我遇到了符号无法解析的问题。我从 OPAM 构建了 ctypes 和 sqlexpr,并更新了libffibrew 的版本,但不明白为什么我可能无法获得正确的库链接。有谁愿意猜一猜吗?(我已经尝试过我的典型解决方法,即传入CFLAGS="-arch i386"

Undefined symbols for architecture x86_64:
  "_ffi_closure_alloc", referenced from:
      _ctypes_make_function_pointer in libctypes-foreign-base_stubs.a(ffi_call_stubs.o)
  "_ffi_prep_closure_loc", referenced from:
      _ctypes_make_function_pointer in libctypes-foreign-base_stubs.a(ffi_call_stubs.o)
  "_sqlite3_enable_load_extension", referenced from:
      _caml_sqlite3_enable_load_extension in libsqlite3_stubs.a(sqlite3_stubs.o)
     (maybe you meant: _caml_sqlite3_enable_load_extension)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
File "_none_", line 1:
Error: Error while building custom runtime system
Command exited with code 2.
Compilation unsuccessful after building 41 targets (40 cached) in 00:00:00.
make: *** [all] Error 10
4

2 回答 2

1

https://github.com/ocaml/opam-repository/issues/398,看起来这是 Mac OS X 10.7.5 上的 sqlite 的问题。

“切换指定包的顺序可以解决问题”

于 2014-03-28T16:22:30.383 回答
0

为了回答这个问题,我采用了 Thomas Leonard 的解决方案,并且还必须libffi在我的 mac 上安装新版本。我不得不libffi在 brew 中强制链接,并删除了libffiin的版本/usr/lib/libffi.dylib,并将其指向我在 brew 地窖中的版本。完成这些之后,随着切换 OCamlBuild 包顺序,事情成功了。

于 2014-03-28T17:28:46.377 回答