capstone icon indicating copy to clipboard operation
capstone copied to clipboard

Installing on mac OSX using --pre --no-binary fails on version 5.0.3, worked fine on vesrion 5.0.2

Open guyshe-jfrog opened this issue 1 year ago • 8 comments

The current install released just 18 hours ago fails to install on mac osx 12. The previous minor version 5.0.2 works fine.

Work environment

Questions Answers
OS/arch/bits OS X 13 , arm64 , python 3.10
Architecture Darwin ip-10-207-38-2.ec2.internal 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul 5 22:22:52 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T8103 arm64
Source of Capstone 5.0.3
Version/git commit pipy release

Expected behavior

Expected (output on 5.0.2):

(venv310) ip-10-207-38-2:~ guyshe$ arch -arm64 python3.10 -m pip install --pre --no-binary capstone capstone==5.0.2
Collecting capstone==5.0.2
  Downloading capstone-5.0.2.tar.gz (2.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.9/2.9 MB 50.9 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: capstone
  Building wheel for capstone (pyproject.toml) ... done
  Created wheel for capstone: filename=capstone-5.0.2-py3-none-macosx_10_9_universal2.whl size=2510976 sha256=ae8597e05782ef14127a359f66e653528da4e71737a158ebed83a5d653f54634
  Stored in directory: /Users/guyshe/Library/Caches/pip/wheels/cf/bb/6d/21cb82e8667a300c9323510e7c1a431aa72f4b89e33db35f2d
Successfully built capstone
Installing collected packages: capstone
ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/private/tmp/venv310/lib/python3.10/site-packages/capstone'
Check the permissions.


[notice] A new release of pip is available: 24.1.2 -> 24.2
[notice] To update, run: pip install --upgrade pip
(venv310) ip-10-207-38-2:~ guyshe$ sudo arch -arm64 python3.10 -m pip install --pre --no-binary capstone capstone==5.0.2
WARNING: The directory '/Users/guyshe/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
Collecting capstone==5.0.2
  Downloading capstone-5.0.2.tar.gz (2.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.9/2.9 MB 219.5 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: capstone
  Building wheel for capstone (pyproject.toml) ... done
  Created wheel for capstone: filename=capstone-5.0.2-py3-none-macosx_10_9_universal2.whl size=2510901 sha256=509c7c300c046ce444c15e350add13fb84467cc953dfd62420ffa8d68017a8f5
  Stored in directory: /private/tmp/pip-ephem-wheel-cache-23m11w5l/wheels/cf/bb/6d/21cb82e8667a300c9323510e7c1a431aa72f4b89e33db35f2d
Successfully built capstone
Installing collected packages: capstone
Successfully installed capstone-5.0.2

[notice] A new release of pip is available: 24.1.2 -> 24.2
[notice] To update, run: pip install --upgrade pip

Actual behavior

With current version:

(venv310) ip-10-207-38-2:~ guyshe$ arch -arm64 python3.10 -m pip install --pre --no-binary capstone capstone
Collecting capstone
  Using cached capstone-5.0.3.tar.gz (2.9 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: capstone
  Building wheel for capstone (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for capstone (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [56 lines of output]
      INFO:root:running bdist_wheel
      INFO:root:running build
      INFO:__main__:Building C extensions
      -- The C compiler identification is AppleClang 14.0.3.14030022
      -- The CXX compiler identification is AppleClang 14.0.3.14030022
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      Enabling CAPSTONE_ARM_SUPPORT
      Enabling CAPSTONE_ARM64_SUPPORT
      Enabling CAPSTONE_M68K_SUPPORT
      Enabling CAPSTONE_MIPS_SUPPORT
      Enabling CAPSTONE_PPC_SUPPORT
      Enabling CAPSTONE_SPARC_SUPPORT
      Enabling CAPSTONE_SYSZ_SUPPORT
      Enabling CAPSTONE_XCORE_SUPPORT
      Enabling CAPSTONE_X86_SUPPORT
      Enabling CAPSTONE_TMS320C64X_SUPPORT
      Enabling CAPSTONE_M680X_SUPPORT
      Enabling CAPSTONE_EVM_SUPPORT
      Enabling CAPSTONE_MOS65XX_SUPPORT
      Enabling CAPSTONE_WASM_SUPPORT
      Enabling CAPSTONE_BPF_SUPPORT
      Enabling CAPSTONE_RISCV_SUPPORT
      Enabling CAPSTONE_SH_SUPPORT
      Enabling CAPSTONE_TRICORE_SUPPORT
      CMake Error: File /private/var/folders/xg/rv2p8hlj1xd7bxd0jzhxbnvc0000gp/T/pip-install-7hkswzm2/capstone_9df69f0c7485404290eefcbd2e8b7b86/src/capstone.pc.in does not exist.
      CMake Error at CMakeLists.txt:734 (configure_file):
        configure_file Problem configuring file


      CMake Error: File /private/var/folders/xg/rv2p8hlj1xd7bxd0jzhxbnvc0000gp/T/pip-install-7hkswzm2/capstone_9df69f0c7485404290eefcbd2e8b7b86/src/capstone-config.cmake.in does not exist.
      CMake Error at /opt/homebrew/Cellar/cmake/3.30.2/share/cmake/Modules/CMakePackageConfigHelpers.cmake:501 (configure_file):
        configure_file Problem configuring file
      Call Stack (most recent call first):
        CMakeLists.txt:739 (configure_package_config_file)


      CMake Error: File /private/var/folders/xg/rv2p8hlj1xd7bxd0jzhxbnvc0000gp/T/pip-install-7hkswzm2/capstone_9df69f0c7485404290eefcbd2e8b7b86/src/cmake_uninstall.cmake.in does not exist.
      CMake Error at CMakeLists.txt:771 (configure_file):
        configure_file Problem configuring file


      -- Configuring incomplete, errors occurred!
      make: Makefile: No such file or directory
      make: *** No rule to make target `Makefile'.  Stop.
      Build Directory: /private/var/folders/xg/rv2p8hlj1xd7bxd0jzhxbnvc0000gp/T/pip-install-7hkswzm2/capstone_9df69f0c7485404290eefcbd2e8b7b86/src/build

      error: [Errno 2] No such file or directory: 'libcapstone.5.dylib'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for capstone
Failed to build capstone
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (capstone)

[notice] A new release of pip is available: 24.1.2 -> 24.2
[notice] To update, run: pip install --upgrade pip

Steps to reproduce the behavior

  • Use code markdown CODE to make your code visible

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.

guyshe-jfrog avatar Aug 21 '24 10:08 guyshe-jfrog

Without --no-binary it works I assume? Could you try just pip install capstone

Rot127 avatar Aug 21 '24 10:08 Rot127

Yes that seems to work:

(venv310) ip-10-207-38-2:~ guyshe$ sudo pip install capstone -U
WARNING: The directory '/Users/guyshe/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
Requirement already satisfied: capstone in /private/tmp/venv310/lib/python3.10/site-packages (5.0.2)
Collecting capstone
  Downloading capstone-5.0.3-py3-none-macosx_11_0_arm64.whl.metadata (3.3 kB)
Downloading capstone-5.0.3-py3-none-macosx_11_0_arm64.whl (1.2 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 163.1 MB/s eta 0:00:00
Installing collected packages: capstone
  Attempting uninstall: capstone
    Found existing installation: capstone 5.0.2
    Uninstalling capstone-5.0.2:
      Successfully uninstalled capstone-5.0.2
Successfully installed capstone-5.0.3

[notice] A new release of pip is available: 24.1.2 -> 24.2
[notice] To update, run: pip install --upgrade pip

The reason I am using no binary is because I want to build a universal binary that would also work via pyinstaller. No sure if that would work like that.

guyshe-jfrog avatar Aug 21 '24 10:08 guyshe-jfrog

We just fixed the universal binaries in the last release. The capstone-5.0.3-py3-none-macosx_10_9_universal2.whl ships the fat binary.

Rot127 avatar Aug 21 '24 10:08 Rot127

I think it should be pip install capstone --platform=universal2

Rot127 avatar Aug 21 '24 10:08 Rot127

Thanks, will test and update. I want to see it plays well with pyinstaller

guyshe-jfrog avatar Aug 25 '24 12:08 guyshe-jfrog

If you want to build the wheel on your own, I would advice to build Capstone normally with cmake.

Then copy the dynlib to bindings/python/prebuild/ and do the wheel build in bindings/python/. And ensure that bindings/python/capstone/lib/ doesn't hold an old version. Otherwise, for normal usage, I advice using the normal Python package now that it finally works.

Rot127 avatar Aug 25 '24 12:08 Rot127

Ping :)

Rot127 avatar Sep 04 '24 10:09 Rot127

Hey, did not forget. I just have a few other things in my queue before getting back to this. Might take until the end of the month.

guyshe-jfrog avatar Sep 08 '24 08:09 guyshe-jfrog