capstone
capstone copied to clipboard
Universal wheel for macOS contains only x86_64 build
When installing the package on an Apple Silicon, the universal wheel being installed is only for intel.
This can be examined:
file /opt/homebrew/lib/python3.11/site-packages/capstone/lib/libcapstone.dylib
# outputs: /opt/homebrew/lib/python3.11/site-packages/capstone/lib/libcapstone.dylib: Mach-O 64-bit dynamically linked shared library x86_64
As a result, capstone
will fail to import on Apple Silicon.
Do you want to use Capstone for AArch64
binaries? If yes, I highly recommend to use the auto-sync
branch and cherry-pick the commits from this PR to make it build on ARM Macs.
Regarding the wheel: cc @kabeor Any progress with this?
I want it to not crash. Not even disassembling.
Added in https://github.com/capstone-engine/capstone/issues/2081
Compile from Apple Silicon:
$ make -j8
[ 1%] Building C object CMakeFiles/capstone.dir/Mapping.c.o
[ 1%] Building C object CMakeFiles/capstone.dir/MCInst.c.o
[ 1%] Building C object CMakeFiles/capstone.dir/cs.c.o
[ 3%] Building C object CMakeFiles/capstone.dir/MCInstPrinter.c.o
[ 3%] Building C object CMakeFiles/capstone.dir/SStream.c.o
[ 5%] Building C object CMakeFiles/capstone.dir/utils.c.o
[ 5%] Building C object CMakeFiles/capstone.dir/MCInstrDesc.c.o
[ 5%] Building C object CMakeFiles/capstone.dir/MCRegisterInfo.c.o
/Users/kabeor/capstone/MCInstPrinter.c:91:1: error: non-void function does not return a value in all control paths [-Werror,-Wreturn-type]
}
^
/Users/kabeor/capstone/MCInst.c:284:1: error: non-void function does not return a value in all control paths [-Werror,-Wreturn-type]
}
^
1 error generated.
1 error generated.
[ 5%] Building C object CMakeFiles/capstone.dir/arch/ARM/ARMBaseInfo.c.o
make[2]: *** [CMakeFiles/capstone.dir/MCInst.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [CMakeFiles/capstone.dir/MCInstPrinter.c.o] Error 1
[ 6%] Building C object CMakeFiles/capstone.dir/arch/ARM/ARMDisassembler.c.o
make[1]: *** [CMakeFiles/capstone.dir/all] Error 2
make: *** [all] Error 2
About MCInstPrinter.c, I guess default
is missing from switch-case
at line 88.
Since the code comes from #1949, Would you mind to have a look? @Rot127
Should be fixed in #2160.
However, the homebrew way is not maintaining by us, compiling source code is ok.
@kabeor I'll wait for the published .whl
package to report when this issue is resolved
I'm also encountering the same problem. Is there a release schedule coming soon so I can install the package directly from pypi
instead of building it myself?
A possible workaround could be to force it to build the x86_64 dylib, then link them together using lipo. But I can't seem to get the x86_64 dylib built. Even if I run
arch -x86_64 python setup.py bdist_wheel
The resulting dylib is arm64. Same result for the cython build. This might also be a hint to what is going wrong, something is detecting the arch in a different way.
Should be fixed via https://github.com/capstone-engine/capstone/commit/a554a1dfb8a468d6df786acc0bb1ad045eb044e9
It seems like this is still not fixed
@acama it should be a part of the upcoming 5.0.2 release
@kabeor