python-libzim icon indicating copy to clipboard operation
python-libzim copied to clipboard

Support Microsoft Windows

Open kelson42 opened this issue 4 years ago • 4 comments

In which format should be provided the libzim? A .dll? A .lib?

Depends on https://github.com/kiwix/kiwix-build/issues/466

kelson42 avatar Jan 10 '21 14:01 kelson42

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

stale[bot] avatar Jan 03 '22 21:01 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

stale[bot] avatar Aug 13 '22 08:08 stale[bot]

Any progress on this? I'm interested in using python-libzim in this project.

I was apparently successful in building .dll of libzim, but trying to make python-libzim use it yields the following errors:

> python setup.py bdist_wheel
Found lizim library and headers in local directory. Will use them to compile python-libzim.
Hint : If you don't want to use them (and use “system” installed one), remove them.        
running bdist_wheel
running build   
running build_py
running egg_info
writing libzim.egg-info\PKG-INFO
writing dependency_links to libzim.egg-info\dependency_links.txt
writing top-level names to libzim.egg-info\top_level.txt        
reading manifest file 'libzim.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'lib\libzim.7.dylib'
warning: no files found matching 'lib\libzim.so.7'
warning: no files found matching 'libzim\*.cxx'
warning: no files found matching 'libzim\*.py'
warning: no previously-included files matching '__pycache__\*' found anywhere in distribution
adding license file 'LICENSE'
writing manifest file 'libzim.egg-info\SOURCES.txt'
running build_ext
building 'libzim' extension
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -Ilibzim -Iinclude -ID:\dev\repos\python-libzim\venv\include -IC:\Python\include -IC:\Python\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /EHsc /Tplibzim/libwrapper.cpp /Fobuild\temp.win-amd64-cpython-39\Release\libzim/libwrapper.objlibwrapper.cpp
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -Ilibzim -Iinclude -ID:\dev\repos\python-libzim\venv\include -IC:\Python\include -IC:\Python\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /EHsc /Tplibzim/libzim.cpp /Fobuild\temp.win-amd64-cpython-39\Release\libzim/libzim.obj        
libzim.cpp
libzim/libzim.cpp(2345): warning C4190: 'string_cy_call_fct' has C-linkage specified, but returns UDT 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' which is incompatible with C
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xstring(4905): note: see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>'
libzim/libzim.cpp(2346): warning C4190: 'blob_cy_call_fct' has C-linkage specified, but returns UDT 'wrapper::Blob' which is incompatible 
with C
D:\dev\repos\python-libzim\libzim\libwrapper.h(97): note: see declaration of 'wrapper::Blob'
libzim/libzim.cpp(2352): error C2526: 'geoposition_cy_call_fct': C linkage function cannot return C++ class 'std::tuple<bool,double,double>'
include\zim/writer/item.h(44): note: see declaration of 'std::tuple<bool,double,double>'
libzim/libzim.cpp(2353): warning C4190: 'convertToCppHints' has C-linkage specified, but returns UDT 'std::map<zim::writer::HintKeys,uint64_t,std::less<zim::writer::HintKeys>,std::allocator<std::pair<const zim::writer::HintKeys,uint64_t>>>' which is incompatible with C       
include\zim/writer/item.h(39): note: see declaration of 'std::map<zim::writer::HintKeys,uint64_t,std::less<zim::writer::HintKeys>,std::allocator<std::pair<const zim::writer::HintKeys,uint64_t>>>'
libzim/libzim.cpp(2354): warning C4190: 'hints_cy_call_fct' has C-linkage specified, but returns UDT 'std::map<zim::writer::HintKeys,uint64_t,std::less<zim::writer::HintKeys>,std::allocator<std::pair<const zim::writer::HintKeys,uint64_t>>>' which is incompatible with C       
include\zim/writer/item.h(39): note: see declaration of 'std::map<zim::writer::HintKeys,uint64_t,std::less<zim::writer::HintKeys>,std::allocator<std::pair<const zim::writer::HintKeys,uint64_t>>>'
libzim/libzim.cpp(5840): error C2556: 'zim::writer::IndexData::GeoPosition geoposition_cy_call_fct(PyObject *,std::string,std::string *)': overloaded function differs only by return type from 'void geoposition_cy_call_fct(PyObject *,std::string,std::string *)'
libzim/libzim.cpp(2352): note: see declaration of 'geoposition_cy_call_fct'
libzim/libzim.cpp(5840): error C2371: 'geoposition_cy_call_fct': redefinition; different basic types
libzim/libzim.cpp(2352): note: see declaration of 'geoposition_cy_call_fct'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2

(I probably have to upgrade my MSVC installation; will try that and post any positive updates).

How does Kiwix make libzim work on Windows (I understand it's cross-compiled)? Can the binaries produced by the build process be made available?

abdnh avatar Oct 04 '22 21:10 abdnh

We should and will move forward soon on this.

kelson42 avatar Oct 05 '22 06:10 kelson42