capstone-engine / capstone

Capstone disassembly/disassembler framework for ARM, ARM64 (ARMv8), Alpha, BPF, Ethereum VM, HPPA, LoongArch, M68K, M680X, Mips, MOS65XX, PPC, RISC-V(rv32G/rv64G), SH, Sparc, SystemZ, TMS320C64X, TriCore, Webassembly, XCore and X86.
http://www.capstone-engine.org
7.61k stars 1.56k forks source link

MacOS wheel only contains x86_64 version of the libcapstone.dylib despite the package claims to be universal #2301

Closed xusheng6 closed 7 months ago

xusheng6 commented 7 months ago

I installed capstone using pip install capstone and the installation succeeds. However, when I try to run Python and import capstone, I am met with the following error:

OSError: dlopen(/opt/homebrew/lib/python3.11/site-packages/capstone/lib/libcapstone.dylib, 0x0006): tried: '/opt/homebrew/lib/python3.11/site-packages/capstone/lib/libcapstone.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/lib/python3.11/site-packages/capstone/lib/libcapstone.dylib' (no such file), '/opt/homebrew/lib/python3.11/site-packages/capstone/lib/libcapstone.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))

I checked the wheel for macOS (https://files.pythonhosted.org/packages/56/c9/936a81a0707fbd2650a94c9297e36c4c2cf34f51695fb1f6fd39de1b3247/capstone-5.0.1-py3-none-macosx_10_9_universal2.whl), and found the libcapstone.dylib is x86_64 only, and not universal, as it claims to be (on https://pypi.org/project/capstone/#files).

I tested brew install capstone and it gives me an arm64 libcapstone.dylib in /opt/homebrew/Cellar/capstone/5.0.1/lib. I figured out a workaround that is to copy the dylib from the brew installation folder to the pip installation folder.

Work environment

Questions Answers
OS/arch/bits MacOS AArch64,
Architecture armv8
Source of Capstone pip
Version/git commit v5.0.1

Expected behavior

Actual behavior

Steps to reproduce the behavior

Additional Logs, screenshots, source code, configuration dump, ...

Drag and drop zip archives containing the Additional info here, don't use external services or link. Screenshots can be directly dropped here.

Rot127 commented 7 months ago

Thanks for the report! I close this as duplicate because it:

andiradulescu commented 4 months ago

@Rot127 when is v5.0.2 planned for release? I don't see a date here. Thanks!

Rot127 commented 4 months ago

@andiradulescu v5.0.2 is released after https://github.com/capstone-engine/capstone/pull/2400 is merged by @kabeor.