Hi. I can compile and run clip.cpp's main in the normal way and it works. It's cool, thanks.
I cannot compile and run clip.cpp's image-search functionality by using the cmake -DCLIP_BUILD_IMAGE_SEARCH=ON. When I do that it compiles the normal executables fine but upon reaching image search it fails. I attempted to go into the _deps for usearch and built them myself but that also failed to provide them in the right place, I think. I don't really know what the "error: ‘cos_gt’ is not a member of ‘unum::usearch’ " error means, I've been assuming the libs just aren't being found.
I am attempting to build on Debian 11 with g++ (Debian 10.2.1-6) 10.2.1 20210110. cmake version 3.18.4.
superkuh@janus:~/app_installs/clip.cpp/build4$ cmake -DCLIP_BUILD_IMAGE_SEARCH=ON ..
-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
-- CMAKE_SYSTEM_PROCESSOR: x86_64
-- x86 detected
-- CMAKE_SYSTEM_PROCESSOR: x86_64
-- x86 detected
-- Linux detected
-- Configuring done
-- Generating done
-- Build files have been written to: /home/superkuh/app_installs/clip.cpp/build4
superkuh@janus:~/app_installs/clip.cpp/build4$ l
total 84K
drwxr-xr-x 13 superkuh superkuh 4.0K Oct 8 12:25 ..
drwxr-xr-x 5 superkuh superkuh 4.0K Oct 8 12:25 _deps
-rw-r--r-- 1 superkuh superkuh 21K Oct 8 12:25 CMakeCache.txt
-rw-r--r-- 1 superkuh superkuh 12K Oct 8 12:25 Makefile
drwxr-xr-x 4 superkuh superkuh 4.0K Oct 8 12:25 ggml
-rw-r--r-- 1 superkuh superkuh 2.1K Oct 8 12:25 cmake_install.cmake
drwxr-xr-x 2 superkuh superkuh 4.0K Oct 8 12:25 bin
drwxr-xr-x 3 superkuh superkuh 4.0K Oct 8 12:25 models
drwxr-xr-x 4 superkuh superkuh 4.0K Oct 8 12:25 examples
drwxr-xr-x 3 superkuh superkuh 4.0K Oct 8 12:25 tests
-rw-r--r-- 1 superkuh superkuh 7.4K Oct 8 12:25 compile_commands.json
drwxr-xr-x 5 superkuh superkuh 4.0K Oct 8 12:25 CMakeFiles
drwxr-xr-x 9 superkuh superkuh 4.0K Oct 8 12:25 .
superkuh@janus:~/app_installs/clip.cpp/build4$ make
Scanning dependencies of target ggml
[ 4%] Building C object ggml/src/CMakeFiles/ggml.dir/ggml.c.o
[ 8%] Building C object ggml/src/CMakeFiles/ggml.dir/ggml-alloc.c.o
[ 13%] Linking C static library libggml.a
[ 13%] Built target ggml
Scanning dependencies of target clip
[ 17%] Building CXX object CMakeFiles/clip.dir/clip.cpp.o
[ 21%] Linking CXX static library libclip.a
[ 21%] Built target clip
Scanning dependencies of target quantize
[ 26%] Building CXX object models/CMakeFiles/quantize.dir/quantize.cpp.o
[ 30%] Linking CXX executable ../bin/quantize
[ 30%] Built target quantize
Scanning dependencies of target common-clip
[ 34%] Building CXX object examples/CMakeFiles/common-clip.dir/common-clip.cpp.o
[ 39%] Linking CXX static library libcommon-clip.a
[ 39%] Built target common-clip
Scanning dependencies of target extract
[ 43%] Building CXX object examples/CMakeFiles/extract.dir/extract.cpp.o
[ 47%] Linking CXX executable ../bin/extract
[ 47%] Built target extract
Scanning dependencies of target simple_c
[ 52%] Building C object examples/CMakeFiles/simple_c.dir/simple.c.o
[ 56%] Linking CXX executable ../bin/simple_c
[ 56%] Built target simple_c
Scanning dependencies of target zsl
[ 60%] Building CXX object examples/CMakeFiles/zsl.dir/zsl.cpp.o
[ 65%] Linking CXX executable ../bin/zsl
[ 65%] Built target zsl
Scanning dependencies of target main
[ 69%] Building CXX object examples/CMakeFiles/main.dir/main.cpp.o
[ 73%] Linking CXX executable ../bin/main
[ 73%] Built target main
Scanning dependencies of target image-search
[ 78%] Building CXX object examples/image-search/CMakeFiles/image-search.dir/search.cpp.o
/home/superkuh/app_installs/clip.cpp/examples/image-search/search.cpp: In function ‘int main(int, char**)’:
/home/superkuh/app_installs/clip.cpp/examples/image-search/search.cpp:114:44: error: ‘cos_gt’ is not a member of ‘unum::usearch’
114 | unum::usearch::index_gt<unum::usearch::cos_gt<float>> embd_index;
| ^~~~~~
/home/superkuh/app_installs/clip.cpp/examples/image-search/search.cpp:114:44: error: ‘cos_gt’ is not a member of ‘unum::usearch’
/home/superkuh/app_installs/clip.cpp/examples/image-search/search.cpp:114:56: error: template argument 1 is invalid
114 | unum::usearch::index_gt<unum::usearch::cos_gt<float>> embd_index;
| ^~
/home/superkuh/app_installs/clip.cpp/examples/image-search/search.cpp:116:16: error: request for member ‘view’ in ‘embd_index’, which is of non-class type ‘int’
116 | embd_index.view("images.usearch");
| ^~~~
/home/superkuh/app_installs/clip.cpp/examples/image-search/search.cpp:127:47: error: request for member ‘size’ in ‘embd_index’, which is of non-class type ‘int’
127 | if (image_file_index.size() != embd_index.size()) {
| ^~~~
/home/superkuh/app_installs/clip.cpp/examples/image-search/search.cpp:158:31: error: request for member ‘search’ in ‘embd_index’, which is of non-class type ‘int’
158 | auto results = embd_index.search({vec.data(), vec.size()}, params.n_results);
| ^~~~~~
make[2]: *** [examples/image-search/CMakeFiles/image-search.dir/build.make:82: examples/image-search/CMakeFiles/image-search.dir/search.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:473: examples/image-search/CMakeFiles/image-search.dir/all] Error 2
make: *** [Makefile:149: all] Error 2
I have looked in compile_commands.json for the relevant section which is failing and tried it by itself many times while altering other aspects (like where the _dep compiled stuff I did manually was).
superkuh@janus:~/app_installs/clip.cpp/build4/examples/image-search$ /usr/bin/c++ -DUSEARCH_USE_NATIVE_F16=0 -DUSEARCH_USE_OPENMP=0 -DUSEARCH_USE_SIMSIMD=0 -I/home/superkuh/app_installs/clip.cpp/. -I/home/superkuh/app_installs/clip.cpp/examples -I/home/superkuh/app_installs/clip.cpp/ggml/src/. -I/home/superkuh/app_installs/clip.cpp/ggml/src/../include -I/home/superkuh/app_installs/clip.cpp/ggml/src/../include/ggml -I/home/superkuh/app_installs/clip.cpp/build4/_deps/usearch-src/include -O3 -DNDEBUG -march=native -mf16c -mfma -mavx -mavx2 -o CMakeFiles/image-search.dir/search.cpp.o -c /home/superkuh/app_installs/clip.cpp/examples/image-search/search.cpp
/home/superkuh/app_installs/clip.cpp/examples/image-search/search.cpp: In function ‘int main(int, char**)’:
/home/superkuh/app_installs/clip.cpp/examples/image-search/search.cpp:114:44: error: ‘cos_gt’ is not a member of ‘unum::usearch’
114 | unum::usearch::index_gt<unum::usearch::cos_gt<float>> embd_index;
| ^~~~~~
/home/superkuh/app_installs/clip.cpp/examples/image-search/search.cpp:114:44: error: ‘cos_gt’ is not a member of ‘unum::usearch’
/home/superkuh/app_installs/clip.cpp/examples/image-search/search.cpp:114:56: error: template argument 1 is invalid
114 | unum::usearch::index_gt<unum::usearch::cos_gt<float>> embd_index;
| ^~
/home/superkuh/app_installs/clip.cpp/examples/image-search/search.cpp:116:16: error: request for member ‘view’ in ‘embd_index’, which is of non-class type ‘int’
116 | embd_index.view("images.usearch");
| ^~~~
/home/superkuh/app_installs/clip.cpp/examples/image-search/search.cpp:127:47: error: request for member ‘size’ in ‘embd_index’, which is of non-class type ‘int’
127 | if (image_file_index.size() != embd_index.size()) {
| ^~~~
/home/superkuh/app_installs/clip.cpp/examples/image-search/search.cpp:158:31: error: request for member ‘search’ in ‘embd_index’, which is of non-class type ‘int’
158 | auto results = embd_index.search({vec.data(), vec.size()}, params.n_results);
| ^~~~~~
I assumed the deps weren't being built. So I tried to build them myself,
superkuh@janus:~/app_installs/clip.cpp/build4/_deps/usearch-src$ cmake -DUSEARCH_BUILD_CLIB=YES .
-- Configuring done
-- Generating done
-- Build files have been written to: /home/superkuh/app_installs/clip.cpp/build4/_deps/usearch-src
superkuh@janus:~/app_installs/clip.cpp/build4/_deps/usearch-src$ make
[ 33%] Built target bench
[ 66%] Built target test
Scanning dependencies of target usearch_c
[ 83%] Building CXX object c/CMakeFiles/usearch_c.dir/lib.cpp.o
[100%] Linking CXX shared library ../libusearch_c.so
[100%] Built target usearch_c
But this, or similar attempts to build the various other parts of USearch _deps did not help. I cannot seem to get the compile of clip.cpp to know where the USearch libs are. If this is actually the problem.