Failed to run the example
MrWWheat opened this issue · 1 comments
MrWWheat commented
Hi,
I am trying to use this go-faiss library, and I just download this repo from github. My env is local Mac machine.
I have already copy the libfaiss_c.so
to /usr/local/lib/libfaiss_c.so
, but when I run the example by go run example.go
, it shows:
# github.com/41tair/go-faiss/faiss
ld: warning: ignoring file /usr/local/lib/libfaiss_c.so, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 )
Undefined symbols for architecture x86_64:
"_faiss_Index_add_with_ids", referenced from:
_Insert in _x004.o
"_faiss_Index_search", referenced from:
_Search in _x004.o
"_faiss_get_last_error", referenced from:
_CreateIndex in _x004.o
_Insert in _x004.o
_Search in _x004.o
"_faiss_index_factory", referenced from:
_CreateIndex in _x004.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
# github.com/41tair/go-faiss/faiss
faiss_cgo.c:32:59: warning: incompatible pointer types passing 'long *' to parameter of type 'const idx_t *' (aka 'const long long *') [-Wincompatible-pointer-types]
faiss_cgo.c:17:13: note: expanded from macro 'FAISS_TRY'
../faiss/include/Index_c.h:83:87: note: passing argument to parameter 'xids' here
faiss_cgo.c:40:69: warning: incompatible pointer types passing 'long *' to parameter of type 'idx_t *' (aka 'long long *') [-Wincompatible-pointer-types]
faiss_cgo.c:17:13: note: expanded from macro 'FAISS_TRY'
../faiss/include/Index_c.h:96:49: note: passing argument to parameter 'labels' here```
By any chance you know the possible reason? Thanks!
41tair commented
this so file is build for linux, you need rebuild libfaiss_c.so for darwin.