unicorn-engine / unicorn

Unicorn CPU emulator framework (ARM, AArch64, M68K, Mips, Sparc, PowerPC, RiscV, S390x, TriCore, X86)
http://www.unicorn-engine.org
GNU General Public License v2.0
7.48k stars 1.33k forks source link

errors in loading libunicorn.so #678

Closed seem111 closed 2 years ago

seem111 commented 7 years ago

ctypes.cdll.LoadLibrary("/usr/lib/python2.6/site-packages/unicorn-1.0.0-py2.6.egg/unicorn/lib/libunicorn.so") Traceback (most recent call last): File "", line 1, in File "/usr/lib64/python2.6/ctypes/init.py", line 431, in LoadLibrary return self._dlltype(name) File "/usr/lib64/python2.6/ctypes/init.py", line 353, in init self._handle = _dlopen(self._name, mode) OSError: /usr/lib/python2.6/site-packages/unicorn-1.0.0-py2.6.egg/unicorn/lib/libunicorn.so: undefined symbol: clock_gettime

when I compile the unicorn and run the unicorn. I got the above errors. why?

aquynh commented 7 years ago

on Linux, can you try this installation instead?

$ sudo pip install "https://github.com/unicorn-engine/unicorn/archive/master.zip#egg=unicorn&subdirectory=bindings/python"
seem111 commented 7 years ago

I have uninstalled the unicorn and install it with your code and got the error:

import unicorn Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.6/site-packages/unicorn/init.py", line 4, in from .unicorn import Uc, uc_version, uc_arch_supported, version_bind, debug, UcError, version File "/usr/lib/python2.6/site-packages/unicorn/unicorn.py", line 73, in raise ImportError("ERROR: fail to load the dynamic library.") ImportError: ERROR: fail to load the dynamic library.

aquynh commented 7 years ago

can you remove all that, and try again with latest Github code like below, to see how it works?

$ ./make.sh
$ sudo ./make.sh install
$ cd bindings/python
$ sudo make install
seem111 commented 7 years ago

I got the same error. I try to add -lrt in the makefile. But it doesn't work.

$ ./make.sh if [ "x86 m68k arm aarch64 mips sparc" != "cat config.log" ]; then make clean; fi cd qemu && make -j 4 make[1]: Entering directory /home/admin/unicorn/unicorn-master/qemu' make[1]: Leaving directory/home/admin/unicorn/unicorn-master/qemu' make unicorn make[1]: Entering directory /home/admin/unicorn/unicorn-master' make[1]: Nothing to be done forunicorn'. make[1]: Leaving directory /home/admin/unicorn/unicorn-master' make[1]: Entering directory/home/admin/unicorn/unicorn-master/samples' LINK sample_arm ../libunicorn.so: undefined reference to clock_gettime' collect2: ld ▒▒▒▒ 1 make[1]: *** [sample_arm] ▒▒▒▒ 1 make[1]: Leaving directory/home/admin/unicorn/unicorn-master/samples' make: *\ [all] ▒▒▒▒ 2

aquynh commented 7 years ago

no, dont make that change in Makefile.

looks like you cannot even compile yet. what is your Linux version? and did you install dependency, as instructed in https://github.com/unicorn-engine/unicorn/blob/master/docs/COMPILE-NIX.md yet?

- For Linux, "glib2-dev" is needed.
  Ubuntu/Debian users can install this with:

        $ sudo apt-get install libglib2.0-dev
seem111 commented 7 years ago

My linux is (Red Hat 4.4.4-13). So I can't find the libglib2-dev. Which dependency should I have?

aquynh commented 7 years ago

This is why you cannot compile. You need libglib2, but i dont know if they have that on this old Redhat version