kiyo-masui / bitshuffle

Filter for improving compression of typed binary data.
Other
219 stars 76 forks source link

Unresolved external symbols when building with MSVC on Windows 10 #150

Closed mattjala closed 8 months ago

mattjala commented 9 months ago

OS: 64-bit Windows 10.0.19045 Build 19045 Python: Python 3.10.11 [MSC v.1929 64 bit (AMD64)] on win32 Compiler: MSVC 14.38

I'm attempting to build bitshuffle from source on Windows 10. The full output from executing python setup.py install in the Developer Command Prompt for VS 2022 is in the attached log.txt, but I believe the relevant section to be:

   Creating library build\temp.win32-cpython-310\Release\bitshuffle\ext.cp310-win_amd64.lib and object build\temp.win32-cpython-310\Release\bitshuffle\ext.cp310-win_amd64.exp
ext.obj : error LNK2001: unresolved external symbol __imp__PyBaseObject_Type
ext.obj : error LNK2001: unresolved external symbol __imp__PyGC_Enable
...
build\lib.win32-cpython-310\bitshuffle\ext.cp310-win_amd64.pyd : fatal error LNK1120: 160 unresolved externals
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX86\\x86\\link.exe' failed with exit code 1120

From some searching, this appears to be an issue with the compiler not being able to locate the python library at linking time. I've added the path to my python installations libs directory to the LIBPATH system environment variable, and added the path to python's include directory to the INCLUDE environment variable, but the issue persists. I've checked from the command prompt that the paths in these system environment variables are appended to the environment variables set up by the developer command prompt, so I'm not sure why the library isn't found during linking.

log.txt

mattjala commented 8 months ago

I was able to install bitshuffle successfully by making the following changes: