faiss
faiss copied to clipboard
SWIG doesn't recognize `doxygen` while compiling from source
Summary
Building from source fails with swig error : Unrecognized option -doxygen. Weirdly, running swig -doxygen -python -c++ -I.. faiss/python/swigfaiss.swig works. This is swig 4.0.2.
Full traceback:
$ make -C build -j swigfaiss
make: Entering directory '/home/teven_huggingface_co/faiss/build'
make[1]: Entering directory '/home/teven_huggingface_co/faiss/build'
make[2]: Entering directory '/home/teven_huggingface_co/faiss/build'
make[3]: Entering directory '/home/teven_huggingface_co/faiss/build'
make[3]: Entering directory '/home/teven_huggingface_co/faiss/build'
make[3]: Leaving directory '/home/teven_huggingface_co/faiss/build'
make[3]: Leaving directory '/home/teven_huggingface_co/faiss/build'
make[3]: Entering directory '/home/teven_huggingface_co/faiss/build'
[ 2%] Swig compile swigfaiss.swig for python
[ 2%] Built target faiss_python_callbacks
swig error : Unrecognized option -doxygen
Use 'swig -help' for available options.
faiss/python/CMakeFiles/swigfaiss_swig_compilation.dir/build.make:246: recipe for target 'faiss/python/CMakeFiles/swigfaiss.dir/swigfaissPYTHON.stamp' failed
make[3]: *** [faiss/python/CMakeFiles/swigfaiss.dir/swigfaissPYTHON.stamp] Error 1
make[3]: *** Deleting file 'faiss/python/CMakeFiles/swigfaiss.dir/swigfaissPYTHON.stamp'
make[3]: Leaving directory '/home/teven_huggingface_co/faiss/build'
CMakeFiles/Makefile2:1110: recipe for target 'faiss/python/CMakeFiles/swigfaiss_swig_compilation.dir/all' failed
make[2]: *** [faiss/python/CMakeFiles/swigfaiss_swig_compilation.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....
make[3]: Entering directory '/home/teven_huggingface_co/faiss/build'
make[3]: Leaving directory '/home/teven_huggingface_co/faiss/build'
[100%] Built target faiss
make[2]: Leaving directory '/home/teven_huggingface_co/faiss/build'
CMakeFiles/Makefile2:1091: recipe for target 'faiss/python/CMakeFiles/swigfaiss.dir/rule' failed
make[1]: *** [faiss/python/CMakeFiles/swigfaiss.dir/rule] Error 2
make[1]: Leaving directory '/home/teven_huggingface_co/faiss/build'
Makefile:569: recipe for target 'swigfaiss' failed
make: *** [swigfaiss] Error 2
make: Leaving directory '/home/teven_huggingface_co/faiss/build'
Platform
OS: Ubuntu 18.04
Faiss version: bb4c987b5cc1d778b5b6a15641ef6074a7bfab2d
Installed from: compiled from source
Faiss compilation options: default, MKL is installed
Running on:
- [ ] CPU
- [x] GPU
Interface:
- [ ] C++
- [x] Python
Reproduction instructions
I am just following the install compile from source README at https://github.com/facebookresearch/faiss/blob/main/INSTALL.md#step-1-invoking-cmake.
Is there perhaps some way to compile without doxygen ?
The -doxygen flag was introduced in SWIG 4. You can either upgrade SWIG to that version or drop the -doxygen flag. That will just stop converting C++ doxygen comments into python docstrings.
swig -version returns 4.0.2, but maybe there's a conflicting installation issue. How can one remove the -doxygen flag ? Is it something to edit in the code, or a flag to pass ?
I also had it and I had a swig version problem (needed to re source the enviroment)
Anyway if you want to build with swig 3 and need to remove the -doxgen flag you can find the call to swig in: build/faiss/python/CMakeFiles/swigfaiss_swig_compilation.dir/build.make line 249
will just stop converting C++ doxygen comments into python docstrin
I also meet this problem. I have tried swig 4.0.2, swig 3.0.12, both of which do not recognize -doxygen. It'd be great if you team can specify the swig version requirements in the INSTALL.md.
will just stop converting C++ doxygen comments into python docstrin
I also meet this problem. I have tried swig 4.0.2, swig 3.0.12, both of which do not recognize -doxygen. It'd be great if you team can specify the swig version requirements in the INSTALL.md.
It maybe the "cmake" command detects an old version of swig, and I then installed a newer version of swig. So a method is to delete faiss and older versions of swig , and re-build faiss.
Install swig 4, and specify the SWIG_DIR and EXECUTABLE path. It solved my problem. I use conda to install swig4 on centos 7.
conda install swig
cmake -DFAISS_ENABLE_GPU=OFF -DSWIG_DIR=/opt/conda/share/swig/4.0.2 -DSWIG_EXECUTABLE=/opt/conda/bin/swig -B build . \
&& make -C build -j "$(nproc)" faiss \
&& make -C build -j "$(nproc)" swigfaiss
will just stop converting C++ doxygen comments into python docstrin
I also meet this problem. I have tried swig 4.0.2, swig 3.0.12, both of which do not recognize -doxygen. It'd be great if you team can specify the swig version requirements in the INSTALL.md.
swig 4.0.1 worked for me, but I had to clean up all the CMake build artifacts from when I had swig 3 installed.