capstone-engine / capstone

Capstone disassembly/disassembler framework for ARM, ARM64 (ARMv8), Alpha, BPF, Ethereum VM, HPPA, LoongArch, M68K, M680X, Mips, MOS65XX, PPC, RISC-V(rv32G/rv64G), SH, Sparc, SystemZ, TMS320C64X, TriCore, Webassembly, XCore and X86.
http://www.capstone-engine.org
7.26k stars 1.53k forks source link

Failed to install from pip3 #1701

Open futex opened 3 years ago

futex commented 3 years ago

I'm currently upgrading to python3.7 my win10 dev machine. And to update a python3 package i need to also upgrade capstone. But when i run pip3 install capstone it failed with these errors. It can be an environment problem, but i can't find the solution.

`ERROR: Command errored out with exit status 1: command: 'c:\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Admin\AppData\Local\Temp\pip-install-p8haj8f9\capstone\setup.py'"'"'; file='"'"'C:\Users\Admin\AppData\Local\Temp\pip-install-p8haj8f9\capstone\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\Admin\AppData\Local\Temp\pip-record-ir9uh078\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python37\Include\capstone' cwd: C:\Users\Admin\AppData\Local\Temp\pip-install-p8haj8f9\capstone\ Complete output (51 lines): running install running build Building C extensions -- The C compiler identification is MSVC 19.0.24210.0 -- The CXX compiler identification is MSVC 19.0.24210.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - failed -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe - broken CMake Error at C:/Program Files/CMake/share/cmake-3.18/Modules/CMakeTestCCompiler.cmake:66 (message): The C compiler

    "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/Users/Admin/AppData/Local/Temp/pip-install-p8haj8f9/capstone/src/build/CMakeFiles/CMakeTmp

    Run Build Command(s):nmake /nologo cmTC_4a6f0\fast &&   "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\nmake.exe"  -f CMakeFiles\cmTC_4a6f0.dir\build.make /nologo -L                  CMakeFiles\cmTC_4a6f0.dir\build
    Building C object CMakeFiles/cmTC_4a6f0.dir/testCCompiler.c.obj
            C:\PROGRA~2\MICROS~1.0\VC\bin\cl.exe @C:\Users\Admin\AppData\Local\Temp\nmC2AB.tmp
    testCCompiler.c
    Linking C executable cmTC_4a6f0.exe
            "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_4a6f0.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- C:\PROGRA~2\MICROS~1.0\VC\bin\link.exe /nologo @CMakeFiles\cmTC_4a6f0.dir\objects1.rsp @C:\Users\Admin\AppData\Local\Temp\nmC2FA.tmp
    RC Pass 1: command "rc /fo CMakeFiles\cmTC_4a6f0.dir/manifest.res CMakeFiles\cmTC_4a6f0.dir/manifest.rc" failed (exit code 0) with the following output:
    The system cannot find the file specifiedNMAKE : fatal error U1077: '"C:\Program Files\CMake\bin\cmake.exe"' : return code '0xffffffff'
    Stop.
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\nmake.exe"' : return code '0x2'
    Stop.

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)

-- Configuring incomplete, errors occurred!
See also "C:/Users/Admin/AppData/Local/Temp/pip-install-p8haj8f9/capstone/src/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Admin/AppData/Local/Temp/pip-install-p8haj8f9/capstone/src/build/CMakeFiles/CMakeError.log".

Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation.  All rights reserved.

NMAKE : fatal error U1064: MAKEFILE not found and no target specified
Stop.
error: [Errno 2] No such file or directory: 'capstone.dll'
----------------------------------------

ERROR: Command errored out with exit status 1: 'c:\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Admin\AppData\Local\Temp\pip-install-p8haj8f9\capstone\setup.py'"'"'; file='"'"'C:\Users\Admin\AppData\Local\Temp\pip-install-p8haj8f9\capstone\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\Admin\AppData\Local\Temp\pip-record-ir9uh078\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python37\Include\capstone' Check the logs for full command output. WARNING: You are using pip version 20.0.1; however, version 20.2.4 is available. You should consider upgrading via the 'c:\python37\python.exe -m pip install --upgrade pip' command.`

The output log C:/Users/Admin/AppData/Local/Temp/pip-install-p8haj8f9/capstone/src/build/CMakeFiles/CMakeOutput.log doesn't exist ..

Thanks

futex commented 3 years ago

I made some progress, i was able to fix the previous error, by copy paste rc.exe rc.dll to the visual studio path and trying to install capstone from a visual studio de console, but still have another error:

`pip install capstone Collecting capstone Using cached capstone-4.0.2.tar.gz (2.0 MB) Installing collected packages: capstone Running setup.py install for capstone ... error ERROR: Command errored out with exit status 1: command: 'c:\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Admin\AppData\Local\Temp\pip-install-4145it9f\capstone\setup.py'"'"'; file='"'"'C:\Users\Admin\AppData\Local\Temp\pip-install-4145it9f\capstone\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\Admin\AppData\Local\Temp\pip-record-rw0cery6\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python37\Include\capstone' cwd: C:\Users\Admin\AppData\Local\Temp\pip-install-4145it9f\capstone\ Complete output (51 lines): running install running build Building C extensions -- The C compiler identification is MSVC 19.28.29333.0 -- The CXX compiler identification is MSVC 19.28.29333.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx86/x86/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 (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx86/x86/cl.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Deprecation Warning at CMakeLists.txt:18 (cmake_policy): The OLD behavior for policy CMP0048 will be removed from a future version of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.

Enabling CAPSTONE_ARM_SUPPORT
Enabling CAPSTONE_ARM64_SUPPORT
Enabling CAPSTONE_M68K_SUPPORT
Enabling CAPSTONE_MIPS_SUPPORT
Enabling CAPSTONE_PPC_SUPPORT
Enabling CAPSTONE_SPARC_SUPPORT
Enabling CAPSTONE_SYSZ_SUPPORT
Enabling CAPSTONE_XCORE_SUPPORT
Enabling CAPSTONE_X86_SUPPORT
Enabling CAPSTONE_TMS320C64X_SUPPORT
Enabling CAPSTONE_M680X_SUPPORT
Enabling CAPSTONE_EVM_SUPPORT
CMake Error: File C:/Users/Admin/AppData/Local/Temp/pip-install-4145it9f/capstone/src/capstone.pc.in does not exist.
CMake Error at CMakeLists.txt:567 (configure_file):
  configure_file Problem configuring file

-- Configuring incomplete, errors occurred!
See also "C:/Users/Admin/AppData/Local/Temp/pip-install-4145it9f/capstone/src/build/CMakeFiles/CMakeOutput.log".

Microsoft (R) Program Maintenance Utility Version 14.28.29333.0
Copyright (C) Microsoft Corporation.  All rights reserved.

NMAKE : fatal error U1064: MAKEFILE not found and no target specified
Stop.
error: [Errno 2] No such file or directory: 'capstone.dll'
----------------------------------------

ERROR: Command errored out with exit status 1: 'c:\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Admin\AppData\Local\Temp\pip-install-4145it9f\capstone\setup.py'"'"'; file='"'"'C:\Users\Admin\AppData\Local\Temp\pip-install-4145it9f\capstone\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\Admin\AppData\Local\Temp\pip-record-rw0cery6\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python37\Include\capstone' Check the logs for full command output. WARNING: You are using pip version 20.0.1; however, version 20.2.4 is available. You should consider upgrading via the 'c:\python37\python.exe -m pip install --upgrade pip' command.`