keystone-engine / keystone

Keystone assembler framework: Core (Arm, Arm64, Hexagon, Mips, PowerPC, Sparc, SystemZ & X86) + bindings
http://www.keystone-engine.org
GNU General Public License v2.0
2.25k stars 450 forks source link

install error on macos mojave 10.14.1 #388

Open Who1sCarl opened 5 years ago

Who1sCarl commented 5 years ago
~/Downloads/keystone-engine-0.9.1-3 sudo python setup.py install
Password:
running install
running build
running build_py
creating build
creating build/lib
creating build/lib/keystone
copying keystone/mips_const.py -> build/lib/keystone
copying keystone/sparc_const.py -> build/lib/keystone
copying keystone/keystone.py -> build/lib/keystone
copying keystone/__init__.py -> build/lib/keystone
copying keystone/keystone_const.py -> build/lib/keystone
copying keystone/systemz_const.py -> build/lib/keystone
copying keystone/arm64_const.py -> build/lib/keystone
copying keystone/x86_const.py -> build/lib/keystone
copying keystone/ppc_const.py -> build/lib/keystone
copying keystone/arm_const.py -> build/lib/keystone
copying keystone/hexagon_const.py -> build/lib/keystone
running build_clib
running custom_build_clib
building 'keystone' library
-- The C compiler identification is AppleClang 10.0.0.10001044
-- The CXX compiler identification is AppleClang 10.0.0.10001044
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- broken
CMake Error at /usr/local/Cellar/cmake/3.12.4/share/cmake/Modules/CMakeTestCCompiler.cmake:52 (message):
  The C compiler

    "/Library/Developer/CommandLineTools/usr/bin/cc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /Users/carlstar/Downloads/keystone-engine-0.9.1-3/src/build/CMakeFiles/CMakeTmp

    Run Build Command:"/usr/bin/make" "cmTC_c527c/fast"
    /Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/cmTC_c527c.dir/build.make CMakeFiles/cmTC_c527c.dir/build
    Building C object CMakeFiles/cmTC_c527c.dir/testCCompiler.c.o
    /Library/Developer/CommandLineTools/usr/bin/cc   -arch i386 -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk   -o CMakeFiles/cmTC_c527c.dir/testCCompiler.c.o   -c /Users/carlstar/Downloads/keystone-engine-0.9.1-3/src/build/CMakeFiles/CMakeTmp/testCCompiler.c
    Linking C executable cmTC_c527c
    /usr/local/Cellar/cmake/3.12.4/bin/cmake -E cmake_link_script CMakeFiles/cmTC_c527c.dir/link.txt --verbose=1
    /Library/Developer/CommandLineTools/usr/bin/cc   -arch i386 -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names   CMakeFiles/cmTC_c527c.dir/testCCompiler.c.o  -o cmTC_c527c
    ld: warning: The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS)
    ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd, missing required architecture i386 in file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd
    ld: dynamic main executables must link with libSystem.dylib for architecture i386
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[1]: *** [cmTC_c527c] Error 1
    make: *** [cmTC_c527c/fast] Error 2

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

-- Configuring incomplete, errors occurred!
See also "/Users/carlstar/Downloads/keystone-engine-0.9.1-3/src/build/CMakeFiles/CMakeOutput.log".
See also "/Users/carlstar/Downloads/keystone-engine-0.9.1-3/src/build/CMakeFiles/CMakeError.log".
running install_lib
creating /usr/local/lib/python2.7/site-packages/keystone
copying build/lib/keystone/mips_const.py -> /usr/local/lib/python2.7/site-packages/keystone
copying build/lib/keystone/sparc_const.py -> /usr/local/lib/python2.7/site-packages/keystone
copying build/lib/keystone/keystone.py -> /usr/local/lib/python2.7/site-packages/keystone
copying build/lib/keystone/__init__.py -> /usr/local/lib/python2.7/site-packages/keystone
copying build/lib/keystone/keystone_const.py -> /usr/local/lib/python2.7/site-packages/keystone
copying build/lib/keystone/systemz_const.py -> /usr/local/lib/python2.7/site-packages/keystone
copying build/lib/keystone/arm64_const.py -> /usr/local/lib/python2.7/site-packages/keystone
copying build/lib/keystone/x86_const.py -> /usr/local/lib/python2.7/site-packages/keystone
copying build/lib/keystone/ppc_const.py -> /usr/local/lib/python2.7/site-packages/keystone
copying build/lib/keystone/arm_const.py -> /usr/local/lib/python2.7/site-packages/keystone
copying build/lib/keystone/hexagon_const.py -> /usr/local/lib/python2.7/site-packages/keystone
byte-compiling /usr/local/lib/python2.7/site-packages/keystone/mips_const.py to mips_const.pyc
byte-compiling /usr/local/lib/python2.7/site-packages/keystone/sparc_const.py to sparc_const.pyc
byte-compiling /usr/local/lib/python2.7/site-packages/keystone/keystone.py to keystone.pyc
byte-compiling /usr/local/lib/python2.7/site-packages/keystone/__init__.py to __init__.pyc
byte-compiling /usr/local/lib/python2.7/site-packages/keystone/keystone_const.py to keystone_const.pyc
byte-compiling /usr/local/lib/python2.7/site-packages/keystone/systemz_const.py to systemz_const.pyc
byte-compiling /usr/local/lib/python2.7/site-packages/keystone/arm64_const.py to arm64_const.pyc
byte-compiling /usr/local/lib/python2.7/site-packages/keystone/x86_const.py to x86_const.pyc
byte-compiling /usr/local/lib/python2.7/site-packages/keystone/ppc_const.py to ppc_const.pyc
byte-compiling /usr/local/lib/python2.7/site-packages/keystone/arm_const.py to arm_const.pyc
byte-compiling /usr/local/lib/python2.7/site-packages/keystone/hexagon_const.py to hexagon_const.pyc
running install_data
error: can't copy 'src/build/llvm/lib/libkeystone.dylib': doesn't exist or not a regular file
sterling0x1 commented 5 years ago

Mojave stopped supporting 32bit architecture.

You need to download sources from https://pypi.org/project/keystone-engine/#files

Delete i386 from src/make-common.sh and then build it manually.

cd keystone-engine-0.9.1-3 sudo python setup.py install

it will build it fine.

In my case IDA still wouldn't find keystone module when it tried to load keypatch so I followed this troubleshoot. https://github.com/keystone-engine/keypatch/issues/12

Now it works fine

silvervalley commented 5 years ago

"Delete i386 from src/make-common.sh and then build it manually" It worked, thx a lot.

radish6 commented 5 years ago

My environment is windows10 python3.7 report similar fault,solve method load http://www.keystone-engine.org/download/ Python module for Windows - Binaries.

weisente commented 4 years ago

build it manually.

how to build it manually.