Open voltagex opened 1 year ago
In case anyone else stumbles upon this.
The error message directing you to https://visualstudio.microsoft.com/visual-cpp-build-tools/ is either wrong, bad or incomplete.
setup.py build_ext
is running "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -prerelease -requiresAny -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -products *
which wasn't returning anything even though the "Visual Studio Build Tools" were supposedly installed (hell, I had a developer command prompt and everything)
https://learn.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2022 shows that at the time of writing, you'll want to go to the VS installer and install Microsoft.VisualStudio.Component.VC.Tools.x86.x64
or more likely, tick the box that says MSVC v143 - VS 2022 C++ x64/x86 build tools (Latest)
This looks like it will not fix this particular issue with libarchive, as it needs io.h
, which appears to be a non-portable header from Unix. Which is strange, as Microsoft ship something libarchive-shaped in tar.exe
on Windows 10.
Got stuck in hell. io.h is in the ucrt, but the generated C doesn't seem to be compatible with MSVC.
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(3977): error C2065: 'mode_t': undeclared identifier
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(3977): error C2146: syntax error: missing ';' before identifier 'result'
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(3977): error C2065: 'result': undeclared identifier
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(3986): error C2065: 'result': undeclared identifier
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(3987): error C2065: 'mode_t': undeclared identifier
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(3987): error C2059: syntax error: ')'
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(4296): error C2065: 'mode_t': undeclared identifier
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(4296): error C2146: syntax error: missing ';' before identifier 'result'
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(4296): error C2065: 'result': undeclared identifier
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(4305): error C2065: 'result': undeclared identifier
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(4306): error C2065: 'mode_t': undeclared identifier
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(4306): error C2059: syntax error: ')'
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(4482): error C2065: 'mode_t': undeclared identifier
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(4482): error C2146: syntax error: missing ';' before identifier 'result'
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(4482): error C2065: 'result': undeclared identifier
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(4491): error C2065: 'result': undeclared identifier
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(4492): error C2065: 'mode_t': undeclared identifier
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(4492): error C2059: syntax error: ')'
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(5945): error C2065: 'mode_t': undeclared identifier
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(5945): error C2146: syntax error: missing ';' before identifier 'arg2'
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(5945): error C2065: 'arg2': undeclared identifier
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(5966): error C2065: 'arg2': undeclared identifier
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(5966): error C2065: 'mode_t': undeclared identifier
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(5966): error C2059: syntax error: ')'
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(5969): error C2065: 'arg2': undeclared identifier
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(6231): error C2065: 'mode_t': undeclared identifier
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(6231): error C2146: syntax error: missing ';' before identifier 'arg2'
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(6231): error C2065: 'arg2': undeclared identifier
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(6252): error C2065: 'arg2': undeclared identifier
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(6252): error C2065: 'mode_t': undeclared identifier
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(6252): error C2059: syntax error: ')'
C:\git\archive-test\python-libarchive\libarchive\_libarchive_wrap.c(6255): error C2065: 'arg2': undeclared identifier
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.35.32215\\bin\\HostX86\\x86\\cl.exe' failed with exit code 2
libarchive is able to be compiled on Windows, but I'm not the one to be able to fix this.
I can get as far as libarchive loading now, but attempting to use it results in
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\git\archive-test\venv\lib\site-packages\python_libarchive-4.2.1-py3.10-win-amd64.egg\libarchive\__init__.py", line 46, in <module>
None: (_libarchive.archive_read_support_format_all, None),
AttributeError: module 'libarchive._libarchive' has no attribute 'archive_read_support_format_all'
0001-Hack-for-Windows-support.patch is a very messy hack around setup.py build_ext.
I also regenerated the SWIG bindings and upgraded libarchive, which is probably what's causing me issues.
To get to this point:
vcpkg install libarchive:x64-windows
archive.lib
in the same path setup.py was running from0001-Slightly-better-hack-for-Windows.patch
This time I didn't accidentally remove half the functions.
Windows 10, VS2022 build tools are installed, Python 3.10.10