miasm icon indicating copy to clipboard operation
miasm copied to clipboard

jit error

Open qq415338269 opened this issue 9 months ago • 3 comments

I am trying to use miasm's simulation and symbolic execution on Windows, but I am encountering errors. I have already installed the required dependencies and compiled LLVM. What should I do? I have tried installing miasm 0.1.3 and 0.1.5 using pip, but both failed. I also attempted to download 0.1.5 and compile it myself, but during compilation, I received a warning that the miasm jit extensions were not compiled. Could you please help me resolve this issue? Here is the error message I am receiving: Using c:\users\41533\appdata\roaming\python\python39\site-packages Finished processing dependencies for miasm==0.1.5.dev41 build all build WARNING: miasm jit extensions were not compiled, details: Could not find a suitable Clang/LLVM installation. You can download LLVM from https://releases.llvm.org Alternatively you can select the 'C++ Clang-cl build tools' in the Visual Studio Installer Could not find cl.exe and/or link.exe in the PATH, try building miasm from a Visual Studio command prompt More information at: https://wiki.python.org/moin/WindowsCompilers

Traceback (most recent call last): File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\lib\site-packages\miasm\jitter\jitload.py", line 219, in init from miasm.jitter.arch import JitCore_x86 as jcore ImportError: cannot import name 'JitCore_x86' from 'miasm.jitter.arch' (C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\lib\site-packages\miasm\jitter\arch_init_.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "d:\Code\TestProject\MiasmTestProject\AssemblingDisassembling.py", line 25, in jitter = machine.jitter(loc_db) File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\lib\site-packages\miasm\arch\x86\jit.py", line 76, in init Jitter.init(self, Lifter_X86_32(loc_db), *args, **kwargs) File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\lib\site-packages\miasm\jitter\jitload.py", line 238, in init raise RuntimeError('Unsupported jit arch: %s' % arch_name) RuntimeError: Unsupported jit arch: x86

qq415338269 avatar Apr 25 '24 20:04 qq415338269

I am using debug versions of LLVM 18.1 and 13.0.And I can check the versions of LLVM and Clang in the CMD window. I have already set the LLVM environment variables.

qq415338269 avatar Apr 25 '24 20:04 qq415338269

Hello,

It seems miasm could find LLVM in the PATH. Is your PATH envvar correct?

Alternatively, you can still use the python jitter, which doesn't require LLVM.

W0ni avatar Apr 26 '24 16:04 W0ni

@qq415338269 I hit right the same issue on Windows in order to address this question I did the following:

  1. installed LLVM-18.1.8-win64.exe from here
  2. the install path was intentionally short: c:\Dev\LLVM
  3. I studied setup.py code and figured out that it looks for llvm in different ways, I did not want to put llvm binaries into PATH, so I followed the windows registry lookup way, for that I've created a .reg file with the following contents:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\LLVM]
"LLVM"="c:\\Dev\\LLVM"

and executed it, so it landed into registry 4. executed MSVS bat file to allow it to see cl.exe as well as link.exe: c:\Dev\VS2019\VC\Auxiliary\Build\vcvars64.bat 5. after that the python setup.py build successfully finished all the steps including native code compilation into .pyd modules

greenozon avatar Aug 11 '24 11:08 greenozon