Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip3 installing capstone takes wrong arch of dylib #2084

Closed
Levako opened this issue Jul 13, 2023 · 3 comments
Closed

pip3 installing capstone takes wrong arch of dylib #2084

Levako opened this issue Jul 13, 2023 · 3 comments

Comments

@Levako
Copy link

Levako commented Jul 13, 2023

Device: MacOS, MacBook Pro M2 Max, ver. Ventura 13.4

pip3 seems to take a different arch of capstone's dylib - x86_64, instead of my device's one - arm64
Made sure that pip3 has a cleared cache of wheels

Running:
`

pip3 install capstone

python3 -m capstone
Traceback (most recent call last):
File "/opt/homebrew/Cellar/[email protected]/3.9.17/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 188, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/opt/homebrew/Cellar/[email protected]/3.9.17/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 147, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/opt/homebrew/Cellar/[email protected]/3.9.17/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 111, in _get_module_details
import(pkg_name)
File "/opt/homebrew/lib/python3.9/site-packages/capstone/init.py", line 372, in
_cs = _load_lib(_path)
File "/opt/homebrew/lib/python3.9/site-packages/capstone/init.py", line 345, in _load_lib
return ctypes.cdll.LoadLibrary(lib_file)
File "/opt/homebrew/Cellar/[email protected]/3.9.17/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ctypes/init.py", line 452, in LoadLibrary
return self._dlltype(name)
File "/opt/homebrew/Cellar/[email protected]/3.9.17/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ctypes/init.py", line 374, in init
self._handle = _dlopen(self._name, mode)
OSError: dlopen(/opt/homebrew/lib/python3.9/site-packages/capstone/lib/libcapstone.dylib, 0x0006): tried: '/opt/homebrew/lib/python3.9/site-packages/capstone/lib/libcapstone.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/lib/python3.9/site-packages/capstone/lib/libcapstone.dylib' (no such file), '/opt/homebrew/lib/python3.9/site-packages/capstone/lib/libcapstone.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))
`

Double checked that with lipo:
`

lipo -archs /opt/homebrew/lib/python3.9/site-packages/capstone/lib/libcapstone.dylib
x86_64
`

I check my platform's architecture using python - it might be related to the issue:
`

python3
Python 3.9.17 (main, Jun 15 2023, 08:01:12)
[Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

from distutils.util import get_platform
print(get_platform())
macosx-13-arm64
`

Then I tried:
`

pip3 install capstone --platform macosx-10_9-universal2 --no-deps --upgrade --target .
lipo -archs capstone/lib/libcapstone.dylib
arm64
`

And accessing the module works now when I put this package in $PATH:
`

python3 -m capstone
`

@XVilka
Copy link
Contributor

XVilka commented Jul 13, 2023

Is it the same as #2066?

@Levako
Copy link
Author

Levako commented Jul 13, 2023

Yeah looks like it, maybe the additional information could help.

@kabeor
Copy link
Member

kabeor commented Jul 21, 2023

should have be fixed in #2099.

Closed for now.

@kabeor kabeor closed this as completed Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants