VirusTotal / yara-python

The Python interface for YARA
http://virustotal.github.io/yara/
Apache License 2.0
659 stars 179 forks source link

Unable to compile under Windows 10 #15

Closed ghost closed 7 years ago

ghost commented 8 years ago

I am unable to compile under Windows 10 . I have installed VC++ for Python.

Can you help?

Here is the output:

C:\Python27\Scripts>pip.exe install yara-python Collecting yara-python Using cached yara-python-3.4.0.00.tar.gz Installing collected packages: yara-python Running setup.py install for yara-python ... error Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;file='c:\users\mlabelle\appdata\local\temp\pip-build-ygl0dc\yara-python\setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record c:\users\mlabelle\appdata\local\temp\pip-1ojqtr-record\install-record.txt --single-version-externally-managed --compile: c:\python27\lib\site-packages\setuptools\dist.py:285: UserWarning: Normalizing '3.4.0.00' to '3.4.0.0' normalized_version, running install running build running build_ext building 'yara' extension creating build creating build\temp.win32-2.7 creating build\temp.win32-2.7\Release creating build\temp.win32-2.7\Release\yara creating build\temp.win32-2.7\Release\yara\libyara creating build\temp.win32-2.7\Release\yara\libyara\modules C:\Users\mlabelle\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -D_CRT_SECURE_NO_WARNINGS=1 -DHASH=1 -Iyara/libyara/include -Iyara/libyara/ -I. -Iyara/windows/include -Ic:\python27\include -Ic:\python27\PC /Tcyara-python.c /Fobuild\temp.win32-2.7\Release\yara-python.obj -O3 cl : Command line warning D9002 : ignoring unknown option '-O3' yara-python.c c:\users\mlabelle\appdata\local\temp\pip-build-ygl0dc\yara-python\yara\libyara\include\yara/filemap.h(34) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory error: command 'C:\Users\mlabelle\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe' failed with exit status 2

----------------------------------------

Command "c:\python27\python.exe -u -c "import setuptools, tokenize;file='c:\users\mlabelle\appdata\local\temp\pip-build-ygl0dc\yara-python\setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record c:\users\mlabelle\appdata\local\temp\pip-1ojqtr-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\mlabelle\appdata\local\temp\pip-build-ygl0dc\yara-python\

ghost commented 8 years ago

Using MinGW I get the following errors:

C:\Python27\Scripts>pip.exe install yara-python Collecting yara-python Using cached yara-python-3.4.0.00.tar.gz Installing collected packages: yara-python Running setup.py install for yara-python ... error Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;file='c:\users\mlabelle\appdata\local\temp\pip-build-4zirh6\yara-python\setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record c:\users\mlabelle\appdata\local\temp\pip-t_hddw-record\install-record.txt --single-version-externally-managed --compile: c:\python27\lib\site-packages\setuptools\dist.py:285: UserWarning: Normalizing '3.4.0.00' to '3.4.0.0' normalized_version, running install running build running build_ext building 'yara' extension creating build creating build\temp.win32-2.7 creating build\temp.win32-2.7\Release creating build\temp.win32-2.7\Release\yara creating build\temp.win32-2.7\Release\yara\libyara creating build\temp.win32-2.7\Release\yara\libyara\modules C:\MinGW\bin\gcc.exe -mdll -O -Wall -D_CRT_SECURE_NO_WARNINGS=1 -DHASH=1 -Iyara/libyara/include -Iyara/libyara/ -I. -Iyara/windows/include -Ic:\python27\include -Ic:\python27\PC -c yara-python.c -o build\temp.win32-2.7\Release\yara-python.o -O3 C:\MinGW\bin\gcc.exe -mdll -O -Wall -D_CRT_SECURE_NO_WARNINGS=1 -DHASH=1 -Iyara/libyara/include -Iyara/libyara/ -I. -Iyara/windows/include -Ic:\python27\include -Ic:\python27\PC -c yara\libyara\ahocorasick.c -o build\temp.win32-2.7\Release\yara\libyara\ahocorasick.o -O3 C:\MinGW\bin\gcc.exe -mdll -O -Wall -D_CRT_SECURE_NO_WARNINGS=1 -DHASH=1 -Iyara/libyara/include -Iyara/libyara/ -I. -Iyara/windows/include -Ic:\python27\include -Ic:\python27\PC -c yara\libyara\arena.c -o build\temp.win32-2.7\Release\yara\libyara\arena.o -O3 C:\MinGW\bin\gcc.exe -mdll -O -Wall -D_CRT_SECURE_NO_WARNINGS=1 -DHASH=1 -Iyara/libyara/include -Iyara/libyara/ -I. -Iyara/windows/include -Ic:\python27\include -Ic:\python27\PC -c yara\libyara\atoms.c -o build\temp.win32-2.7\Release\yara\libyara\atoms.o -O3 C:\MinGW\bin\gcc.exe -mdll -O -Wall -D_CRT_SECURE_NO_WARNINGS=1 -DHASH=1 -Iyara/libyara/include -Iyara/libyara/ -I. -Iyara/windows/include -Ic:\python27\include -Ic:\python27\PC -c yara\libyara\compiler.c -o build\temp.win32-2.7\Release\yara\libyara\compiler.o -O3 C:\MinGW\bin\gcc.exe -mdll -O -Wall -D_CRT_SECURE_NO_WARNINGS=1 -DHASH=1 -Iyara/libyara/include -Iyara/libyara/ -I. -Iyara/windows/include -Ic:\python27\include -Ic:\python27\PC -c yara\libyara\exec.c -o build\temp.win32-2.7\Release\yara\libyara\exec.o -O3 C:\MinGW\bin\gcc.exe -mdll -O -Wall -D_CRT_SECURE_NO_WARNINGS=1 -DHASH=1 -Iyara/libyara/include -Iyara/libyara/ -I. -Iyara/windows/include -Ic:\python27\include -Ic:\python27\PC -c yara\libyara\exefiles.c -o build\temp.win32-2.7\Release\yara\libyara\exefiles.o -O3 In file included from yara\libyara\exefiles.c:19:0: yara/libyara/include/yara/pe.h:438:16: error: redefinition of 'struct _WIN_CERTIFICATE' typedef struct _WIN_CERTIFICATE { ^ In file included from c:\mingw\include\windows.h:50:0, from yara/libyara/include/yara/pe.h:20, from yara\libyara\exefiles.c:19: c:\mingw\include\winbase.h:1125:16: note: originally defined here typedef struct _WIN_CERTIFICATE { ^ In file included from yara\libyara\exefiles.c:19:0: yara/libyara/include/yara/pe.h:443:3: error: conflicting types for 'WIN_CERTIFICATE' } WIN_CERTIFICATE, PWIN_CERTIFICATE; ^ In file included from c:\mingw\include\windows.h:50:0, from yara/libyara/include/yara/pe.h:20, from yara\libyara\exefiles.c:19: c:\mingw\include\winbase.h:1130:3: note: previous declaration of 'WIN_CERTIFICATE' was here } WIN_CERTIFICATE, LPWIN_CERTIFICATE; ^ error: command 'C:\MinGW\bin\gcc.exe' failed with exit status 1

----------------------------------------

Command "c:\python27\python.exe -u -c "import setuptools, tokenize;file='c:\users\mlabelle\appdata\local\temp\pip-build-4zirh6\yara-python\setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record c:\users\mlabelle\appdata\local\temp\pip-t_hddw-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\mlabelle\appdata\local\temp\pip-build-4zirh6\yara-python\

yonatanp commented 8 years ago

Following the suggestion in stackoverflow, I ended up downloading a public-domain stdint.h replacement from here and then it all built nicely. I have put it in the main folder of the project (next to setup.py).

plusvic commented 7 years ago

This issue should be fixed with latest version.