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

ImportError: No module named dwarf4 #27

Open
zwilcox opened this issue Jan 4, 2025 · 1 comment
Open

ImportError: No module named dwarf4 #27

zwilcox opened this issue Jan 4, 2025 · 1 comment

Comments

@zwilcox
Copy link

zwilcox commented Jan 4, 2025

I'm getting the following error when running ghidra2dwarf:

Traceback (most recent call last):
  File "/home/_____/ghidra2dwarf/ghidra2dwarf.py", line 22, in <module>
    from ghidra.app.util.bin.format.dwarf4.next import DWARFRegisterMappingsManager
ImportError: No module named dwarf4

It runs after I manually changed it to:

from ghidra.app.util.bin.format.dwarf
ghidra2dwarf.py> Running...
Decompiling function 0: _init
Decompiling function 1: entry
Decompiling function 2: __lshrdi3
...
...
...

Just incase any of this matters:

import sys; print sys.path
['/home/____/.config/ghidra/ghidra_11.1_PUBLIC/dev/jython_cachedir/python-src', 
'/opt/ghidra_11.1/Ghidra/Features/Python/data/jython-2.7.3/Lib', '/opt/ghidra_11.1/Ghidra/Features/Python/lib/jython-standalone-2.7.3.jar/Lib', '__classpath__', '__pyclasspath__/', '/opt/ghidra_11.1/Ghidra/Features/Python/data/jython-2.7.3/Lib/site-packages', '/opt/ghidra_11.1/Ghidra/Features/FunctionID/ghidra_scripts', 
'/opt/ghidra_11.1/Ghidra/Features/WildcardAssembler/ghidra_scripts', 
'/opt/ghidra_11.1/Ghidra/Features/GnuDemangler/ghidra_scripts', 
'/opt/ghidra_11.1/Ghidra/Features/VersionTracking/ghidra_scripts', 
'/opt/ghidra_11.1/Ghidra/Features/SwiftDemangler/ghidra_scripts', 
'/opt/ghidra_11.1/Ghidra/Features/MicrosoftCodeAnalyzer/ghidra_scripts', 
'/opt/ghidra_11.1/Ghidra/Processors/8051/ghidra_scripts', '/opt/ghidra_11.1/Ghidra/Features/BytePatterns/ghidra_scripts', 
'/opt/ghidra_11.1/Ghidra/Processors/JVM/ghidra_scripts', '/opt/ghidra_11.1/Ghidra/Processors/DATA/ghidra_scripts', 
'/opt/ghidra_11.1/Ghidra/Debug/Debugger-agent-frida/ghidra_scripts', '/opt/ghidra_11.1/Ghidra/Features/Base/ghidra_scripts', 
'/opt/ghidra_11.1/Ghidra/Debug/Debugger-agent-dbgmodel-traceloader/ghidra_scripts', 
'/opt/ghidra_11.1/Ghidra/Processors/Atmel/ghidra_scripts', '/home/____/ghidra2dwarf', 
'/opt/ghidra_11.1/Ghidra/Processors/PIC/ghidra_scripts', '/opt/ghidra_11.1/Ghidra/Debug/Debugger/ghidra_scripts', 
'/opt/ghidra_11.1/Ghidra/Features/BSim/ghidra_scripts', '/opt/ghidra_11.1/Ghidra/Debug/Debugger-rmi-trace/ghidra_scripts', 
'/opt/ghidra_11.1/Ghidra/Features/FileFormats/ghidra_scripts', 
'/opt/ghidra_11.1/Ghidra/Features/SystemEmulation/ghidra_scripts', '/opt/ghidra_11.1/Ghidra/Features/Python/ghidra_scripts', 
'/opt/ghidra_11.1/Ghidra/Features/Decompiler/ghidra_scripts', '/opt/ghidra_11.1/Ghidra/Features/PDB/ghidra_scripts', 
'/home/____/.config/ghidra/ghidra_11.1_PUBLIC/osgi/compiled-bundles', 
'/home/____/.config/ghidra/ghidra_11.1_PUBLIC/osgi/felixcache']
@zwilcox
Copy link
Author

zwilcox commented Jan 4, 2025

maybe it can be changed to the following to support both ways?

def importDWARFRegisterMappingsManager():
    try:
        from ghidra.app.util.bin.format.dwarf import DWARFRegisterMappingsManager
        return
    except ImportError:
        pass
    try: 
        from ghidra.app.util.bin.format.dwarf4.next import DWARFRegisterMappingsManager
    except ImportError:
        print('Unable to import DWARFRegisterMappingsManager')

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

1 participant