angr / angr-dev

Some helper scripts to set up an environment for angr development.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

autogenerated protobuf type error

Pl0414141 opened this issue · comments

SO: Windows 10, 1903, 64 bit
Python: 3.5 64 bit

To reproduce:

import angr
Traceback (most recent call last):
File "", line 1, in
File "c:\users\sym\desktop\angr-dev-master\angr-dev-master\angr\angr_init_.py", line 30, in
from .sim_procedure import SimProcedure
File "c:\users\sym\desktop\angr-dev-master\angr-dev-master\angr\angr\sim_procedure.py", line 5, in
from cle import SymbolType
File "c:\users\sym\desktop\angr-dev-master\angr-dev-master\cle\cle_init_.py", line 18, in
from .loader import *
File "c:\users\sym\desktop\angr-dev-master\angr-dev-master\cle\cle\loader.py", line 14, in
import claripy
File "c:\users\sym\desktop\angr-dev-master\angr-dev-master\claripy\claripy_init_.py", line 21, in
from . import backends as backends_module
File "c:\users\sym\desktop\angr-dev-master\angr-dev-master\claripy\claripy\backends_init
.py", line 785, in
from .backend_smtlib import BackendSMTLibBase
File "c:\users\sym\desktop\angr-dev-master\angr-dev-master\claripy\claripy\backends\backend_smtlib.py", line 3, in
from pysmt.shortcuts import Symbol, String, StrConcat, NotEquals,
File "C:\Python35\lib\site-packages\pysmt\shortcuts.py", line 38, in
import pysmt.smtlib.parser
File "C:\Python35\lib\site-packages\pysmt\smtlib\parser_init_.py", line 91, in
pyxbuild_dir=build_dir)
File "C:\Python35\lib\site-packages\pyximport\pyximport.py", line 191, in build_module
reload_support=pyxargs.reload_support)
File "C:\Python35\lib\site-packages\pyximport\pyxbuild.py", line 102, in pyx_to_dll
dist.run_commands()
File "C:\Python35\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Python35\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Python35\lib\site-packages\Cython\Distutils\old_build_ext.py", line 186, in run
_build_ext.build_ext.run(self)
File "C:\Python35\lib\distutils\command\build_ext.py", line 339, in run
self.build_extensions()
File "C:\Python35\lib\site-packages\Cython\Distutils\old_build_ext.py", line 194, in build_extensions
self.build_extension(ext)
File "C:\Python35\lib\distutils\command\build_ext.py", line 533, in build_extension
depends=ext.depends)
File "C:\Python35\lib\distutils_msvccompiler.py", line 304, in compile
self.initialize()
File "C:\Python35\lib\distutils_msvccompiler.py", line 197, in initialize
vc_env = _get_vc_env(plat_spec)
File "C:\Python35\lib\distutils_msvccompiler.py", line 85, in _get_vc_env
raise DistutilsPlatformError("Unable to find vcvarsall.bat")
distutils.errors.DistutilsPlatformError: Unable to find vcvarsall.bat

However, i can see that th efile "vcvarsall.bat" exists in "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build"

Any workaround to fix it?

@rhelmot using VS 2017 gives me the following error:

C:\Users\sym>python
Python 3.5.4 (default, Dec 15 2017, 14:24:56) [MSC v.1900 64 bit (AMD64)]
Type "help", "copyright", "credits" or "license" for more information.
>>> angr
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'angr' is not defined
**>>> import angr**
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\users\sym\desktop\angr-dev-master\angr-dev-master\angr\angr\__init__.py", line 30, in <module>
    from .sim_procedure import SimProcedure
  File "c:\users\sym\desktop\angr-dev-master\angr-dev-master\angr\angr\sim_procedure.py", line 498, in <module>
    from angr.sim_type import SimTypePointer
  File "c:\users\sym\desktop\angr-dev-master\angr-dev-master\angr\angr\sim_type.py", line 1287, in <module>
    from .state_plugins.view import SimMemView
  File "c:\users\sym\desktop\angr-dev-master\angr-dev-master\angr\angr\state_plugins\__init__.py", line 10, in <module>
    from .javavm_memory import *
  File "c:\users\sym\desktop\angr-dev-master\angr-dev-master\angr\angr\state_plugins\javavm_memory.py", line 7, in <module>
    from ..engines.soot.values import (SimSootValue_ArrayRef,
  File "c:\users\sym\desktop\angr-dev-master\angr-dev-master\angr\angr\engines\__init__.py", line 4, in <module>
    from .vex import SimEngineVEX
  File "c:\users\sym\desktop\angr-dev-master\angr-dev-master\angr\angr\engines\vex\__init__.py", line 1, in <module>
    from .engine import SimEngineVEX
  File "c:\users\sym\desktop\angr-dev-master\angr-dev-master\angr\angr\engines\vex\engine.py", line 17, in <module>
    from ...utils.constants import DEFAULT_STATEMENT
  File "c:\users\sym\desktop\angr-dev-master\angr-dev-master\angr\angr\utils\__init__.py", line 4, in <module>
    from . import enums_conv
  File "c:\users\sym\desktop\angr-dev-master\angr-dev-master\angr\angr\utils\enums_conv.py", line 6, in <module>
    from ..protos.primitives_pb2 import Edge
  File "c:\users\sym\desktop\angr-dev-master\angr-dev-master\angr\angr\protos\__init__.py", line 2, in <module>
    from . import primitives_pb2
  File "c:\users\sym\desktop\angr-dev-master\angr-dev-master\angr\angr\protos\primitives_pb2.py", line 23, in <module>
    serialized_pb=_b('\n\x17protos/primitives.proto\x12\x0b\x61ngr.protos\"\xf6\x04\n\rCodeReference\x12:\n\x0btarget_type\x18\x01 \x01(\x0e\x32%.angr.protos.CodeReference.TargetType\x12<\n\x0coperand_type\x18\x02 \x01(\x0e\x32&.angr.protos.CodeReference.OperandType\x12\x35\n\x08location\x18\x03 \x01(\x0e\x32#.angr.protos.CodeReference.Location\x12\n\n\x02\x65\x61\x18\x04 \x01(\x03\x12\x0c\n\x04mask\x18\x05 \x01(\x03\x12\x0c\n\x04name\x18\x06 \x01(\t\x12\x0f\n\x07\x64\x61ta_ea\x18\x07 \x01(\x03\x12\x10\n\x08\x62lock_ea\x18\x08 \x01(\x03\x12\x10\n\x08stmt_idx\x18\t \x01(\x05\x12\x13\n\x0boperand_idx\x18\n \x01(\x05\x12:\n\x08ref_type\x18\x0b \x01(\x0e\x32(.angr.protos.CodeReference.ReferenceType\",\n\nTargetType\x12\x0e\n\nCodeTarget\x10\x00\x12\x0e\n\nDataTarget\x10\x01\"~\n\x0bOperandType\x12\x14\n\x10ImmediateOperand\x10\x00\x12\x11\n\rMemoryOperand\x10\x01\x12\x1d\n\x19MemoryDisplacementOperand\x10\x02\x12\x16\n\x12\x43ontrolFlowOperand\x10\x03\x12\x0f\n\x0bOffsetTable\x10\x04\"&\n\x08Location\x12\x0c\n\x08Internal\x10\x00\x12\x0c\n\x08\x45xternal\x10\x01\"0\n\rReferenceType\x12\n\n\x06offset\x10\x00\x12\x08\n\x04read\x10\x01\x12\t\n\x05write\x10\x02\"k\n\x0bInstruction\x12\n\n\x02\x65\x61\x18\x01 \x01(\x03\x12\r\n\x05\x62ytes\x18\x02 \x01(\x0c\x12)\n\x05xrefs\x18\x03 \x01(\x0b\x32\x1a.angr.protos.CodeReference\x12\x16\n\x0elocal_noreturn\x18\x04 \x01(\x08\"`\n\x05\x42lock\x12\n\n\x02\x65\x61\x18\x01 \x01(\x03\x12.\n\x0cinstructions\x18\x02 \x01(\x0b\x32\x18.angr.protos.Instruction\x12\x0c\n\x04size\x18\x04 \x01(\x05\x12\r\n\x05\x62ytes\x18\x05 \x01(\x0c\"\x95\x02\n\x10\x45xternalFunction\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\n\n\x02\x65\x61\x18\x02 \x01(\x03\x12;\n\x02\x63\x63\x18\x03 \x01(\x0e\x32/.angr.protos.ExternalFunction.CallingConvention\x12\x12\n\nhas_return\x18\x04 \x01(\x08\x12\x11\n\tno_return\x18\x05 \x01(\x08\x12\x16\n\x0e\x61rgument_count\x18\x06 \x01(\x05\x12\x0f\n\x07is_weak\x18\x07 \x01(\x08\x12\x11\n\tprototype\x18\x08 \x01(\t\"G\n\x11\x43\x61llingConvention\x12\x11\n\rCallerCleanup\x10\x00\x12\x11\n\rCalleeCleanup\x10\x01\x12\x0c\n\x08\x46\x61stCall\x10\x02\"d\n\x10\x45xternalVariable\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\n\n\x02\x65\x61\x18\x02 \x01(\x03\x12\x0c\n\x04size\x18\x03 \x01(\x05\x12\x0f\n\x07is_weak\x18\x04 \x01(\x08\x12\x17\n\x0fis_thread_local\x18\x05 \x01(\x08\"\xd6\x03\n\x04\x45\x64ge\x12\x0e\n\x06src_ea\x18\x01 \x01(\x03\x12\x0e\n\x06\x64st_ea\x18\x02 \x01(\x03\x12,\n\x08jumpkind\x18\x03 \x01(\x0e\x32\x1a.angr.protos.Edge.JumpKind\x12\x12\n\nis_outside\x18\x04 \x01(\x08\x12\x10\n\x08ins_addr\x18\x05 \x01(\x03\x12\x10\n\x08stmt_idx\x18\x06 \x01(\x03\x12)\n\x04\x64\x61ta\x18\x07 \x03(\x0b\x32\x1b.angr.protos.Edge.DataEntry\x1a+\n\tDataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x0c:\x02\x38\x01\"\xef\x01\n\x08JumpKind\x12\x13\n\x0fUnknownJumpkind\x10\x00\x12\n\n\x06\x42oring\x10\x01\x12\x08\n\x04\x43\x61ll\x10\x02\x12\n\n\x06Return\x10\x03\x12\x0e\n\nFakeReturn\x10\x04\x12\x0b\n\x07Syscall\x10\x05\x12\x0f\n\x0bSys_syscall\x10\x06\x12\x0e\n\nSys_int128\x10\x07\x12\x0c\n\x08NoDecode\x10\x08\x12\n\n\x06\x45mWarn\x10\t\x12\x11\n\rSigFPE_IntDiv\x10\n\x12\x0b\n\x07SigTRAP\x10\x0b\x12\x0b\n\x07SigSEGV\x10\x0c\x12\x0b\n\x07MapFail\x10\r\x12\x0b\n\x07NoRedir\x10\x0e\x12\r\n\tClientReq\x10\x0f\".\n\nBlockGraph\x12 \n\x05\x65\x64ges\x18\x01 \x03(\x0b\x32\x11.angr.protos.Edgeb\x06proto3')
TypeError: __init__() got an unexpected keyword argument 'serialized_options'
>>>

you are just running into the weirdest issues. so far as I can tell this... has something to do with cached serialized data related to angr's protobuf definitions which is no longer valid under some new configuration. I have no idea what configuration that is but you should probably try nuking your entire virtualenv and all the cloned angr repos and starting over fresh. no idea who caches this data or where it's stored or I would give you less scorched-earth advice, sorry...

@rhelmot

Clean installation and the problem persists, steps made below:

  1. Install clean Windows 10 1903 64 bit full updated
  2. Install Visual Studio 2017 with C++
  3. Install Python 3.5 64 bit
  4. Install Python-PIP
  5. Execute setup.bat from angr-dev inside VS 2017 64 bit prompt

If there is anything else I haven't done, would you be so kind as to tell me?

Thank you very much

hm. I was totally wrong about what the problem was I guess.

@ltfish this one seems to be for you.

Hi

any news on this?

@Pl0414141 It is unlikely that you'll see any progress here this week, as most of the maintainers will be busy. Most of us don't have windows environments readily available for testing in a specific configuration, though someone might be able to try reproducing this after this week. You're welcome to continue researching this issue and submit patches, however.

I can't test on a Windows environment but some Google-fu says this is likely related to a protobuf version mismatch. Try upgrading (specifically, uninstalling and then installing the latest) the pip package.