openzim / python-libzim

Libzim binding for Python: read/write ZIM files in Python
https://pypi.org/project/libzim/
GNU General Public License v3.0
62 stars 20 forks source link

Support Microsoft Windows #91

Closed kelson42 closed 2 days ago

kelson42 commented 3 years ago

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

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

stale[bot] commented 2 years ago

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] commented 2 years ago

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.

abdnh commented 1 year ago

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?

kelson42 commented 1 year ago

We should and will move forward soon on this.