yara-python
yara-python copied to clipboard
Unable to build on Windows
using python setup.py build
on Windows 10 fails with the error
running build
running build_ext
creating Users
error: [WinError 1] Incorrect function
executing the command through an elevated cmd.
same Error plz help us running build running build_ext creating Users error: [WinError 1] Incorrect function
I recently ran into this issue in my Windows docker container. I found that setting environment variable PYTHONLEGACYWINDOWSSTDIO
helps. The problem is with os.dup2
function call which cannot be used with std* streams if this variable is not set for some reason. Didn't spend much time researching it.
Thanks @metthal was going crazy on how to do this.
Set PYTHONLEGACYWINDOWSSTDIO
to 1
worked but I got another error during complication
"D:\Program Files\VS2022\VC\Tools\MSVC\14.33.31629\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DUSE_WINDOWS_PROC=1 -D_CRT_SECURE_NO_WARNINGS=1 -DHAVE_STDBOOL_H=1 -DHASH_MODULE=1 -DHAVE_WINCRYPT_H=1 -Iyara/libyara/include -Iyara/libyara/ -I. -IF:\Python3\include -IF:\Python3\Include "-ID:\Program Files\VS2022\VC\Tools\MSVC\14.33.31629\include" "-ID:\Program Files\VS2022\VC\Tools\MSVC\14.33.31629\ATLMFC\include" "-ID:\Program Files\VS2022\VC\Auxiliary\VS\include" "-ID:\Windows Kits\10\include\10.0.20348.0\ucrt" "-ID:\Windows Kits\10\\include\10.0.20348.0\\um" "-ID:\Windows Kits\10\\include\10.0.20348.0\\shared" "-ID:\Windows Kits\10\\include\10.0.20348.0\\winrt" "-ID:\Windows Kits\10\\include\10.0.20348.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /Tcyara\libyara\modules\pe\authenticode-parser\authenticode.c /Fobuild\temp.win-amd64-cpython-310\Release\yara\libyara\modules\pe\authenticode-parser\authenticode.obj
authenticode.c
yara\libyara\modules\pe\authenticode-parser\authenticode.c(22): fatal error C1083: Cannot open include file: 'openssl/asn1.h': No such file or directory
error: command 'D:\\Program Files\\VS2022\\VC\\Tools\\MSVC\\14.33.31629\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2