Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error on Faiss due to missing #includes #3532

Closed
2 of 6 tasks
mfixman opened this issue Jun 21, 2024 · 1 comment
Closed
2 of 6 tasks

Build error on Faiss due to missing #includes #3532

mfixman opened this issue Jun 21, 2024 · 1 comment

Comments

@mfixman
Copy link

mfixman commented Jun 21, 2024

Summary

Compiling Faiss using cmake on my Linux desktop produces a build error.

~/packages/faiss $ cmake -B build . -DBUILD_SHARED_LIBS=ON -DFAISS_ENABLE_C_API=ON
# [...]
~/packages/faiss $ cmake --build build -j20
# [...]
~/packages/faiss/tests/test_ivf_index.cpp:232:26: error: no matching function for call to ‘fi
nd(std::set<long unsigned int>::iterator, std::set<long unsigned int>::iterator, long unsigned int&)’    
  232 |                 std::find(                                                                       
      |                 ~~~~~~~~~^                                                                       
  233 |                         lists_probed.cbegin(),                                                   
      |                         ~~~~~~~~~~~~~~~~~~~~~~                                                   
  234 |                         lists_probed.cend(),                                                     
      |                         ~~~~~~~~~~~~~~~~~~~~                                                     
  235 |                         query_vector_listno) != lists_probed.cend())                             
      |                         ~~~~~~~~~~~~~~~~~~~~                                                     

This can be solved by including set and algorithm to test_ivf_index.cpp.

Platform

OS: Arch Linux

Faiss version: e758973fa08164728eb9e136631fe6c57d7edf6c

Installed from: Attempting to compile with cmake

Faiss compilation options: -DBUILD_SHARED_LIBS=ON -DFAISS_ENABLE_C_API=ON

Running on:

  • CPU
  • GPU
  • Compiling for GPU

Interface:

  • C++
  • Python
  • Cmake

Reproduction instructions

~/packages/faiss $  cmake -B build . -DBUILD_SHARED_LIBS=ON -DFAISS_ENABLE_C_API=ON
~/packages/faiss $ cmake --build build -j20

[ 87%] Building CXX object c_api/CMakeFiles/faiss_c.dir/gpu/StandardGpuResources_c.cpp.o                 
In file included from /home/mfixman/packages/faiss/build/_deps/googletest-src/googletest/include/gtest/gt
est-printers.h:114,                                                                                      
                 from /home/mfixman/packages/faiss/build/_deps/googletest-src/googletest/include/gtest/gt
est-matchers.h:48,                                                                                       
                 from /home/mfixman/packages/faiss/build/_deps/googletest-src/googletest/include/gtest/in
ternal/gtest-death-test-internal.h:46,                                                                   
                 from /home/mfixman/packages/faiss/build/_deps/googletest-src/googletest/include/gtest/gt
est-death-test.h:43,                                                                                     
                 from /home/mfixman/packages/faiss/build/_deps/googletest-src/googletest/include/gtest/gt
est.h:60,                                                                                                
                 from /home/mfixman/packages/faiss/tests/test_ivf_index.cpp:16:                          
/home/mfixman/packages/faiss/tests/test_ivf_index.cpp: In member function ‘virtual void IVF_list_context_
Test::TestBody()’:                                                                                       
/home/mfixman/packages/faiss/tests/test_ivf_index.cpp:232:26: error: no matching function for call to ‘fi
nd(std::set<long unsigned int>::iterator, std::set<long unsigned int>::iterator, long unsigned int&)’    
  232 |                 std::find(                                                                       
      |                 ~~~~~~~~~^                                                                       
  233 |                         lists_probed.cbegin(),                                                   
      |                         ~~~~~~~~~~~~~~~~~~~~~~                                                   
  234 |                         lists_probed.cend(),                                                     
      |                         ~~~~~~~~~~~~~~~~~~~~                                                     
  235 |                         query_vector_listno) != lists_probed.cend())                             
      |                         ~~~~~~~~~~~~~~~~~~~~                                                     

Proposed solution

This can be fixed by adding two missing #includes to test_ivf_index.cpp.

diff --git a/tests/test_ivf_index.cpp b/tests/test_ivf_index.cpp
index 54cb7945..8e4530a9 100644
--- a/tests/test_ivf_index.cpp
+++ b/tests/test_ivf_index.cpp
@@ -12,6 +12,8 @@
 #include <cstring>
 #include <map>
 #include <random>
+#include <set>
+#include <algorithm>
 
 #include <gtest/gtest.h>
~/packages/faiss $ cmake --build build -j20                                                       
[  1%] Built target swigfaiss_swig_compilation                                                           
[  1%] Built target faiss_python_callbacks                                                               
[  3%] Built target gtest                                                                                
[  3%] Built target gtest_main                                                                           
[ 53%] Built target faiss_gpu                                                                            
[ 77%] Built target faiss                                                                                
[ 77%] Built target swigfaiss                                                                            
[ 79%] Built target faiss_gpu_test_helper                                                                
[ 80%] Linking CXX executable TestGpuIndexBinaryFlat                                                     
[ 80%] Linking CXX executable TestGpuIndexIVFFlat                                                        
[ 80%] Linking CXX executable TestGpuIndexIVFScalarQuantizer                                             
[ 88%] Built target faiss_c                                                                              
[ 88%] Linking CXX executable TestGpuIndexFlat                                                           
[ 88%] Linking CUDA executable TestGpuDistance                                                           
[ 90%] Linking CXX executable TestGpuIndexIVFPQ                                                          
[ 90%] Linking CXX executable TestCodePacking                                                            
[ 90%] Linking CXX executable TestGpuMemoryException                                                     
[ 92%] Linking CUDA executable TestGpuSelect                                                             
[ 92%] Building CXX object tests/CMakeFiles/faiss_test.dir/test_ivf_index.cpp.o                          
[ 92%] Built target TestCodePacking                                                                      
[ 92%] Built target TestGpuSelect                                                                        
[ 92%] Built target TestGpuIndexBinaryFlat                                                               
[ 92%] Built target TestGpuMemoryException                                                               
[ 92%] Built target TestGpuIndexFlat                                                                     
[ 92%] Built target TestGpuIndexIVFPQ                                                                    
[ 92%] Built target TestGpuDistance                                                                      
[ 92%] Built target TestGpuIndexIVFScalarQuantizer                                                       
[ 92%] Built target TestGpuIndexIVFFlat                                                                  
[ 92%] Linking CXX executable faiss_test                                                                 
WARNING clustering 1000 points to 40 centroids: please provide at least 1560 training points             
[100%] Built target faiss_test                                                                           
facebook-github-bot referenced this issue Jul 1, 2024
Summary:
The current version of Faiss cannot be built due to missing `#include`s on a test file `tests/test_ivf_index.cpp`. This is better described in issue [https://github.com/facebookresearch/faiss/issues/3532](https://github.com/facebookresearch/faiss/issues/3532).

This adds the missing imports.


Reviewed By: asadoughi

Differential Revision: D58899187

Pulled By: junjieqi
facebook-github-bot pushed a commit that referenced this issue Jul 3, 2024
Summary:
The current version of Faiss cannot be built due to missing #includes on a test file tests/test_ivf_index.cpp. This is better described in issue #3532.


#3533

Differential Revision: D59314273
junjieqi added a commit that referenced this issue Jul 3, 2024
Summary:
Pull Request resolved: #3609

The current version of Faiss cannot be built due to missing #includes on a test file tests/test_ivf_index.cpp. This is better described in issue #3532.

#3533

Differential Revision: D59314273
facebook-github-bot pushed a commit that referenced this issue Jul 3, 2024
Summary:
Pull Request resolved: #3609

The current version of Faiss cannot be built due to missing #includes on a test file tests/test_ivf_index.cpp. This is better described in issue #3532.

#3533

Reviewed By: ramilbakhshyiev

Differential Revision: D59314273

fbshipit-source-id: 6ec8bfa973760d0a44bc94ae751b4fc55c4784ef
@junjieqi
Copy link
Contributor

junjieqi commented Jul 3, 2024

fixed

@junjieqi junjieqi closed this as completed Jul 3, 2024
abhinavdangeti pushed a commit to blevesearch/faiss that referenced this issue Jul 12, 2024
…earch#3609)

Summary:
Pull Request resolved: facebookresearch#3609

The current version of Faiss cannot be built due to missing #includes on a test file tests/test_ivf_index.cpp. This is better described in issue facebookresearch#3532.

facebookresearch#3533

Reviewed By: ramilbakhshyiev

Differential Revision: D59314273

fbshipit-source-id: 6ec8bfa973760d0a44bc94ae751b4fc55c4784ef
ketor pushed a commit to dingodb/faiss that referenced this issue Aug 20, 2024
…earch#3609)

Summary:
Pull Request resolved: facebookresearch#3609

The current version of Faiss cannot be built due to missing #includes on a test file tests/test_ivf_index.cpp. This is better described in issue facebookresearch#3532.

facebookresearch#3533

Reviewed By: ramilbakhshyiev

Differential Revision: D59314273

fbshipit-source-id: 6ec8bfa973760d0a44bc94ae751b4fc55c4784ef
aalekhpatel07 pushed a commit to aalekhpatel07/faiss that referenced this issue Oct 17, 2024
…earch#3609)

Summary:
Pull Request resolved: facebookresearch#3609

The current version of Faiss cannot be built due to missing #includes on a test file tests/test_ivf_index.cpp. This is better described in issue facebookresearch#3532.

facebookresearch#3533

Reviewed By: ramilbakhshyiev

Differential Revision: D59314273

fbshipit-source-id: 6ec8bfa973760d0a44bc94ae751b4fc55c4784ef
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants