記錄一下mac mojave 安裝 keystone-engine 報錯問題解決

前言

買了新電腦,在搭建環境安裝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。

然後

總結

所以仔細看報錯信息,問題總是能解決的。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章