JonathanSalwan / Triton

Triton is a dynamic binary analysis library. Build your own program analysis tools, automate your reverse engineering, perform software verification or just emulate code.
https://triton-library.github.io
Apache License 2.0
3.4k stars 524 forks source link

Error while build on Windows 10 with VS 2022 + Python 3.11 #1256

Closed AnduinBrian closed 1 year ago

AnduinBrian commented 1 year ago

Im using Python 3.11. Visual Studio 2022 I downloaded all the dependencies. list: boost == 1_82_0 z3 == 4.8.15 capstone == 4.0.2

Here is the command i use:

cmake -G "Visual Studio 17 2022" -DBOOST_ROOT="C:\Users\Chipuku\Downloads\boost_1_78_0\" -DPYTHON_INCLUDE_DIRS="C:\Users\Chipuku\AppData\Local\Programs\Python\Python311\include\" -DPYTHON_LIBRARIES="C:\Users\Chipuku\AppData\Local\Programs\Python\Python311\libs\python311.lib" -DZ3_INCLUDE_DIRS="C:\Users\Chipuku\Downloads\z3-4.8.15-x64-win\include\" -DZ3_LIBRARIES="C:\Users\Chipuku\Downloads\z3-4.8.15-x64-win\bin\libz3.lib" -DCAPSTONE_INCLUDE_DIRS="C:\Users\Chipuku\Downloads\capstone-4.0.2-win64\include\" -DCAPSTONE_LIBRARIES="C:\Users\Chipuku\Downloads\capstone-4.0.2-win64\capstone.lib"

The output:

-- The C compiler identification is MSVC 19.35.32217.1
-- The CXX compiler identification is MSVC 19.35.32217.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.35.32215/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.35.32215/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Compiling with Python bindings
CMake Warning (dev) at CMakeLists.txt:54 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found PythonInterp: C:/Users/Chipuku/AppData/Local/Programs/Python/Python311/python.exe (found suitable version "3.11.3", minimum required is "3.6")
-- Compiling with Z3 SMT solver
-- Z3 includes directory defined: C:\Users\Chipuku\Downloads\z3-4.8.15-x64-win\include" -DZ3_LIBRARIES=C:\Users\Chipuku\Downloads\z3-4.8.15-x64-win\bin\libz3.lib -DCAPSTONE_INCLUDE_DIRS=C:\Users\Chipuku\Downloads\capstone-4.0.2-win64\include"
-- Z3 libraries defined:
CMake Error at CMakeModules/FindZ3.cmake:55 (find_file):
  Could not find Z3_VERSION_HEADER using the following files: z3_version.h
Call Stack (most recent call first):
  CMakeLists.txt:112 (find_package)

-- Configuring incomplete, errors occurred!

As i understand, cmake not able to find z3_version.h, but i give it correctly folder path. Why is this happend, thanks

JonathanSalwan commented 1 year ago

z3_version.h is generated when compiling z3. It's a template input (.in). Make sure the include directory you provided points to the installed output directory of your z3 setup.

AnduinBrian commented 1 year ago

I downloaded compiled z3 on github. Here is the data in z3_version.h

#define Z3_MAJOR_VERSION   4
#define Z3_MINOR_VERSION   8
#define Z3_BUILD_NUMBER    15
#define Z3_REVISION_NUMBER 0

#define Z3_FULL_VERSION    "Z3 4.8.15.0"
JonathanSalwan commented 1 year ago

And is this file in C:\Users\Chipuku\Downloads\z3-4.8.15-x64-win\include\z3_version h ?

NaC-L commented 1 year ago

your output has

-- Z3 includes directory defined: C:\Users\Chipuku\Downloads\z3-4.8.15-x64-win\include" -DZ3_LIBRARIES=C:\Users\Chipuku\Downloads\z3-4.8.15-x64-win\bin\libz3.lib -
DCAPSTONE_INCLUDE_DIRS=C:\Users\Chipuku\Downloads\capstone-4.0.2-win64\include"
-- Z3 libraries defined:

I think its supposed to be like

-- Z3 includes directory defined: C:\Users\Chipuku\Downloads\z3-4.8.15-x64-win\include
-- Z3 libraries defined : C:\Users\Chipuku\Downloads\z3-4.8.15-x64-win\bin\libz3.lib

Are you sure you didnt accidently pressed quote on some part? Maybe environment variable is wrong

AnduinBrian commented 1 year ago

i chose to run away :(, downgrade python to 3.7 and use compiled bin.