2014-03-27 41 views
2

我一直在嘗試編譯最近使用​​和sqlexpr的應用程序,但我遇到了符號未解決的問題。我從OPAM構建了ctypes和sqlexpr,並從brew中更新了libffi版本,但不明白爲什麼我可能無法獲得正確的庫鏈接。任何人都在意猜測? (我已經盡我的這個典型的修復,這是CFLAGS="-arch i386"通過)爲mac ocaml構建的未定義符號

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 

回答

1

https://github.com/ocaml/opam-repository/issues/398,看起來這是用在Mac OS X 10.7.5的sqlite的一個問題。

「開關在被指定包的順序解決問題」

+0

謝謝,我實際上在幾個小時前發現了這一點,但我很欣賞這種見解,並且希望將答案保留在歷史記錄中! –

0

要回答這個問題,我把托馬斯·倫納德的解決方案,也有我的Mac上安裝的libffi一個新版本。我不得不在brew中強制連接libffi,並且在/usr/lib/libffi.dylib中刪除了libffi的版本,並在brew的地下室中將其指向我的版本。做完這些之後,隨着切換OCamlBuild包的順序,事情成功了。

相關問題