版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_33438733/article/details/86082434
前言
买了新电脑,在搭建环境安装keystone-engine
时出现报错,之前在13.3从来没有遇到过,有点不知所措,不过有问题总得要解决的,虽然我直接将旧电脑的IDA搬运了过来,keypatch勉强能用,但是总感觉不舒服,经过一番google后,找到了问题的所在。
报错信息如下:
CMake Error at /usr/local/Cellar/cmake/3.13.2/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: /tmp/pip-install-qE2Xpo/keystone-engine/src/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_ad9c7/fast"
/Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/cmTC_ad9c7.dir/build.make CMakeFiles/cmTC_ad9c7.dir/build
Building C object CMakeFiles/cmTC_ad9c7.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_ad9c7.dir/testCCompiler.c.o -c /tmp/pip-install-qE2Xpo/keystone-engine/src/build/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_ad9c7
/usr/local/Cellar/cmake/3.13.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_ad9c7.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_ad9c7.dir/testCCompiler.c.o -o cmTC_ad9c7
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_ad9c7] Error 1
make: *** [cmTC_ad9c7/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 "/tmp/pip-install-qE2Xpo/keystone-engine/src/build/CMakeFiles/CMakeOutput.log".
See also "/tmp/pip-install-qE2Xpo/keystone-engine/src/build/CMakeFiles/CMakeError.log".
running install_lib
running install_data
error: can't copy 'src/build/llvm/lib/libkeystone.dylib': doesn't exist or not a regular file
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-qE2Xpo/keystone-engine/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/tmp/pip-record-Si_vWQ/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-install-qE2Xpo/keystone-engine/
不过最关键就是一句话ld: warning: The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS)
xcode不支持i386,讨论贴在这
主要的意思就是说mojave
系统默认安装的xcode-select工具是不支持i386的,为了顺利的编译我们需要安装mac13.3的xcode-select套件。
在此下载安装
选择合适版本的xcode-select commandline 安装即可
我这里安装的是
Command_Line_Tools_macOS_10.13_for_Xcode_10.1.dmg
然后我们还需要安装xcode,然后在xcode中选择版本。
总的下来最好的办法就是安装旧版的xcode。
然后你就晾凉了,我反正是折腾了半天最后也没个好结果,还是将就用下吧,只要IDA patch时不出问题就行。
各位师傅保重!
总结
所以仔细看报错信息,问题总是能解决的。