korcankaraokcu / PINCE

Reverse engineering tool for linux games
Other
2.13k stars 149 forks source link

distorm3 import error #245

Closed BlindChickens closed 8 months ago

BlindChickens commented 8 months ago

I am on ubuntu20.04. I had to create the venv with python3.11 beforehand, and then I edited some places in install_pince.sh and PINCE.sh to specifically state python3.11 for everything to run in the end.

When I start the process, the log looks like this. Needless to say it then does not work when selecting a process from the running application.

(PINCE) ~/workspace/PINCE ->sh PINCE.sh
qt.qpa.theme.dbus: Session DBus not running.
qt.qpa.theme.dbus: Application will not react to setting changes.
 Check your DBus installation.
Detached from the process with PID:-1
Last command: set logging enabled off
&"/dev/shm/PINCE_IPC/-1/gdb_command.txt:1: Error in sourced command file:\n"
&"Undefined set logging command: \"enabled off\".  Try \"help set logging\".\n"
^error,msg="/dev/shm/PINCE_IPC/-1/gdb_command.txt:1: Error in sourced command file:\nUndefined set logging command: \"enabled off\".  Try \"help set logging\"."
0.0012829303741455078
Last command: set logging file /tmp/PINCE/-1/gdb_log.txt
=cmd-param-changed,param="logging file",value="/tmp/PINCE/-1/gdb_log.txt"
^done
0.0007162094116210938
Last command: source ./gdbinit_venv
^done
0.02410888671875
Last command: set $GDBINIT_AA_PATH="/home/combrink/.config/PINCE/PINCE_USER_FILES/gdbinit_after_attach"
^done
0.0007557868957519531
Last command: set $PINCE_PATH="/home/combrink/workspace/PINCE"
^done
0.0005240440368652344
Last command: source gdb_python_scripts/gdbextensions.py
&"Traceback (most recent call last):\n"
&"  File \"gdb_python_scripts/gdbextensions.py\", line 18, in <module>\n"
&"    import gdb, pickle, json, sys, re, struct, ctypes, os, shelve, distorm3, importlib\n"
&"  File \"/home/combrink/workspace/PINCE/.venv/PINCE/lib/python3.11/site-packages/distorm3/__init__.py\", line 57, in <module>\n"
&"    _distorm = _load_distorm()\n"
&"  File \"/home/combrink/workspace/PINCE/.venv/PINCE/lib/python3.11/site-packages/distorm3/__init__.py\", line 55, in _load_distorm\n"
&"    raise ImportError(\"Error loading the diStorm dynamic library (or cannot load library into process).\")\n"
&"ImportError: Error loading the diStorm dynamic library (or cannot load library into process).\n"
^done
0.15489768981933594
Last command: source /home/combrink/.config/PINCE/PINCE_USER_FILES/gdbinit
^done
0.0007915496826171875
Last command: set logging enabled off
&"/dev/shm/PINCE_IPC/-1/gdb_command.txt:1: Error in sourced command file:\n"
&"Undefined set logging command: \"enabled off\".  Try \"help set logging\".\n"
^error,msg="/dev/shm/PINCE_IPC/-1/gdb_command.txt:1: Error in sourced command file:\nUndefined set logging command: \"enabled off\".  Try \"help set logging\"."
0.0007433891296386719
Last command: set logging file /tmp/PINCE/-1/gdb_log.txt
^done
0.0005998611450195312
qt.qpa.input.events: scroll event from unregistered device 18

Please help?

Thanks

brkzlr commented 8 months ago

Why did you edit the installer instead of letting it do its own thing?

BlindChickens commented 8 months ago

Why did you edit the installer instead of letting it do its own thing?

I just hit constant snags and some things pointed to it being related to the python3.8 that was being used by default.

brkzlr commented 8 months ago

Your manual method of installation didn't work because you're still missing some of the installation dependencies of distorm that are handled automatically by the installer.

You should leave the default installer alone and post the issue that you have with the installer itself.

BlindChickens commented 8 months ago

I am happy to that. Here is full log of running the installer.

Reading package lists... Done
Building dependency tree       
Reading state information... Done
libcairo2-dev is already the newest version (1.16.0-4ubuntu1).
libtool is already the newest version (2.4.6-14).
libxcb-randr0-dev is already the newest version (1.14-2).
libxcb-shape0-dev is already the newest version (1.14-2).
libxcb-xinerama0-dev is already the newest version (1.14-2).
libxcb-xkb-dev is already the newest version (1.14-2).
libxcb-xtest0-dev is already the newest version (1.14-2).
pkg-config is already the newest version (0.29.1-0ubuntu4).
python3-dev is already the newest version (3.8.2-0ubuntu2).
libxcb-cursor0 is already the newest version (0.1.1-4ubuntu1).
python3-venv is already the newest version (3.8.2-0ubuntu2).
gdb is already the newest version (9.2-0ubuntu1~20.04.1).
libgirepository1.0-dev is already the newest version (1.64.1-1~ubuntu20.04.1).
python3-pip is already the newest version (20.0.2-5ubuntu1.10).
qt6-l10n-tools is already the newest version (6.2.2-3~focal1).
0 upgraded, 0 newly installed, 0 to remove and 28 not upgraded.
Collecting PyQt6==6.6.0
  Using cached PyQt6-6.6.0.tar.gz (1.0 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... error
    ERROR: Command errored out with exit status 1:
     command: /home/combrink/workspace/PINCE/.venv/PINCE/bin/python3 /tmp/tmpzkc8o3wn prepare_metadata_for_build_wheel /tmp/tmp9siogywi
         cwd: /tmp/pip-install-i_v6xse6/PyQt6
    Complete output (37 lines):
    Querying qmake about your Qt installation...
    pyproject.toml: line 7: using '[tool.sip.metadata]' to specify the project metadata is deprecated and will be removed in SIP v7.0.0, use '[project]' instead
    Traceback (most recent call last):
      File "/tmp/tmpzkc8o3wn", line 126, in prepare_metadata_for_build_wheel
        hook = backend.prepare_metadata_for_build_wheel
    AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/tmp/tmpzkc8o3wn", line 280, in <module>
        main()
      File "/tmp/tmpzkc8o3wn", line 263, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "/tmp/tmpzkc8o3wn", line 130, in prepare_metadata_for_build_wheel
        return _get_wheel_metadata_from_wheel(backend, metadata_directory,
      File "/tmp/tmpzkc8o3wn", line 159, in _get_wheel_metadata_from_wheel
        whl_basename = backend.build_wheel(metadata_directory, config_settings)
      File "/tmp/pip-build-env-qmco7bdj/overlay/lib/python3.8/site-packages/sipbuild/api.py", line 46, in build_wheel
        project = AbstractProject.bootstrap('wheel',
      File "/tmp/pip-build-env-qmco7bdj/overlay/lib/python3.8/site-packages/sipbuild/abstract_project.py", line 92, in bootstrap
        project.setup(pyproject, tool, tool_description)
      File "/tmp/pip-build-env-qmco7bdj/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 587, in setup
        self.apply_user_defaults(tool)
      File "/tmp/pip-install-i_v6xse6/PyQt6/project.py", line 66, in apply_user_defaults
        super().apply_user_defaults(tool)
      File "/tmp/pip-build-env-qmco7bdj/overlay/lib/python3.8/site-packages/pyqtbuild/project.py", line 70, in apply_user_defaults
        super().apply_user_defaults(tool)
      File "/tmp/pip-build-env-qmco7bdj/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 237, in apply_user_defaults
        self.builder.apply_user_defaults(tool)
      File "/tmp/pip-build-env-qmco7bdj/overlay/lib/python3.8/site-packages/pyqtbuild/builder.py", line 78, in apply_user_defaults
        self._get_qt_configuration()
      File "/tmp/pip-build-env-qmco7bdj/overlay/lib/python3.8/site-packages/pyqtbuild/builder.py", line 497, in _get_qt_configuration
        for line in project.read_command_pipe([self.qmake, '-query']):
      File "/tmp/pip-build-env-qmco7bdj/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 554, in read_command_pipe
        raise UserException(
    sipbuild.exceptions.UserException
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/combrink/workspace/PINCE/.venv/PINCE/bin/python3 /tmp/tmpzkc8o3wn prepare_metadata_for_build_wheel /tmp/tmp9siogywi Check the logs for full command output.

Error occured while installing PINCE, check the output above for more information
Installation failed.

I hope you can help with this?

brkzlr commented 8 months ago

It looks like your PIP version might be outdated. Try upgrading your pip version to the latest available for your system python, delete the venv folder and try running the installer again.

If you need to change the default python version to a newer one because it's still too old, try using update-alternatives to change the default python version to a newer one instead of modifying the installer.

EDIT: More specifically, in the install log your pip is 20 while latest is pip 24, but I can confirm it works with PIP 21 or 22

BlindChickens commented 8 months ago

Ok thanks so much.

When trying to update pip this happens.

~/workspace/PINCE ->pip3 install --upgrade pip
Collecting pip
  Using cached pip-24.0-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
Successfully installed pip-24.0
~/workspace/PINCE ->pip3 -V
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

But I just upgraded it in the install venv, and everything installed smoothly.

Now I am at this point.

~/workspace/PINCE ->sh PINCE.sh
Traceback (most recent call last):
  File "PINCE.py", line 24, in <module>
    from GUI.Settings.hotkeys import Hotkeys
  File "/home/combrink/workspace/PINCE/GUI/Settings/hotkeys.py", line 42, in <module>
    class Hotkeys:
  File "/home/combrink/workspace/PINCE/GUI/Settings/hotkeys.py", line 54, in Hotkeys
    def get_hotkeys(self) -> list[Hotkey]:
TypeError: 'type' object is not subscriptable

Edit: And this is what led me to believe I need to get use different python. https://stackoverflow.com/a/75202688

brkzlr commented 8 months ago

If you need to change the default python version to a newer one because it's still too old, try using update-alternatives to change the default python version to a newer one instead of modifying the installer.

Change your python version as 3.8 is too old.

BlindChickens commented 8 months ago

Yeah that makes sense. I don't really know how to safely change the default python version on my current ubuntu, as it is not advisable to change it from python3.8.

So I would need to upgrade to Ubuntu 21 or 22 that comes with a higher version of python3.

Will try get to that soon.

Thanks for the help.

PS. I think a minimum python3 version in the readme will help other people maybe too.

brkzlr commented 8 months ago

PS. I think a minimum python3 version in the readme will help other people maybe too.

That will be decided soon enough. The 3.9+ exclusive type hints are very new additions so the incompatibility with Python 3.8 and earlier was not expected.