前言

在macOS Big Sur中通过pip3安装pwntools没有遇到什么问题, 但是通过pip2安装pwntools却遇到了错误: 编译安装unicorn时失败. 于是在这里记录一下解决方案

解决

环境

macOS 11.5.1 amd64

Python 2.7.16

pip 20.3.4

pip安装

pip安装时, 出现了这样的错误

❯ pip2 install pwn
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Collecting pwn
Using cached pwn-1.0.tar.gz (1.1 kB)
Collecting pwntools
Using cached pwntools-4.6.0-py2.py3-none-any.whl (10.0 MB)
Requirement already satisfied: capstone>=3.0.5rc2 in /Users/loki/Library/Python/2.7/lib/python/site-packages (from pwntools->pwn) (4.0.2)
Requirement already satisfied: colored-traceback in /Users/loki/Library/Python/2.7/lib/python/site-packages (from pwntools->pwn) (0.3.0)
Requirement already satisfied: ropgadget>=5.3 in /Users/loki/Library/Python/2.7/lib/python/site-packages (from pwntools->pwn) (6.5)
Requirement already satisfied: psutil>=3.3.0 in /Users/loki/Library/Python/2.7/lib/python/site-packages (from pwntools->pwn) (5.8.0)
Requirement already satisfied: intervaltree>=3.0 in /Users/loki/Library/Python/2.7/lib/python/site-packages (from pwntools->pwn) (3.1.0)
Requirement already satisfied: packaging in /Users/loki/Library/Python/2.7/lib/python/site-packages (from pwntools->pwn) (20.9)
Requirement already satisfied: sortedcontainers in /Users/loki/Library/Python/2.7/lib/python/site-packages (from pwntools->pwn) (2.3.0)
Requirement already satisfied: pyelftools>=0.2.4 in /Users/loki/Library/Python/2.7/lib/python/site-packages (from pwntools->pwn) (0.27)
Requirement already satisfied: mako>=1.0.0 in /Users/loki/Library/Python/2.7/lib/python/site-packages (from pwntools->pwn) (1.1.4)
Requirement already satisfied: pyserial>=2.7 in /Users/loki/Library/Python/2.7/lib/python/site-packages (from pwntools->pwn) (3.5)
Requirement already satisfied: pygments>=2.0 in /Users/loki/Library/Python/2.7/lib/python/site-packages (from pwntools->pwn) (2.5.2)
Requirement already satisfied: pysocks in /Users/loki/Library/Python/2.7/lib/python/site-packages (from pwntools->pwn) (1.7.1)
Collecting unicorn<1.0.2rc4,>=1.0.2rc1
Downloading unicorn-1.0.2rc3.tar.gz (1.6 MB)
|████████████████████████████████| 1.6 MB 905 kB/s
Collecting paramiko>=1.15.2
Downloading paramiko-2.7.2-py2.py3-none-any.whl (206 kB)
|████████████████████████████████| 206 kB 971 kB/s
Requirement already satisfied: pip>=6.0.8 in /Library/Python/2.7/site-packages (from pwntools->pwn) (20.3.4)
Requirement already satisfied: six>=1.12.0 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from pwntools->pwn) (1.12.0)
Requirement already satisfied: python-dateutil in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from pwntools->pwn) (1.5)
Requirement already satisfied: requests>=2.0 in /Users/loki/Library/Python/2.7/lib/python/site-packages (from pwntools->pwn) (2.23.0)
Requirement already satisfied: rpyc in /Users/loki/Library/Python/2.7/lib/python/site-packages (from pwntools->pwn) (4.1.5)
Requirement already satisfied: pyparsing>=2.0.2 in /Users/loki/Library/Python/2.7/lib/python/site-packages (from packaging->pwntools->pwn) (2.4.7)
Requirement already satisfied: MarkupSafe>=0.9.2 in /Users/loki/Library/Python/2.7/lib/python/site-packages (from mako>=1.0.0->pwntools->pwn) (1.1.1)
Requirement already satisfied: cryptography>=2.5 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from paramiko>=1.15.2->pwntools->pwn) (2.9.2)
Collecting pynacl>=1.0.1
Downloading PyNaCl-1.4.0-cp27-cp27m-macosx_10_10_x86_64.whl (379 kB)
|████████████████████████████████| 379 kB 918 kB/s
Collecting bcrypt>=3.1.3
Downloading bcrypt-3.1.7-cp27-cp27m-macosx_10_6_intel.whl (53 kB)
|████████████████████████████████| 53 kB 1.1 MB/s
Requirement already satisfied: certifi>=2017.4.17 in /Users/loki/Library/Python/2.7/lib/python/site-packages (from requests>=2.0->pwntools->pwn) (2020.12.5)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /Users/loki/Library/Python/2.7/lib/python/site-packages (from requests>=2.0->pwntools->pwn) (1.25.8)
Requirement already satisfied: idna<3,>=2.5 in /Users/loki/Library/Python/2.7/lib/python/site-packages (from requests>=2.0->pwntools->pwn) (2.10)
Requirement already satisfied: chardet<4,>=3.0.2 in /Users/loki/Library/Python/2.7/lib/python/site-packages (from requests>=2.0->pwntools->pwn) (3.0.4)
Requirement already satisfied: plumbum in /Users/loki/Library/Python/2.7/lib/python/site-packages (from rpyc->pwntools->pwn) (1.7.0)
Requirement already satisfied: cffi!=1.11.3,>=1.8 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from cryptography>=2.5->paramiko>=1.15.2->pwntools->pwn) (1.14.3)
Requirement already satisfied: enum34 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from cryptography>=2.5->paramiko>=1.15.2->pwntools->pwn) (1.1.6)
Requirement already satisfied: ipaddress in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from cryptography>=2.5->paramiko>=1.15.2->pwntools->pwn) (1.0.22)
Requirement already satisfied: pycparser in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from cffi!=1.11.3,>=1.8->cryptography>=2.5->paramiko>=1.15.2->pwntools->pwn) (2.19)
Building wheels for collected packages: pwn, unicorn
Building wheel for pwn (setup.py) ... done
Created wheel for pwn: filename=pwn-1.0-py2-none-any.whl size=1219 sha256=c85d41546e84a524bc7a7da4778140308f156ef766147b195d9b9426fbccaa9a
Stored in directory: /Users/loki/Library/Caches/pip/wheels/b5/47/e7/37ed277a804c6b0bb20b4a2395ea8434eb937f368319d8d0ab
Building wheel for unicorn (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/6k/fdkg_n356c34dm04hrnj66k00000gn/T/pip-install-vxEjTg/unicorn/setup.py'"'"'; __file__='"'"'/private/var/folders/6k/fdkg_n356c34dm04hrnj66k00000gn/T/pip-install-vxEjTg/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/6k/fdkg_n356c34dm04hrnj66k00000gn/T/pip-wheel-8pFtsB
cwd: /private/var/folders/6k/fdkg_n356c34dm04hrnj66k00000gn/T/pip-install-vxEjTg/unicorn/
Complete output (399 lines):
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/dist.py:472: UserWarning: Normalizing '1.0.2.rc3' to '1.0.2rc3'
normalized_version,
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_ARM64EB -DUNICORN_HAS_MIPS -DUNICORN_HAS_MIPSEL -DUNICORN_HAS_MIPS64 -DUNICORN_HAS_MIPS64EL -DUNICORN_HAS_SPARC -fPIC -fvisibility=hidden" --target-list="x86_64-softmmu, arm-softmmu, armeb-softmmu, m68k-softmmu, aarch64-softmmu, aarch64eb-softmmu, mips-softmmu, mipsel-softmmu, mips64-softmmu, mips64el-softmmu, sparc-softmmu,sparc64-softmmu," --python=/usr/bin/python
Source path /private/var/folders/6k/fdkg_n356c34dm04hrnj66k00000gn/T/pip-install-vxEjTg/unicorn/src/qemu
C compiler cc
Host C compiler cc
Objective-C compiler clang
ARFLAGS rv
CFLAGS -g
QEMU_CFLAGS -m64 -DOS_OBJECT_USE_OBJC=0 -arch x86_64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -DUNICORN_HAS_X86 -DUNICORN_HAS_ARM -DUNICORN_HAS_ARMEB -DUNICORN_HAS_M68K -DUNICORN_HAS_ARM64 -DUNICORN_HAS_ARM64EB -DUNICORN_HAS_MIPS -DUNICORN_HAS_MIPSEL -DUNICORN_HAS_MIPS64 -DUNICORN_HAS_MIPS64EL -DUNICORN_HAS_SPARC -fPIC -fvisibility=hidden -Wno-string-plus-int -Wno-initializer-overrides -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-definition -Wtype-limits -fstack-protector-strong
LDFLAGS -m64 -arch x86_64 -g -L/usr/local/opt/sqlite/lib
make make
python /usr/bin/python -B
host CPU x86_64
host big endian no
target list x86_64-softmmu arm-softmmu armeb-softmmu m68k-softmmu aarch64-softmmu aarch64eb-softmmu mips-softmmu mipsel-softmmu mips64-softmmu mips64el-softmmu sparc-softmmu sparc64-softmmu
tcg debug enabled no
strip binaries yes
static build no
mingw32 support no
PIE no
printf "x86 m68k arm aarch64 mips sparc" > config.log
/Library/Developer/CommandLineTools/usr/bin/make -C qemu -j4
GEN x86_64-softmmu/config-devices.mak
GEN arm-softmmu/config-devices.mak
GEN armeb-softmmu/config-devices.mak
GEN m68k-softmmu/config-devices.mak
GEN aarch64-softmmu/config-devices.mak
GEN aarch64eb-softmmu/config-devices.mak
GEN mips-softmmu/config-devices.mak
GEN mipsel-softmmu/config-devices.mak
GEN mips64-softmmu/config-devices.mak
GEN mips64el-softmmu/config-devices.mak
GEN sparc-softmmu/config-devices.mak
GEN sparc64-softmmu/config-devices.mak
GEN config-host.h
GEN qapi-types.h
GEN qapi-visit.h
GEN config-all-devices.mak
CC ../uc.o
CC ../list.o
CC glib_compat.o
GEN qapi-types.c
GEN qapi-visit.c
CC accel.o
CC vl.o
CC qemu-timer.o
CC qemu-log.o
CC tcg-runtime.o
CC hw/core/qdev.o
CC hw/core/machine.o
CC qom/object.o
CC qom/container.o
CC qom/qom-qobject.o
CC qom/cpu.o
CC qapi-types.o
CC qapi-visit.o
CC qapi/qapi-visit-core.o
CC qapi/qapi-dealloc-visitor.o
CC qapi/qmp-input-visitor.o
CC qapi/qmp-output-visitor.o
CC qapi/string-input-visitor.o
CC qobject/qint.o
CC qobject/qstring.o
CC qobject/qdict.o
CC qobject/qlist.o
CC qobject/qfloat.o
CC qobject/qbool.o
CC qobject/qerror.o
CC util/cutils.o
CC util/qemu-timer-common.o
CC util/oslib-posix.o
CC util/qemu-thread-posix.o
CC util/module.o
CC util/bitmap.o
CC util/bitops.o
CC util/error.o
CC util/aes.o
CC util/crc32c.o
CC util/host-utils.o
CC util/getauxval.o
GEN arm-softmmu/config-target.h
GEN armeb-softmmu/config-target.h
GEN x86_64-softmmu/config-target.h
GEN m68k-softmmu/config-target.h
CC arm-softmmu/exec.o
CC m68k-softmmu/exec.o
CC x86_64-softmmu/exec.o
CC armeb-softmmu/exec.o
CC m68k-softmmu/translate-all.o
CC armeb-softmmu/translate-all.o
CC x86_64-softmmu/translate-all.o
CC arm-softmmu/translate-all.o
CC m68k-softmmu/cpu-exec.o
CC arm-softmmu/cpu-exec.o
CC x86_64-softmmu/cpu-exec.o
CC armeb-softmmu/cpu-exec.o
CC m68k-softmmu/tcg/tcg.o
CC x86_64-softmmu/tcg/tcg.o
CC armeb-softmmu/tcg/tcg.o
CC arm-softmmu/tcg/tcg.o
CC m68k-softmmu/tcg/optimize.o
CC arm-softmmu/tcg/optimize.o
CC armeb-softmmu/tcg/optimize.o
CC x86_64-softmmu/tcg/optimize.o
CC m68k-softmmu/fpu/softfloat.o
CC armeb-softmmu/fpu/softfloat.o
CC arm-softmmu/fpu/softfloat.o
CC x86_64-softmmu/fpu/softfloat.o
CC m68k-softmmu/cpus.o
CC m68k-softmmu/ioport.o
CC arm-softmmu/cpus.o
CC armeb-softmmu/cpus.o
CC x86_64-softmmu/cpus.o
CC m68k-softmmu/memory.o
CC arm-softmmu/ioport.o
CC armeb-softmmu/ioport.o
CC x86_64-softmmu/ioport.o
CC m68k-softmmu/cputlb.o
CC armeb-softmmu/memory.o
CC arm-softmmu/memory.o
CC x86_64-softmmu/memory.o
CC armeb-softmmu/cputlb.o
CC arm-softmmu/cputlb.o
CC x86_64-softmmu/cputlb.o
CC m68k-softmmu/memory_mapping.o
CC m68k-softmmu/hw/m68k/dummy_m68k.o
CC armeb-softmmu/memory_mapping.o
CC arm-softmmu/memory_mapping.o
CC x86_64-softmmu/memory_mapping.o
CC m68k-softmmu/target-m68k/translate.o
CC armeb-softmmu/hw/arm/tosa.o
CC arm-softmmu/hw/arm/tosa.o
CC x86_64-softmmu/hw/intc/apic.o
CC armeb-softmmu/hw/arm/virt.o
CC arm-softmmu/hw/arm/virt.o
CC x86_64-softmmu/hw/intc/apic_common.o
CC armeb-softmmu/target-arm/translate.o
CC m68k-softmmu/target-m68k/op_helper.o
CC arm-softmmu/target-arm/translate.o
CC x86_64-softmmu/hw/i386/pc.o
CC m68k-softmmu/target-m68k/helper.o
CC x86_64-softmmu/hw/i386/pc_piix.o
CC x86_64-softmmu/target-i386/translate.o
CC m68k-softmmu/target-m68k/cpu.o
CC m68k-softmmu/target-m68k/unicorn.o
CC armeb-softmmu/target-arm/op_helper.o
CC x86_64-softmmu/target-i386/helper.o
CC armeb-softmmu/target-arm/helper.o
CC arm-softmmu/target-arm/op_helper.o
GEN aarch64-softmmu/config-target.h
CC aarch64-softmmu/exec.o
CC x86_64-softmmu/target-i386/cpu.o
CC arm-softmmu/target-arm/helper.o
CC aarch64-softmmu/translate-all.o
CC x86_64-softmmu/target-i386/excp_helper.o
CC armeb-softmmu/target-arm/cpu.o
CC aarch64-softmmu/cpu-exec.o
CC x86_64-softmmu/target-i386/fpu_helper.o
CC armeb-softmmu/target-arm/neon_helper.o
CC aarch64-softmmu/tcg/tcg.o
CC arm-softmmu/target-arm/cpu.o
CC arm-softmmu/target-arm/neon_helper.o
CC armeb-softmmu/target-arm/iwmmxt_helper.o
CC x86_64-softmmu/target-i386/cc_helper.o
CC aarch64-softmmu/tcg/optimize.o
CC arm-softmmu/target-arm/iwmmxt_helper.o
CC armeb-softmmu/target-arm/psci.o
CC x86_64-softmmu/target-i386/int_helper.o
CC armeb-softmmu/target-arm/unicorn_arm.o
CC aarch64-softmmu/fpu/softfloat.o
CC x86_64-softmmu/target-i386/svm_helper.o
CC arm-softmmu/target-arm/psci.o
CC armeb-softmmu/target-arm/crypto_helper.o
CC arm-softmmu/target-arm/unicorn_arm.o
CC x86_64-softmmu/target-i386/smm_helper.o
CC aarch64-softmmu/cpus.o
CC arm-softmmu/target-arm/crypto_helper.o
CC x86_64-softmmu/target-i386/misc_helper.o
CC x86_64-softmmu/target-i386/mem_helper.o
CC aarch64-softmmu/ioport.o
CC x86_64-softmmu/target-i386/seg_helper.o
CC aarch64-softmmu/memory.o
GEN aarch64eb-softmmu/config-target.h
CC aarch64eb-softmmu/exec.o
GEN mips-softmmu/config-target.h
CC mips-softmmu/exec.o
CC aarch64-softmmu/cputlb.o
CC x86_64-softmmu/target-i386/arch_memory_mapping.o
CC aarch64eb-softmmu/translate-all.o
CC mips-softmmu/translate-all.o
CC x86_64-softmmu/target-i386/unicorn.o
CC aarch64eb-softmmu/cpu-exec.o
CC aarch64-softmmu/memory_mapping.o
CC mips-softmmu/cpu-exec.o
CC aarch64eb-softmmu/tcg/tcg.o
CC aarch64-softmmu/hw/arm/tosa.o
GEN mipsel-softmmu/config-target.h
CC mipsel-softmmu/exec.o
CC mips-softmmu/tcg/tcg.o
CC aarch64-softmmu/hw/arm/virt.o
CC aarch64-softmmu/target-arm/translate.o
CC mipsel-softmmu/translate-all.o
CC aarch64eb-softmmu/tcg/optimize.o
CC mipsel-softmmu/cpu-exec.o
CC mips-softmmu/tcg/optimize.o
CC mipsel-softmmu/tcg/tcg.o
CC aarch64eb-softmmu/fpu/softfloat.o
CC mips-softmmu/fpu/softfloat.o
CC aarch64eb-softmmu/cpus.o
CC mipsel-softmmu/tcg/optimize.o
CC aarch64eb-softmmu/ioport.o
CC aarch64-softmmu/target-arm/op_helper.o
CC mips-softmmu/cpus.o
CC aarch64eb-softmmu/memory.o
CC mips-softmmu/ioport.o
CC mipsel-softmmu/fpu/softfloat.o
CC aarch64-softmmu/target-arm/helper.o
CC mips-softmmu/memory.o
CC aarch64eb-softmmu/cputlb.o
CC mips-softmmu/cputlb.o
CC mipsel-softmmu/cpus.o
CC aarch64eb-softmmu/memory_mapping.o
CC aarch64-softmmu/target-arm/cpu.o
CC mipsel-softmmu/ioport.o
CC aarch64eb-softmmu/hw/arm/tosa.o
CC mips-softmmu/memory_mapping.o
CC aarch64-softmmu/target-arm/neon_helper.o
CC mipsel-softmmu/memory.o
CC aarch64eb-softmmu/hw/arm/virt.o
CC mips-softmmu/hw/mips/mips_r4k.o
CC aarch64eb-softmmu/target-arm/translate.o
CC mipsel-softmmu/cputlb.o
CC mips-softmmu/hw/mips/addr.o
CC mips-softmmu/hw/mips/cputimer.o
CC aarch64-softmmu/target-arm/iwmmxt_helper.o
CC mips-softmmu/target-mips/translate.o
CC mipsel-softmmu/memory_mapping.o
CC aarch64-softmmu/target-arm/psci.o
CC mipsel-softmmu/hw/mips/mips_r4k.o
CC aarch64-softmmu/target-arm/cpu64.o
CC mipsel-softmmu/hw/mips/addr.o
CC aarch64-softmmu/target-arm/translate-a64.o
CC mipsel-softmmu/hw/mips/cputimer.o
CC mipsel-softmmu/target-mips/translate.o
CC aarch64eb-softmmu/target-arm/op_helper.o
CC aarch64eb-softmmu/target-arm/helper.o
CC aarch64-softmmu/target-arm/helper-a64.o
CC mips-softmmu/target-mips/dsp_helper.o
CC aarch64eb-softmmu/target-arm/cpu.o
CC aarch64-softmmu/target-arm/unicorn_aarch64.o
CC mips-softmmu/target-mips/op_helper.o
CC aarch64-softmmu/target-arm/crypto_helper.o
CC aarch64eb-softmmu/target-arm/neon_helper.o
CC mipsel-softmmu/target-mips/dsp_helper.o
CC mips-softmmu/target-mips/lmi_helper.o
CC aarch64eb-softmmu/target-arm/iwmmxt_helper.o
CC mipsel-softmmu/target-mips/op_helper.o
CC mips-softmmu/target-mips/helper.o
GEN mips64-softmmu/config-target.h
CC mips64-softmmu/exec.o
CC aarch64eb-softmmu/target-arm/psci.o
CC mips-softmmu/target-mips/cpu.o
CC aarch64eb-softmmu/target-arm/cpu64.o
CC mips64-softmmu/translate-all.o
CC mips-softmmu/target-mips/msa_helper.o
CC aarch64eb-softmmu/target-arm/translate-a64.o
CC mipsel-softmmu/target-mips/lmi_helper.o
CC mips64-softmmu/cpu-exec.o
CC mips64-softmmu/tcg/tcg.o
CC mipsel-softmmu/target-mips/helper.o
CC mipsel-softmmu/target-mips/cpu.o
CC mips-softmmu/target-mips/unicorn.o
CC mipsel-softmmu/target-mips/msa_helper.o
CC aarch64eb-softmmu/target-arm/helper-a64.o
CC mips64-softmmu/tcg/optimize.o
CC aarch64eb-softmmu/target-arm/unicorn_aarch64.o
GEN mips64el-softmmu/config-target.h
CC mips64el-softmmu/exec.o
CC aarch64eb-softmmu/target-arm/crypto_helper.o
CC mipsel-softmmu/target-mips/unicorn.o
CC mips64-softmmu/fpu/softfloat.o
CC mips64el-softmmu/translate-all.o
CC mips64-softmmu/cpus.o
GEN sparc-softmmu/config-target.h
CC sparc-softmmu/exec.o
CC mips64el-softmmu/cpu-exec.o
CC mips64-softmmu/ioport.o
CC mips64el-softmmu/tcg/tcg.o
CC sparc-softmmu/translate-all.o
CC mips64-softmmu/memory.o
CC mips64el-softmmu/tcg/optimize.o
CC sparc-softmmu/cpu-exec.o
CC mips64-softmmu/cputlb.o
CC sparc-softmmu/tcg/tcg.o
GEN sparc64-softmmu/config-target.h
CC mips64-softmmu/memory_mapping.o
CC sparc64-softmmu/exec.o
CC mips64el-softmmu/fpu/softfloat.o
CC sparc-softmmu/tcg/optimize.o
CC mips64-softmmu/hw/mips/mips_r4k.o
CC sparc64-softmmu/translate-all.o
CC mips64-softmmu/hw/mips/addr.o
CC sparc-softmmu/fpu/softfloat.o
CC mips64-softmmu/hw/mips/cputimer.o
CC mips64el-softmmu/cpus.o
CC sparc64-softmmu/cpu-exec.o
CC mips64-softmmu/target-mips/translate.o
CC mips64el-softmmu/ioport.o
CC sparc64-softmmu/tcg/tcg.o
CC mips64el-softmmu/memory.o
CC sparc-softmmu/cpus.o
CC sparc-softmmu/ioport.o
CC mips64el-softmmu/cputlb.o
CC sparc64-softmmu/tcg/optimize.o
CC sparc-softmmu/memory.o
CC sparc64-softmmu/fpu/softfloat.o
CC sparc-softmmu/cputlb.o
CC mips64el-softmmu/memory_mapping.o
CC mips64el-softmmu/hw/mips/mips_r4k.o
CC sparc-softmmu/memory_mapping.o
CC mips64el-softmmu/hw/mips/addr.o
CC sparc64-softmmu/cpus.o
CC mips64el-softmmu/hw/mips/cputimer.o
CC sparc-softmmu/hw/sparc/leon3.o
CC sparc64-softmmu/ioport.o
CC mips64el-softmmu/target-mips/translate.o
CC sparc-softmmu/target-sparc/translate.o
CC sparc64-softmmu/memory.o
CC mips64-softmmu/target-mips/dsp_helper.o
CC sparc64-softmmu/cputlb.o
CC sparc-softmmu/target-sparc/helper.o
CC sparc-softmmu/target-sparc/cpu.o
CC sparc64-softmmu/memory_mapping.o
CC mips64-softmmu/target-mips/op_helper.o
CC sparc-softmmu/target-sparc/fop_helper.o
CC sparc64-softmmu/hw/sparc64/sun4u.o
CC sparc-softmmu/target-sparc/cc_helper.o
CC sparc64-softmmu/target-sparc/translate.o
CC sparc-softmmu/target-sparc/win_helper.o
CC sparc-softmmu/target-sparc/mmu_helper.o
CC mips64-softmmu/target-mips/lmi_helper.o
CC sparc-softmmu/target-sparc/ldst_helper.o
CC mips64-softmmu/target-mips/helper.o
CC sparc64-softmmu/target-sparc/helper.o
CC sparc-softmmu/target-sparc/int32_helper.o
CC mips64el-softmmu/target-mips/dsp_helper.o
CC mips64-softmmu/target-mips/cpu.o
CC sparc64-softmmu/target-sparc/cpu.o
CC sparc-softmmu/target-sparc/unicorn.o
CC mips64-softmmu/target-mips/msa_helper.o
CC sparc64-softmmu/target-sparc/fop_helper.o
CC mips64el-softmmu/target-mips/op_helper.o
CC sparc64-softmmu/target-sparc/cc_helper.o
CC mips64-softmmu/target-mips/unicorn.o
CC sparc64-softmmu/target-sparc/win_helper.o
CC sparc64-softmmu/target-sparc/mmu_helper.o
CC mips64el-softmmu/target-mips/lmi_helper.o
CC sparc64-softmmu/target-sparc/ldst_helper.o
CC mips64el-softmmu/target-mips/helper.o
CC mips64el-softmmu/target-mips/cpu.o
CC mips64el-softmmu/target-mips/msa_helper.o
CC mips64el-softmmu/target-mips/unicorn.o
CC sparc64-softmmu/target-sparc/int64_helper.o
CC sparc64-softmmu/target-sparc/vis_helper.o
CC sparc64-softmmu/target-sparc/unicorn64.o
GEN libunicorn.1.dylib
GEN libunicorn.a
ar: creating archive libunicorn.a
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: libunicorn.a(qemu-timer-common.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: libunicorn.a(qemu-timer-common.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/make -C samples
make: *** samples: No such file or directory. Stop.
make: *** [all] Error 2
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/6k/fdkg_n356c34dm04hrnj66k00000gn/T/pip-install-vxEjTg/unicorn/setup.py", line 274, in <module>
'unicorn': ['lib/*', 'include/unicorn/*']
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/wheel/bdist_wheel.py", line 192, in run
self.run_command('build')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/private/var/folders/6k/fdkg_n356c34dm04hrnj66k00000gn/T/pip-install-vxEjTg/unicorn/setup.py", line 204, in run
build_libraries()
File "/private/var/folders/6k/fdkg_n356c34dm04hrnj66k00000gn/T/pip-install-vxEjTg/unicorn/setup.py", line 177, in build_libraries
shutil.copy(file, LIBS_DIR, follow_symlinks=False)

TypeError: copy() got an unexpected keyword argument 'follow_symlinks'
----------------------------------------

ERROR: Failed building wheel for unicorn
Running setup.py clean for unicorn
Successfully built pwn
Failed to build unicorn
Installing collected packages: unicorn, pynacl, bcrypt, paramiko, pwntools, pwn
Attempting uninstall: unicorn
Found existing installation: unicorn 1.0.3
Uninstalling unicorn-1.0.3:
Successfully uninstalled unicorn-1.0.3
Running setup.py install for unicorn ... error
ERROR: Command errored out with exit status 1:
command: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/6k/fdkg_n356c34dm04hrnj66k00000gn/T/pip-install-vxEjTg/unicorn/setup.py'"'"'; __file__='"'"'/private/var/folders/6k/fdkg_n356c34dm04hrnj66k00000gn/T/pip-install-vxEjTg/unicorn/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/6k/fdkg_n356c34dm04hrnj66k00000gn/T/pip-record-bgOB1C/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /Users/loki/Library/Python/2.7/include/python2.7/unicorn
cwd: /private/var/folders/6k/fdkg_n356c34dm04hrnj66k00000gn/T/pip-install-vxEjTg/unicorn/
Complete output (31 lines):
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/dist.py:472: UserWarning: Normalizing '1.0.2.rc3' to '1.0.2rc3'
normalized_version,
running install
running build
Building C extensions
/Library/Developer/CommandLineTools/usr/bin/make -C samples
make: *** samples: No such file or directory. Stop.
make: *** [all] Error 2
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/6k/fdkg_n356c34dm04hrnj66k00000gn/T/pip-install-vxEjTg/unicorn/setup.py", line 274, in <module>
'unicorn': ['lib/*', 'include/unicorn/*']
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/install.py", line 573, in run
self.run_command('build')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/private/var/folders/6k/fdkg_n356c34dm04hrnj66k00000gn/T/pip-install-vxEjTg/unicorn/setup.py", line 204, in run
build_libraries()
File "/private/var/folders/6k/fdkg_n356c34dm04hrnj66k00000gn/T/pip-install-vxEjTg/unicorn/setup.py", line 177, in build_libraries
shutil.copy(file, LIBS_DIR, follow_symlinks=False)
TypeError: copy() got an unexpected keyword argument 'follow_symlinks'
----------------------------------------
Rolling back uninstall of unicorn
Moving to /Users/loki/Library/Python/2.7/lib/python/site-packages/unicorn-1.0.3.dist-info/
from /Users/loki/Library/Python/2.7/lib/python/site-packages/~nicorn-1.0.3.dist-info
Moving to /Users/loki/Library/Python/2.7/lib/python/site-packages/unicorn/
from /Users/loki/Library/Python/2.7/lib/python/site-packages/~nicorn
ERROR: Command errored out with exit status 1: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/6k/fdkg_n356c34dm04hrnj66k00000gn/T/pip-install-vxEjTg/unicorn/setup.py'"'"'; __file__='"'"'/private/var/folders/6k/fdkg_n356c34dm04hrnj66k00000gn/T/pip-install-vxEjTg/unicorn/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/6k/fdkg_n356c34dm04hrnj66k00000gn/T/pip-record-bgOB1C/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /Users/loki/Library/Python/2.7/include/python2.7/unicorn Check the logs for full command output.

谷歌了一圈相关的解决方法, 都没有成功。这时候看到可以通过brew安装pwntools,于是尝试一下。

brew安装

网上很多大佬都推荐在brew下安装pwntools,以避免pip安装时发生错误(虽然我在pip3没遇到),于是我尝试在brew下安装。执行brew install pwntools后,安装的版本是4.6且对应版本为python3,

image-20210803232531922

查看资料得知最后一个带有python2的版本是3.13.0,于是尝试安装旧版pwntools:

cd "$(brew --repo homebrew/core)"
git log master -- Formula/pwntools.rb //找到合适的版本
git checkout 哈希值
HOMEBREW_NO_AUTO_UPDATE=1 brew install pwntools

但是发现软件源中已经不提供这个版本的bottle了

image-20210803233146762

源码安装

上面的办法都没办法安装,于是只能从源码入手

https://github.com/Gallopsled/pwntools下载源码,用python2执行setup.py:

python2 setup.py build
sudo python2 setup.py install

这一次安装成功,安装3.13.0和4.6.0都可以,安装4.6.0时会出现编译unicorn的错误,但是可以不用理会,这时候pwntools 4.6.0已经安装进去了,而安装3.13.0时并没有unicorn这个组件所以安装非常顺利。

image-20210803233854456

image-20210803233913801