Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing pwntools on macOS

I am trying to install pwntools on macOS.

Whenever I try pip3 install pwntools, it pauses for a while on Running setup.py bdist_wheel for capstone ... and then prints Failed building wheel for capstone (I assume ‘capstone’ is some dependency) followed by a long error message. Here is the full output:

Collecting pwntools
Collecting tox>=1.8.1 (from pwntools)
  Using cached https://files.pythonhosted.org/packages/8f/c3/64bade66e6188a0dc02689392d5c782a9eb6648b54ddc2db034aa495b6a2/tox-3.5.2-py2.py3-none-any.whl
Requirement already satisfied: pyelftools>=0.2.4 in /usr/local/lib/python3.7/site-packages (from pwntools) (0.25)
Collecting capstone>=3.0.5rc2 (from pwntools)
  Using cached https://files.pythonhosted.org/packages/2b/61/d66abbf007f8cd2643095131c7dcb8186cc42603aea6d5a18cddcbf390a5/capstone-3.0.5.post1.tar.gz
Requirement already satisfied: python-dateutil in /usr/local/lib/python3.7/site-packages (from pwntools) (2.7.3)
Requirement already satisfied: psutil>=3.3.0 in /usr/local/lib/python3.7/site-packages (from pwntools) (5.4.7)
Collecting pyserial>=2.7 (from pwntools)
  Using cached https://files.pythonhosted.org/packages/0d/e4/2a744dd9e3be04a0c0907414e2a01a7c88bb3915cbe3c8cc06e209f59c30/pyserial-3.4-py2.py3-none-any.whl
Requirement already satisfied: sortedcontainers<2.0 in /usr/local/lib/python3.7/site-packages (from pwntools) (1.5.10)
Requirement already satisfied: intervaltree in /usr/local/lib/python3.7/site-packages (from pwntools) (2.1.0)
Collecting unicorn (from pwntools)
  Using cached https://files.pythonhosted.org/packages/7d/7f/47fe864fe967e91de2d57677618cffc91bee3918f0a3cdbaa6500b36855e/unicorn-1.0.1.tar.gz
Requirement already satisfied: mako>=1.0.0 in /usr/local/lib/python3.7/site-packages (from pwntools) (1.0.7)
Requirement already satisfied: pypandoc in /usr/local/lib/python3.7/site-packages (from pwntools) (1.4)
Requirement already satisfied: packaging in /usr/local/lib/python3.7/site-packages (from pwntools) (18.0)
Requirement already satisfied: paramiko>=1.15.2 in /usr/local/lib/python3.7/site-packages (from pwntools) (2.4.2)
Requirement already satisfied: pip>=6.0.8 in /usr/local/lib/python3.7/site-packages (from pwntools) (18.0)
Collecting ropgadget>=5.3 (from pwntools)
Requirement already satisfied: requests>=2.0 in /usr/local/lib/python3.7/site-packages (from pwntools) (2.19.1)
Requirement already satisfied: pygments>=2.0 in /usr/local/lib/python3.7/site-packages (from pwntools) (2.2.0)
Requirement already satisfied: pysocks in /usr/local/lib/python3.7/site-packages (from pwntools) (1.6.8)
Requirement already satisfied: setuptools>=30.0.0 in /usr/local/lib/python3.7/site-packages (from tox>=1.8.1->pwntools) (40.4.1)
Collecting filelock<4,>=3.0.0 (from tox>=1.8.1->pwntools)
  Using cached https://files.pythonhosted.org/packages/b4/fe/5ca16d167849b980925d3bd706cda266c7435dcf21675c546374da207654/filelock-3.0.9-py3-none-any.whl
Collecting toml>=0.9.4 (from tox>=1.8.1->pwntools)
  Using cached https://files.pythonhosted.org/packages/a2/12/ced7105d2de62fa7c8fb5fce92cc4ce66b57c95fb875e9318dba7f8c5db0/toml-0.10.0-py2.py3-none-any.whl
Collecting virtualenv>=1.11.2 (from tox>=1.8.1->pwntools)
  Using cached https://files.pythonhosted.org/packages/b6/30/96a02b2287098b23b875bc8c2f58071c35d2efe84f747b64d523721dc2b5/virtualenv-16.0.0-py2.py3-none-any.whl
Collecting pluggy<1,>=0.3.0 (from tox>=1.8.1->pwntools)
  Using cached https://files.pythonhosted.org/packages/1c/e7/017c262070af41fe251401cb0d0e1b7c38f656da634cd0c15604f1f30864/pluggy-0.8.0-py2.py3-none-any.whl
Requirement already satisfied: six<2,>=1.0.0 in /usr/local/lib/python3.7/site-packages (from tox>=1.8.1->pwntools) (1.11.0)
Collecting py<2,>=1.4.17 (from tox>=1.8.1->pwntools)
  Using cached https://files.pythonhosted.org/packages/3e/c7/3da685ef117d42ac8d71af525208759742dd235f8094221fdaafcd3dba8f/py-1.7.0-py2.py3-none-any.whl
Requirement already satisfied: MarkupSafe>=0.9.2 in /usr/local/lib/python3.7/site-packages (from mako>=1.0.0->pwntools) (1.0)
Requirement already satisfied: wheel>=0.25.0 in /usr/local/lib/python3.7/site-packages (from pypandoc->pwntools) (0.31.1)
Requirement already satisfied: pyparsing>=2.0.2 in /usr/local/lib/python3.7/site-packages (from packaging->pwntools) (2.2.1)
Requirement already satisfied: pyasn1>=0.1.7 in /usr/local/lib/python3.7/site-packages (from paramiko>=1.15.2->pwntools) (0.4.4)
Requirement already satisfied: cryptography>=1.5 in /usr/local/lib/python3.7/site-packages (from paramiko>=1.15.2->pwntools) (2.3.1)
Requirement already satisfied: bcrypt>=3.1.3 in /usr/local/lib/python3.7/site-packages (from paramiko>=1.15.2->pwntools) (3.1.4)
Requirement already satisfied: pynacl>=1.0.1 in /usr/local/lib/python3.7/site-packages (from paramiko>=1.15.2->pwntools) (1.3.0)
Requirement already satisfied: idna<2.8,>=2.5 in /usr/local/lib/python3.7/site-packages (from requests>=2.0->pwntools) (2.7)
Requirement already satisfied: urllib3<1.24,>=1.21.1 in /usr/local/lib/python3.7/site-packages (from requests>=2.0->pwntools) (1.23)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.7/site-packages (from requests>=2.0->pwntools) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/site-packages (from requests>=2.0->pwntools) (2018.8.24)
Requirement already satisfied: cffi!=1.11.3,>=1.7 in /usr/local/lib/python3.7/site-packages (from cryptography>=1.5->paramiko>=1.15.2->pwntools) (1.11.5)
Requirement already satisfied: asn1crypto>=0.21.0 in /usr/local/lib/python3.7/site-packages (from cryptography>=1.5->paramiko>=1.15.2->pwntools) (0.24.0)
Requirement already satisfied: pycparser in /usr/local/lib/python3.7/site-packages (from cffi!=1.11.3,>=1.7->cryptography>=1.5->paramiko>=1.15.2->pwntools) (2.19)
Building wheels for collected packages: capstone, unicorn
  Running setup.py bdist_wheel for capstone ... error
  Complete output from command /usr/local/opt/python/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/gg/v_3n0tps1zsbm17vmkmshp640000gn/T/pip-install-hfg12cnd/capstone/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/gg/v_3n0tps1zsbm17vmkmshp640000gn/T/pip-wheel-ijgw4f7z --python-tag cp37:
  running bdist_wheel
  running build
  Building C extensions
    CC      cs.o
    CC      utils.o
    CC      SStream.o
    CC      MCInstrDesc.o
    CC      MCRegisterInfo.o
    CC      arch/ARM/ARMDisassembler.o
    CC      arch/ARM/ARMInstPrinter.o
    CC      arch/ARM/ARMMapping.o
    CC      arch/ARM/ARMModule.o
    CC      arch/AArch64/AArch64BaseInfo.o
    CC      arch/AArch64/AArch64Disassembler.o
    CC      arch/AArch64/AArch64InstPrinter.o
    CC      arch/AArch64/AArch64Mapping.o
    CC      arch/AArch64/AArch64Module.o
    CC      arch/Mips/MipsDisassembler.o
    CC      arch/Mips/MipsInstPrinter.o
    CC      arch/Mips/MipsMapping.o
    CC      arch/Mips/MipsModule.o
    CC      arch/PowerPC/PPCDisassembler.o
    CC      arch/PowerPC/PPCInstPrinter.o
    CC      arch/PowerPC/PPCMapping.o
    CC      arch/PowerPC/PPCModule.o
    CC      arch/Sparc/SparcDisassembler.o
    CC      arch/Sparc/SparcInstPrinter.o
    CC      arch/Sparc/SparcMapping.o
    CC      arch/Sparc/SparcModule.o
    CC      arch/SystemZ/SystemZDisassembler.o
    CC      arch/SystemZ/SystemZInstPrinter.o
    CC      arch/SystemZ/SystemZMapping.o
    CC      arch/SystemZ/SystemZModule.o
    CC      arch/SystemZ/SystemZMCTargetDesc.o
    CC      arch/X86/X86DisassemblerDecoder.o
    CC      arch/X86/X86Disassembler.o
    CC      arch/X86/X86IntelInstPrinter.o
    CC      arch/X86/X86ATTInstPrinter.o
    CC      arch/X86/X86Mapping.o
    CC      arch/X86/X86Module.o
    CC      arch/XCore/XCoreDisassembler.o
    CC      arch/XCore/XCoreInstPrinter.o
    CC      arch/XCore/XCoreMapping.o
    CC      arch/XCore/XCoreModule.o
    CC      MCInst.o
    LINK    libcapstone.dylib
  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
  Undefined symbols for architecture i386:
    "___bzero", referenced from:
        _Thumb_getInstruction in ARMDisassembler.o
        _ARM_getInstruction in ARMDisassembler.o
        _AArch64_getInstruction in AArch64Disassembler.o
        _Mips_getInstruction in MipsDisassembler.o
        _Mips64_getInstruction in MipsDisassembler.o
        _PPC_getInstruction in PPCDisassembler.o
        _Sparc_getInstruction in SparcDisassembler.o
        ...
    "___memcpy_chk", referenced from:
        _SystemZ_getInstruction in SystemZDisassembler.o
    "___stack_chk_fail", referenced from:
        _cs_disasm in cs.o
        _cs_disasm_iter in cs.o
        _ARM_get_insn_id in ARMMapping.o
        _A64SysRegMapper_toString in AArch64BaseInfo.o
        _decodeToMCInst in AArch64Disassembler.o
        _printInstruction in AArch64InstPrinter.o
        _printTypedVectorList in AArch64InstPrinter.o
        ...
    "___stack_chk_guard", referenced from:
        _cs_disasm in cs.o
        _cs_disasm_iter in cs.o
        _ARM_get_insn_id in ARMMapping.o
        _A64SysRegMapper_toString in AArch64BaseInfo.o
        _decodeToMCInst in AArch64Disassembler.o
        _printInstruction in AArch64InstPrinter.o
        _printTypedVectorList in AArch64InstPrinter.o
        ...
        _cs_disasm in cs.o
        _cs_disasm_iter in cs.o
        _ARM_get_insn_id in ARMMapping.o
        _A64SysRegMapper_toString in AArch64BaseInfo.o
        _decodeToMCInst in AArch64Disassembler.o
        _printInstruction in AArch64InstPrinter.o
        _printTypedVectorList in AArch64InstPrinter.o
        ...
        _cs_disasm in cs.o
        _cs_disasm_iter in cs.o
        _ARM_get_insn_id in ARMMapping.o
        _A64SysRegMapper_toString in AArch64BaseInfo.o
        _decodeToMCInst in AArch64Disassembler.o
        _printInstruction in AArch64InstPrinter.o
        _printTypedVectorList in AArch64InstPrinter.o
        ...
        _cs_disasm in cs.o
        _cs_disasm_iter in cs.o
        _ARM_get_insn_id in ARMMapping.o
        _A64SysRegMapper_toString in AArch64BaseInfo.o
        _decodeToMCInst in AArch64Disassembler.o
        _printInstruction in AArch64InstPrinter.o
        _printTypedVectorList in AArch64InstPrinter.o
        ...
        _cs_disasm in cs.o
        _cs_disasm_iter in cs.o
        _ARM_get_insn_id in ARMMapping.o
        _A64SysRegMapper_toString in AArch64BaseInfo.o
        _decodeToMCInst in AArch64Disassembler.o
        _printInstruction in AArch64InstPrinter.o
        _printTypedVectorList in AArch64InstPrinter.o
        ...
        _cs_disasm in cs.o
        _cs_disasm_iter in cs.o
        _ARM_get_insn_id in ARMMapping.o
        _A64SysRegMapper_toString in AArch64BaseInfo.o
        _decodeToMCInst in AArch64Disassembler.o
        _printInstruction in AArch64InstPrinter.o
        _printTypedVectorList in AArch64InstPrinter.o
        ...
        _cs_disasm in cs.o
        _cs_disasm_iter in cs.o
        _ARM_get_insn_id in ARMMapping.o
        _A64SysRegMapper_toString in AArch64BaseInfo.o
        _decodeToMCInst in AArch64Disassembler.o
        _printInstruction in AArch64InstPrinter.o
        _printTypedVectorList in AArch64InstPrinter.o
        ...
        ...
    "___strcpy_chk", referenced from:
        _XCore_insn_extract in XCoreInstPrinter.o
    "___strncpy_chk", referenced from:
        _Sparc_printInst in SparcInstPrinter.o
    "___tolower", referenced from:
        _A64NamedImmMapper_fromString in AArch64BaseInfo.o
    "___udivdi3", referenced from:
        _A64SysRegMapper_toString in AArch64BaseInfo.o
    "_atoi", referenced from:
        _XCore_insn_extract in XCoreInstPrinter.o
    "_calloc", referenced from:
        _cs_mem_calloc in cs.o
       (maybe you meant: _cs_mem_calloc)
    "_free", referenced from:
        _cs_mem_free in cs.o
       (maybe you meant: _cs_free, _cs_mem_free )
    "_malloc", referenced from:
        _cs_mem_malloc in cs.o
       (maybe you meant: _cs_malloc, _cs_mem_malloc )
    "_memcpy", referenced from:
        _cs_disasm in cs.o
        _fill_insn in cs.o
        _cs_disasm_iter in cs.o
        _SStream_concat0 in SStream.o
    "_memmove", referenced from:
        _cs_strdup in utils.o
        _X86_Intel_printInst in X86IntelInstPrinter.o
        _X86_ATT_printInst in X86ATTInstPrinter.o
    "_realloc", referenced from:
        _cs_mem_realloc in cs.o
       (maybe you meant: _cs_mem_realloc)
    "_strchr", referenced from:
        _Sparc_printInst in SparcInstPrinter.o
        _XCore_insn_extract in XCoreInstPrinter.o
        _XCore_printInst in XCoreInstPrinter.o
    "_strcmp", referenced from:
        _name2id in utils.o
        _A64NamedImmMapper_fromString in AArch64BaseInfo.o
        _printPredicateOperand in PPCInstPrinter.o
        _PPC_alias_insn in PPCMapping.o
        _printMemOperand in SparcInstPrinter.o
        _Sparc_map_hint in SparcMapping.o
        _XCore_reg_id in XCoreMapping.o
        ...
    "_strcpy", referenced from:
        _A64SysRegMapper_toString in AArch64BaseInfo.o
    "_strlen", referenced from:
        _cs_strdup in utils.o
        _SStream_concat0 in SStream.o
        _ARM_post_printer in ARMInstPrinter.o
        _PPC_printInst in PPCInstPrinter.o
        _Sparc_printInst in SparcInstPrinter.o
        _Sparc_map_hint in SparcMapping.o
    "_strncmp", referenced from:
        _ARM_post_printer in ARMInstPrinter.o
    "_strncpy", referenced from:
        _cs_disasm in cs.o
        _fill_insn in cs.o
        _cs_disasm_iter in cs.o
    "_strrchr", referenced from:
        _ARM_post_printer in ARMInstPrinter.o
        _AArch64_post_printer in AArch64InstPrinter.o
        _PPC_post_printer in PPCInstPrinter.o
    "_strstr", referenced from:
        _AArch64_printInst in AArch64InstPrinter.o
        _PPC_post_printer in PPCInstPrinter.o
        _printAliasInstr in SparcInstPrinter.o
    "_vsnprintf", referenced from:
        _cs_vsnprintf in cs.o
       (maybe you meant: _cs_vsnprintf)
  ld: symbol(s) not found for architecture i386
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  make: *** [libcapstone.dylib] Error 1
  error: [Errno 2] No such file or directory: 'libcapstone.dylib'

  ----------------------------------------
  Failed building wheel for capstone
  Running setup.py clean for capstone
  Running setup.py bdist_wheel for unicorn ... error
  Complete output from command /usr/local/opt/python/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/gg/v_3n0tps1zsbm17vmkmshp640000gn/T/pip-install-hfg12cnd/unicorn/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/gg/v_3n0tps1zsbm17vmkmshp640000gn/T/pip-wheel-uwmfqniu --python-tag cp37:
  running bdist_wheel
  running build
  Building C extensions
  cd qemu && \
    ./configure --cc="cc" --extra-cflags="-DUNICORN_HAS_X86 -DUNICORN_HAS_ARM -DUNICORN_HAS_ARMEB -DUNICORN_HAS_M68K -DUNICORN_HAS_ARM64 -DUNICORN_HAS_MIPS -DUNICORN_HAS_MIPSEL -DUNICORN_HAS_MIPS64 -DUNICORN_HAS_MIPS64EL -DUNICORN_HAS_SPARC -fPIC -fvisibility=hidden -m32 -arch i386 -m64 -arch x86_64" --target-list="x86_64-softmmu, arm-softmmu, armeb-softmmu, m68k-softmmu, aarch64-softmmu, mips-softmmu, mipsel-softmmu, mips64-softmmu, mips64el-softmmu, sparc-softmmu,sparc64-softmmu,"

  ERROR: pthread check failed
         Make sure to have the pthread libs and headers installed.

  make: *** [qemu/config-host.h-timestamp] Error 1
  error: [Errno 2] No such file or directory: 'libunicorn.dylib'

  ----------------------------------------
  Failed building wheel for unicorn
  Running setup.py clean for unicorn
Failed to build capstone unicorn
Installing collected packages: filelock, toml, virtualenv, pluggy, py, tox, capstone, pyserial, unicorn, ropgadget, pwntools
  Running setup.py install for capstone ... error
    Complete output from command /usr/local/opt/python/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/gg/v_3n0tps1zsbm17vmkmshp640000gn/T/pip-install-hfg12cnd/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 /private/var/folders/gg/v_3n0tps1zsbm17vmkmshp640000gn/T/pip-record-l5k9b1g9/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    Building C extensions
      LINK    libcapstone.dylib
    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
    Undefined symbols for architecture i386:
      "___bzero", referenced from:
          _Thumb_getInstruction in ARMDisassembler.o
          _ARM_getInstruction in ARMDisassembler.o
          _AArch64_getInstruction in AArch64Disassembler.o
          _Mips_getInstruction in MipsDisassembler.o
          _Mips64_getInstruction in MipsDisassembler.o
          _PPC_getInstruction in PPCDisassembler.o
          _Sparc_getInstruction in SparcDisassembler.o
          ...
      "___memcpy_chk", referenced from:
          _SystemZ_getInstruction in SystemZDisassembler.o
      "___stack_chk_fail", referenced from:
          _cs_disasm in cs.o
          _cs_disasm_iter in cs.o
          _ARM_get_insn_id in ARMMapping.o
          _A64SysRegMapper_toString in AArch64BaseInfo.o
          _decodeToMCInst in AArch64Disassembler.o
          _printInstruction in AArch64InstPrinter.o
          _printTypedVectorList in AArch64InstPrinter.o
          ...
      "___stack_chk_guard", referenced from:
          _cs_disasm in cs.o
          _cs_disasm_iter in cs.o
          _ARM_get_insn_id in ARMMapping.o
          _A64SysRegMapper_toString in AArch64BaseInfo.o
          _decodeToMCInst in AArch64Disassembler.o
          _printInstruction in AArch64InstPrinter.o
          _printTypedVectorList in AArch64InstPrinter.o
          ...
          _cs_disasm in cs.o
          _cs_disasm_iter in cs.o
          _ARM_get_insn_id in ARMMapping.o
          _A64SysRegMapper_toString in AArch64BaseInfo.o
          _decodeToMCInst in AArch64Disassembler.o
          _printInstruction in AArch64InstPrinter.o
          _printTypedVectorList in AArch64InstPrinter.o
          ...
          _cs_disasm in cs.o
          _cs_disasm_iter in cs.o
          _ARM_get_insn_id in ARMMapping.o
          _A64SysRegMapper_toString in AArch64BaseInfo.o
          _decodeToMCInst in AArch64Disassembler.o
          _printInstruction in AArch64InstPrinter.o
          _printTypedVectorList in AArch64InstPrinter.o
          ...
          _cs_disasm in cs.o
          _cs_disasm_iter in cs.o
          _ARM_get_insn_id in ARMMapping.o
          _A64SysRegMapper_toString in AArch64BaseInfo.o
          _decodeToMCInst in AArch64Disassembler.o
          _printInstruction in AArch64InstPrinter.o
          _printTypedVectorList in AArch64InstPrinter.o
          ...
          _cs_disasm in cs.o
          _cs_disasm_iter in cs.o
          _ARM_get_insn_id in ARMMapping.o
          _A64SysRegMapper_toString in AArch64BaseInfo.o
          _decodeToMCInst in AArch64Disassembler.o
          _printInstruction in AArch64InstPrinter.o
          _printTypedVectorList in AArch64InstPrinter.o
          ...
          _cs_disasm in cs.o
          _cs_disasm_iter in cs.o
          _ARM_get_insn_id in ARMMapping.o
          _A64SysRegMapper_toString in AArch64BaseInfo.o
          _decodeToMCInst in AArch64Disassembler.o
          _printInstruction in AArch64InstPrinter.o
          _printTypedVectorList in AArch64InstPrinter.o
          ...
          _cs_disasm in cs.o
          _cs_disasm_iter in cs.o
          _ARM_get_insn_id in ARMMapping.o
          _A64SysRegMapper_toString in AArch64BaseInfo.o
          _decodeToMCInst in AArch64Disassembler.o
          _printInstruction in AArch64InstPrinter.o
          _printTypedVectorList in AArch64InstPrinter.o
          ...
          ...
      "___strcpy_chk", referenced from:
          _XCore_insn_extract in XCoreInstPrinter.o
      "___strncpy_chk", referenced from:
          _Sparc_printInst in SparcInstPrinter.o
      "___tolower", referenced from:
          _A64NamedImmMapper_fromString in AArch64BaseInfo.o
      "___udivdi3", referenced from:
          _A64SysRegMapper_toString in AArch64BaseInfo.o
      "_atoi", referenced from:
          _XCore_insn_extract in XCoreInstPrinter.o
      "_calloc", referenced from:
          _cs_mem_calloc in cs.o
         (maybe you meant: _cs_mem_calloc)
      "_free", referenced from:
          _cs_mem_free in cs.o
         (maybe you meant: _cs_free, _cs_mem_free )
      "_malloc", referenced from:
          _cs_mem_malloc in cs.o
         (maybe you meant: _cs_malloc, _cs_mem_malloc )
      "_memcpy", referenced from:
          _cs_disasm in cs.o
          _fill_insn in cs.o
          _cs_disasm_iter in cs.o
          _SStream_concat0 in SStream.o
      "_memmove", referenced from:
          _cs_strdup in utils.o
          _X86_Intel_printInst in X86IntelInstPrinter.o
          _X86_ATT_printInst in X86ATTInstPrinter.o
      "_realloc", referenced from:
          _cs_mem_realloc in cs.o
         (maybe you meant: _cs_mem_realloc)
      "_strchr", referenced from:
          _Sparc_printInst in SparcInstPrinter.o
          _XCore_insn_extract in XCoreInstPrinter.o
          _XCore_printInst in XCoreInstPrinter.o
      "_strcmp", referenced from:
          _name2id in utils.o
          _A64NamedImmMapper_fromString in AArch64BaseInfo.o
          _printPredicateOperand in PPCInstPrinter.o
          _PPC_alias_insn in PPCMapping.o
          _printMemOperand in SparcInstPrinter.o
          _Sparc_map_hint in SparcMapping.o
          _XCore_reg_id in XCoreMapping.o
          ...
      "_strcpy", referenced from:
          _A64SysRegMapper_toString in AArch64BaseInfo.o
      "_strlen", referenced from:
          _cs_strdup in utils.o
          _SStream_concat0 in SStream.o
          _ARM_post_printer in ARMInstPrinter.o
          _PPC_printInst in PPCInstPrinter.o
          _Sparc_printInst in SparcInstPrinter.o
          _Sparc_map_hint in SparcMapping.o
      "_strncmp", referenced from:
          _ARM_post_printer in ARMInstPrinter.o
      "_strncpy", referenced from:
          _cs_disasm in cs.o
          _fill_insn in cs.o
          _cs_disasm_iter in cs.o
      "_strrchr", referenced from:
          _ARM_post_printer in ARMInstPrinter.o
          _AArch64_post_printer in AArch64InstPrinter.o
          _PPC_post_printer in PPCInstPrinter.o
      "_strstr", referenced from:
          _AArch64_printInst in AArch64InstPrinter.o
          _PPC_post_printer in PPCInstPrinter.o
          _printAliasInstr in SparcInstPrinter.o
      "_vsnprintf", referenced from:
          _cs_vsnprintf in cs.o
         (maybe you meant: _cs_vsnprintf)
    ld: symbol(s) not found for architecture i386
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make: *** [libcapstone.dylib] Error 1
    error: [Errno 2] No such file or directory: 'libcapstone.dylib'

    ----------------------------------------
Command "/usr/local/opt/python/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/gg/v_3n0tps1zsbm17vmkmshp640000gn/T/pip-install-hfg12cnd/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 /private/var/folders/gg/v_3n0tps1zsbm17vmkmshp640000gn/T/pip-record-l5k9b1g9/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/gg/v_3n0tps1zsbm17vmkmshp640000gn/T/pip-install-hfg12cnd/capstone/

I’ve also tried brew install pwntools, which says that it is already installed, but import pwn in python still fails with a “no module named pwn” error. I thought it might be a temporary bug in capstone, but this has not worked for a few weeks now so that seems unlikely.

Thanks if anyone can help.

like image 650
Zack Avatar asked Oct 26 '18 20:10

Zack


1 Answers

capstone==3.0.5 still tries to build for both i386 and x86_64, this is already fixed on master and will be released with the next version. Looking at the Makefile, there are two possibilities:

  1. Turn off MACOS_UNIVERSAL:

    $ MACOS_UNIVERSAL=no pip install capstone
    
  2. Install the development version from current master branch, with LIBARCHS already adapted for Mojave:

    $ pip install "git+https://github.com/aquynh/capstone.git#egg=capstone&subdirectory=bindings/python"

Make sure you use quotes in the last command or escape the ampersand (&), otherwise bash will cut the command and run in background instead.

Once capstone is installed, you will have to deal with unicorn in the same manner and finally should be able to install pwntools. I didn't test it anymore, but the one-liner for the installation will be

$ MACOS_UNIVERSAL=no pip install pwntools
like image 148
hoefling Avatar answered Oct 22 '22 04:10

hoefling