faiss
faiss copied to clipboard
LINK: fatal error LNK1104: could not open “python311.lib”
Summary
compile output:
[1/3] Linking CXX shared library faiss\python\faiss_python_callbacks.dll
FAILED: faiss/python/faiss_python_callbacks.dll faiss/python/faiss_python_callbacks.lib
C:\windows\system32\cmd.exe /C "cd . && C:\Softwares\cmake\bin\cmake.exe -E vs_link_dll --intdir=faiss\python\CMakeFiles\faiss_python_callbacks.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests -- C:\PROGRA~1\MICROS~4\2022\COMMUN~1\VC\Tools\MSVC\1439~1.335\bin\Hostx64\x64\link.exe /nologo faiss\python\CMakeFiles\faiss_python_callbacks.dir\python_callbacks.cpp.obj /out:faiss\python\faiss_python_callbacks.dll /implib:faiss\python\faiss_python_callbacks.lib /pdb:faiss\python\faiss_python_callbacks.pdb /dll /version:0.0 /machine:x64 /INCREMENTAL:NO kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
LINK: command "C:\PROGRA~1\MICROS~4\2022\COMMUN~1\VC\Tools\MSVC\1439~1.335\bin\Hostx64\x64\link.exe /nologo faiss\python\CMakeFiles\faiss_python_callbacks.dir\python_callbacks.cpp.obj /out:faiss\python\faiss_python_callbacks.dll /implib:faiss\python\faiss_python_callbacks.lib /pdb:faiss\python\faiss_python_callbacks.pdb /dll /version:0.0 /machine:x64 /INCREMENTAL:NO kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST:EMBED,ID=2" failed (exit code 1104) with the following output:
LINK : fatal error LNK1104: 无法打开文件“python311.lib”
[2/3] Linking CXX shared library faiss\faiss.dll
ninja: build stopped: subcommand failed.
Platform
OS: windows 11
Faiss version: 1.8.0
Installed from: compiled by myself
Faiss compilation options: -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=D:\Softwares\3rdLib\faiss-1.8.0\install -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBLA_VENDOR=Intel10_64_dyn "-DMKL_LIBRARIES=D:\Softwares\3rdLib\Intel_oneAPI\mkl\2024.0\lib\mkl_intel_ilp64_dll.lib;D:\Softwares\3rdLib\Intel_oneAPI\mkl\2024.0\lib\mkl_intel_thread_dll.lib;D:\Softwares\3rdLib\Intel_oneAPI\mkl\2024.0\lib\mkl_core_dll.lib" -DSWIG_EXECUTABLE=D:\Softwares\3rdLib\swigwin-4.2.1\swig.exe -DSWIG_LIB=D:\Softwares\3rdLib\swigwin-4.2.1\Lib -DPython_EXECUTABLE=C:\Softwares\Python311\python.exe -DPython_LIBRARIES=C:\Softwares\Python311\libs\python311.lib
Running on:
- [] CPU
- [√] GPU
Interface:
- [√] C++
- [√] Python
Reproduction instructions
cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=D:\Softwares\3rdLib\faiss-1.8.0\install -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DBLA_VENDOR=Intel10_64_dyn "-DMKL_LIBRARIES=D:\Softwares\3rdLib\Intel_oneAPI\mkl\2024.0\lib\mkl_intel_ilp64_dll.lib;D:\Softwares\3rdLib\Intel_oneAPI\mkl\2024.0\lib\mkl_intel_thread_dll.lib;D:\Softwares\3rdLib\Intel_oneAPI\mkl\2024.0\lib\mkl_core_dll.lib" -DSWIG_EXECUTABLE=D:\Softwares\3rdLib\swigwin-4.2.1\swig.exe -DSWIG_LIB=D:\Softwares\3rdLib\swigwin-4.2.1\Lib -DPython_EXECUTABLE=C:\Softwares\Python311\python.exe -DPython_LIBRARIES=C:\Softwares\Python311\libs\python311.lib
ninja
It seems like your linker doesn't find python311.lib library.
LIB and LIBPATH are windows environment variables which are being used by the linker and compiler.
In which folder do you have python311.lib on your computer?
please confirm that LIB environment variable include the path for the python311.lib
If it didn't solve your problem - try adding python27.lib path also to LIBPATH
It seems like your linker doesn't find python311.lib library.
LIB and LIBPATH are windows environment variables which are being used by the linker and compiler.
In which folder do you have python311.lib on your computer?
please confirm that LIB environment variable include the path for the python311.lib
If it didn't solve your problem - try adding python27.lib path also to LIBPATH
After I added the environment variable
$Env:LIBPATH="C:\Softwares\Python311\libs"
$Env:LIB="C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\ATLMFC\lib\x64;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\lib\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22621.0\\um\x64;C:\Softwares\Python311\libs"
it reported the following error
[1/6] Linking CXX shared library faiss\python\faiss_python_callbacks.dll
FAILED: faiss/python/faiss_python_callbacks.dll faiss/python/faiss_python_callbacks.lib
C:\windows\system32\cmd.exe /C "cd . && C:\Softwares\cmake\bin\cmake.exe -E vs_link_dll --intdir=faiss\python\CMakeFiles\faiss_python_callbacks.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests -- C:\PROGRA~1\MICROS~4\2022\COMMUN~1\VC\Tools\MSVC\1439~1.335\bin\Hostx64\x64\link.exe /nologo faiss\python\CMakeFiles\faiss_python_callbacks.dir\python_callbacks.cpp.obj /out:faiss\python\faiss_python_callbacks.dll /implib:faiss\python\faiss_python_callbacks.lib /pdb:faiss\python\faiss_python_callbacks.pdb /dll /version:0.0 /machine:x64 /INCREMENTAL:NO kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
LINK: command "C:\PROGRA~1\MICROS~4\2022\COMMUN~1\VC\Tools\MSVC\1439~1.335\bin\Hostx64\x64\link.exe /nologo faiss\python\CMakeFiles\faiss_python_callbacks.dir\python_callbacks.cpp.obj /out:faiss\python\faiss_python_callbacks.dll /implib:faiss\python\faiss_python_callbacks.lib /pdb:faiss\python\faiss_python_callbacks.pdb /dll /version:0.0 /machine:x64 /INCREMENTAL:NO kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST:EMBED,ID=2" failed (exit code 1120) with the following output:
python_callbacks.cpp.obj : error LNK2019: 无法解析的外部符号 "public: __cdecl faiss::FaissException::FaissException(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char const *,char const *,int)" (??0FaissException@faiss@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PEBD1H@Z),函数 "public: virtual unsigned __int64 __cdecl PyCallbackIOReader::operator()(void *,unsigned __int64,unsigned __int64)" (??RPyCallbackIOReader@@UEAA_KPEAX_K1@Z) 中引用了该符号
python_callbacks.cpp.obj : error LNK2001: 无法解析的外部符号 "public: virtual char const * __cdecl faiss::FaissException::what(void)const " (?what@FaissException@faiss@@UEBAPEBDXZ)
python_callbacks.cpp.obj : error LNK2001: 无法解析的外部符号 "public: virtual int __cdecl faiss::IOReader::fileno(void)" (?fileno@IOReader@faiss@@UEAAHXZ)
python_callbacks.cpp.obj : error LNK2001: 无法解析的外部符号 "public: virtual int __cdecl faiss::IOWriter::fileno(void)" (?fileno@IOWriter@faiss@@UEAAHXZ)
faiss\python\faiss_python_callbacks.dll : fatal error LNK1120: 4 个无法解析的外部命令
[2/6] Linking CXX static library faiss\gpu\faiss_gpu.lib
ninja: build stopped: subcommand failed.