QuoSecGmbH / grap

grap: define and match graph patterns within binaries
MIT License
153 stars 13 forks source link

build with python38? #1

Open Ch3nYe opened 1 year ago

Ch3nYe commented 1 year ago

Can I build pygrap with python38?

The prebuild _pygrap.pyd seems to rely on Python27 DLLs (check with import table), it does not work with python3.

I have already try to build the pygrap in my windows, but it failed due to the identifier errors in xmemory and atomic in path\to\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include. For more detail about the errors:

C2039 "invalid_ parameter": 不是”'global namespace'"的成员" in xmemory line 156.
->_STL_ASSERT<- (_Ptr_user[-2] == _Big_allocation_sentinel, "invalid argument");

C2039 "invalid_ parameter": 不是”'global namespace'"的成员" in xmemory line 206.
->INVALID_MEMORY_ORDER<-;

and unknown identifier in path\to\grap\src\build\bindings\python\CMakeFiles\pygrap.dir

C3861 ”_PyObject_GC_UNTRACK":找不到标识符 in pygrapPYTHON_wrap.cxx

Again, I wanna know if pygrap could be built for python3.

Looking forward to reply. Thanks~

yaps8 commented 1 year ago

Hello, thank you for reporting the issue.

grap/pygrap are (now) written in python3 and work in IDA with python3 on Linux.

You are right about the prebuilt _pygrap.pyd for Windows, it was built before migration to python3 and therefore relies on python27.

I am now using grap/pygrap only on Linux so the Windows build has not been maintained, I do not have a working build environment nor up-to-date build instructions, the steps I took to build the existing windows version are here:

Could you try and debug the issue:

Ch3nYe commented 1 year ago

Thanks for your reply,

Please keep this issue open for a while, and I will try build the pygrap package for py3 on Windows.

Ch3nYe commented 1 year ago

It seems that the files Parser.hpp Lexer.hpp Parser.cpp Lexer.cpp is missing, when I compile the pygrap package. Are they generated dynamically in compliation? I cannot found where are the command line for generation.

Looking for your kind reply.

yaps8 commented 1 year ago

Yes, they are generated with flex+bison, the cmake commands are there:

https://github.com/QuoSecGmbH/grap/blob/master/src/libs/dotparser/CMakeLists.txt

The input is in the same directory (Lexer.l, Parser.y and .cpp/.hpp files).

Ch3nYe commented 1 year ago

It seems the generation of these files are failed, I will try to fix it