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

ERROR: fail to load the dynamic library #1474

Open
Hexix23 opened this issue Jun 8, 2024 · 1 comment
Open

ERROR: fail to load the dynamic library #1474

Hexix23 opened this issue Jun 8, 2024 · 1 comment

Comments

@Hexix23
Copy link

Hexix23 commented Jun 8, 2024

*Describe the bug
Im having the following issue on MacOS Sonoma 14.5 everytime Im trying to run qltool.

Sample Code

python qltool
Traceback (most recent call last):
  File "/Users/0xh3l1x/Tools/Emulation/qiling/qltool", line 19, in <module>
    from qiling.arch import utils as arch_utils
  File "/Users/0xh3l1x/Tools/Emulation/qiling/qiling/arch/utils.py", line 14, in <module>
    from keystone import (Ks, KS_ARCH_ARM, KS_ARCH_ARM64, KS_ARCH_MIPS, KS_ARCH_X86, KS_ARCH_PPC,
  File "/Users/0xh3l1x/.pyenv/versions/3.10.14/lib/python3.10/site-packages/keystone/__init__.py", line 4, in <module>
    from .keystone import Ks, ks_version, ks_arch_supported, version_bind, debug, KsError, __version__
  File "/Users/0xh3l1x/.pyenv/versions/3.10.14/lib/python3.10/site-packages/keystone/keystone.py", line 74, in <module>
    raise ImportError("ERROR: fail to load the dynamic library.")
ImportError: ERROR: fail to load the dynamic library.

Additional context
I know that the issue is described on #18 but didnt work.

I already installed also keystone-engine from source and didnt fix it anything

Thanks for the help, will be awesome to fix this :)

@farss
Copy link

farss commented Aug 17, 2024

Try view this:
file /Users/0xh3l1x/.pyenv/versions/3.10.14/lib/python3.10/site-packages/keystone/libkeystone.dylib
And:
file $(which python)

Is there an incompatible architecture?
If true, build and install keystone for arm64 manually. See https://github.com/keystone-engine/keystone/blob/master/docs/COMPILE-NIX.md

cmake -DBUILD_LIBS_ONLY=$BUILD_LIBS_ONLY -DLLVM_BUILD_32_BITS="$LLVM_BUILD_32_BITS" -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DCMAKE_BUILD_TYPE=$BUILDTYPE -DBUILD_SHARED_LIBS=ON -DLLVM_TARGETS_TO_BUILD="ARM;X86" -G "Unix Makefiles" ..

make -j8
sudo make install

When get this:

 file /usr/local/lib/libkeystone.dylib
/usr/local/lib/libkeystone.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [arm64]
/usr/local/lib/libkeystone.dylib (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64
/usr/local/lib/libkeystone.dylib (for architecture arm64):	Mach-O 64-bit dynamically linked shared library arm64

It's fine

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

2 participants