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

Building Ghidraton on ci #53

Closed
madebr opened this issue Jun 19, 2023 · 12 comments
Closed

Building Ghidraton on ci #53

madebr opened this issue Jun 19, 2023 · 12 comments

Comments

@madebr
Copy link

madebr commented Jun 19, 2023

Trying to avoid setting up gradle on my system,
I created a GitHub workflow that builds Ghidraton on ci.

CI result: https://github.com/madebr/Ghidrathon/actions/runs/5313362030

The resulting archive installs fine, but does not run.
There are no logs shown anywhere.

I run Fedora Linux, so I installed python3-jep.

Is there something I am missing?

Also, I can't disable the original Jython plugin in File -> Configure -> Ghidra Core.
There is no item with python there.

@mike-hunhoff
Copy link
Collaborator

@madebr how are you installing the extension?

re: disabling Jython - I just checked Ghidra 10.3 and the Jython extension is listed under File > Configure > Ghidra Core > PythonPlugin found via the CodeBrowser window.

@mike-hunhoff
Copy link
Collaborator

We are also working on improving the installation process in #50

@madebr
Copy link
Author

madebr commented Jun 20, 2023

Thanks, I was looking in the config window of the main ghidra window, not the code browser.

The issue I'm facing now is python version incompatibility: Cannot find libpython3.10.so.1.0.
The version at ci has python 3.10, whereas Fedora ships python 3.11.

I suppose this will also get fixed by #50?

Thanks for the response!

@madebr madebr closed this as completed Jun 20, 2023
@williballenthin
Copy link
Contributor

Thanks, I was looking in the config window of the main ghidra window, not the code browser.

I had the same problem as I followed the instructions recently. I'll propose a fix to the documentation since I bet a bunch of people have been bitten by this.

@williballenthin
Copy link
Contributor

@madebr maybe you can use the setup-python action to specify python 3.10 in CI?

https://github.com/actions/setup-python

@madebr
Copy link
Author

madebr commented Jun 20, 2023

@madebr maybe you can use the setup-python action to specify python 3.10 in CI?

I think that won't work. The system libjep.so that gets copied hard links to libpython3.10.so.1.0

$ ldd libjep.so 
	linux-vdso.so.1 (0x00007ffe1fe63000)
	libjvm.so => not found
	libpython3.10.so.1.0 => not found
	libc.so.6 => /lib64/libc.so.6 (0x00007fb3575ab000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fb3577db000)

@williballenthin
Copy link
Contributor

williballenthin commented Jun 20, 2023

hm, im not totally sure what to suggest, but i will tag you on #50 when i have an alpha build for testing. i'll try to get this done this week. will that work for you?

you could even try the linked Ghidrathon.zip thats there, but no real suspicion that it will work (i haven't tried it on linux yet).

@madebr
Copy link
Author

madebr commented Jun 20, 2023

I rebased on top of #50 (https://github.com/madebr/Ghidrathon/tree/ci-on-willi-build), but it fails to build due to failing jep imports.
See https://github.com/madebr/Ghidrathon/actions/runs/5326239729/jobs/9648005109

Trying the prebuilt ghidra_10.3_PUBLIC_20230613_Ghidrathon-50.zip in #50, I get the following error inside a Ghidrathon window:

java.lang.NullPointerException: Cannot invoke "jep.Jep.set(String, Object)" because "this.jep" is null
	at ghidrathon.interpreter.GhidrathonInterpreter.printWelcome(GhidrathonInterpreter.java:607)
	at ghidrathon.GhidrathonConsoleInputThread.run(GhidrathonConsoleInputThread.java:64)

@williballenthin
Copy link
Contributor

when you install python3-jep, what version of JEP is installed?

@madebr
Copy link
Author

madebr commented Jun 20, 2023

3.9.1

$ sudo dnf info python3-jep.x86_64
Last metadata expiration check: 3:09:14 ago on di 20 jun 2023 17:54:39.
Installed Packages
Name         : python3-jep
Version      : 3.9.1
Release      : 8.fc38
Architecture : x86_64
Size         : 510 k
Source       : python-jep-3.9.1-8.fc38.src.rpm
Repository   : @System
From repo    : fedora
Summary      : Embed Python in Java
URL          : https://github.com/ninia/jep
License      : zlib
Description  : Java Embedded Python
             : JEP embeds CPython in Java through JNI and is safe to use in a
             : heavily threaded environment.
             : 
             : Some benefits of embedding CPython in a JVM:
             :     Using the native Python interpreter may be much faster than
             :     alternatives.
             :     Python is mature, well supported, and well documented.
             :     Access to high quality Python modules, both native CPython
             :     extensions and Python-based.
             :     Compilers and assorted Python tools are as mature as the
             :     language.
             :     Python is an interpreted language, enabling scripting of
             :     established Java code without requiring recompilation.
             :     Both Java and Python are cross platform, enabling deployment
             :     to different operating system.

$ rpm -ql python3-jep.x86_64
/usr/bin/jep
/usr/lib/.build-id
/usr/lib/.build-id/f6
/usr/lib/.build-id/f6/45002408d8b1c225e912bba9f74bc81a66c6b9
/usr/lib64/python3.11/site-packages/jep
/usr/lib64/python3.11/site-packages/jep-3.9.1-py3.11.egg-info
/usr/lib64/python3.11/site-packages/jep-3.9.1-py3.11.egg-info/PKG-INFO
/usr/lib64/python3.11/site-packages/jep-3.9.1-py3.11.egg-info/SOURCES.txt
/usr/lib64/python3.11/site-packages/jep-3.9.1-py3.11.egg-info/dependency_links.txt
/usr/lib64/python3.11/site-packages/jep-3.9.1-py3.11.egg-info/top_level.txt
/usr/lib64/python3.11/site-packages/jep/__init__.py
/usr/lib64/python3.11/site-packages/jep/__pycache__
/usr/lib64/python3.11/site-packages/jep/__pycache__/__init__.cpython-311.opt-1.pyc
/usr/lib64/python3.11/site-packages/jep/__pycache__/__init__.cpython-311.pyc
/usr/lib64/python3.11/site-packages/jep/__pycache__/console.cpython-311.opt-1.pyc
/usr/lib64/python3.11/site-packages/jep/__pycache__/console.cpython-311.pyc
/usr/lib64/python3.11/site-packages/jep/__pycache__/java_import_hook.cpython-311.opt-1.pyc
/usr/lib64/python3.11/site-packages/jep/__pycache__/java_import_hook.cpython-311.pyc
/usr/lib64/python3.11/site-packages/jep/__pycache__/jdbc.cpython-311.opt-1.pyc
/usr/lib64/python3.11/site-packages/jep/__pycache__/jdbc.cpython-311.pyc
/usr/lib64/python3.11/site-packages/jep/__pycache__/redirect_streams.cpython-311.opt-1.pyc
/usr/lib64/python3.11/site-packages/jep/__pycache__/redirect_streams.cpython-311.pyc
/usr/lib64/python3.11/site-packages/jep/__pycache__/shared_modules_hook.cpython-311.opt-1.pyc
/usr/lib64/python3.11/site-packages/jep/__pycache__/shared_modules_hook.cpython-311.pyc
/usr/lib64/python3.11/site-packages/jep/__pycache__/version.cpython-311.opt-1.pyc
/usr/lib64/python3.11/site-packages/jep/__pycache__/version.cpython-311.pyc
/usr/lib64/python3.11/site-packages/jep/console.py
/usr/lib64/python3.11/site-packages/jep/java_import_hook.py
/usr/lib64/python3.11/site-packages/jep/jdbc.py
/usr/lib64/python3.11/site-packages/jep/jep-3.9.1.jar
/usr/lib64/python3.11/site-packages/jep/jep.cpython-311-x86_64-linux-gnu.so
/usr/lib64/python3.11/site-packages/jep/libjep.so
/usr/lib64/python3.11/site-packages/jep/redirect_streams.py
/usr/lib64/python3.11/site-packages/jep/shared_modules_hook.py
/usr/lib64/python3.11/site-packages/jep/version.py
/usr/share/doc/python3-jep
/usr/share/doc/python3-jep/AUTHORS
/usr/share/doc/python3-jep/README.rst
/usr/share/doc/python3-jep/release_notes
/usr/share/doc/python3-jep/release_notes/1.0-notes.rst
/usr/share/doc/python3-jep/release_notes/1.1-notes.rst
/usr/share/doc/python3-jep/release_notes/2.0-notes.rst
/usr/share/doc/python3-jep/release_notes/2.1-notes.rst
/usr/share/doc/python3-jep/release_notes/2.2-notes.rst
/usr/share/doc/python3-jep/release_notes/2.3-notes.rst
/usr/share/doc/python3-jep/release_notes/2.4-notes.rst
/usr/share/doc/python3-jep/release_notes/3.0-notes.rst
/usr/share/doc/python3-jep/release_notes/3.1-notes.rst
/usr/share/doc/python3-jep/release_notes/3.2-notes.rst
/usr/share/doc/python3-jep/release_notes/3.3-notes.rst
/usr/share/doc/python3-jep/release_notes/3.4-notes.rst
/usr/share/doc/python3-jep/release_notes/3.5-notes.rst
/usr/share/doc/python3-jep/release_notes/3.6-notes.rst
/usr/share/doc/python3-jep/release_notes/3.7-notes.rst
/usr/share/doc/python3-jep/release_notes/3.8-notes.rst
/usr/share/doc/python3-jep/release_notes/3.9-notes.rst
/usr/share/licenses/python3-jep
/usr/share/licenses/python3-jep/LICENSE

@williballenthin
Copy link
Contributor

when you try to use #50, the issue is almost certainly due to #50 using JEP 4.1.1 and fedora providing 3.9.1.

i'd recommend fetching JEP via pip rather than dnf, and possibly pinning to the hardcoded version.

the documentation for Ghidrathon doesn't make it extremely clear how versions are supposed to match. but you can assume they'd better be the same on the system that builds and the system that runs, at least the python interpreter version (say 3.10) and the python JEP package (say 4.1.1). the current Ghidrathon installation process pretty much assumes you're building on the workstation. we'll try to fix this.

@madebr
Copy link
Author

madebr commented Jun 20, 2023

So I removed the system python3-jep package, installed python3.10 and installed jep via python3.10 -m pip jep==3.9.1.
The error remains the same, as in #53 (comment)

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